/// 
///WCF service
///FOR TABLE t_wmsOutBox
///By wm  
///on 04/06/2020
/// 
  
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DeiNiu.wms.Logical;
using System.Data;
using DeiNiu.wms.Data.Model;
namespace DeiNiu.Wcf
{
    // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名 。
    public class WmsOutBoxService: basicService,  IWmsOutBox 
    {
        private static  lWmsOutBox  _lWmsOutBox ;
         lWmsOutBox  lWmsOutBoxObj
        {
            get
            {
                if ( _lWmsOutBox  == null ||   _lWmsOutBox.operId != getOperId())
                {
                     _lWmsOutBox= new  lWmsOutBox(getOperId());
                }
                return  _lWmsOutBox;
            }
        }
        public DataSet query(string querystr, int rownumStart, int rownumEnd)
        {
            return   lWmsOutBoxObj.Query(querystr, rownumStart, rownumEnd);
        }
        public  int add(WcfWmsOutBox wcfData,int count) 
        {
            return lWmsOutBoxObj.add(getDbObject(wcfData) , count); 
        }
   
        public bool update(List wcfs)
        {
            foreach (WcfWmsOutBox wv in wcfs)
            {
                getDbObject(wv).Update();
            }
            return true;
        }
        public int delete(WcfWmsOutBox wcfData)
        {
            return wcfData.getDbObject().Delete();
        }
        WmsOutBox getDbObject(WcfWmsOutBox wcfBox)
        {
            WmsOutBox dbObj = new WmsOutBox(wcfBox.id);
            dbObj.ID = wcfBox.id;
            
            dbObj.color = wcfBox.color; 
            dbObj.partion = wcfBox.partion;
           
            dbObj.load = wcfBox.load;
            dbObj.volume = wcfBox.volume;
            dbObj.length = wcfBox.length;
            dbObj.width = wcfBox.width;
            dbObj.height = wcfBox.height;
            dbObj.type = wcfBox.type;
            dbObj.state = wcfBox.state;
            return dbObj;
        }
     
    }
 }