/// 
///WCF service
///FOR TABLE t_WaveRule
///By wm  
///on 07/03/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;
using DeiNiu.Utils;
namespace DeiNiu.Wcf
{
    // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名 。
    public class WaveRuleService: basicService,  IWaveRule 
    {
        private static  lWaveRule  _lWaveRule ;
         lWaveRule  lWaveRuleObj
        {
            get
            {
                if ( _lWaveRule  == null ||   _lWaveRule.operId != getOperId())
                {
                     _lWaveRule= new  lWaveRule(getOperId());
                }
                return  _lWaveRule;
            }
        }
        public DataSet query(string querystr, int rownumStart, int rownumEnd)
        {
            return   lWaveRuleObj.Query(querystr, rownumStart, rownumEnd);
        }
        public int add(WcfWaveRule wcfData)
        { 
            return   lWaveRuleObj.add(wcfData.getDbObject()); 
        }
        public int update(WcfWaveRule wcfData)
        {
            return wcfData.getDbObject().Update();
        }
        public int delete(WcfWaveRule wcfData)
        {
            return wcfData.getDbObject().Delete();
        }
        public bool setRule(WcfWaveRule wcfData)
        {
           return lWaveRuleObj.setRule(wcfData);
        }
        public WcfWaveRule[] getWaveRules(enumWaveRuleType type)
        {
          DataTable dt = lWaveRuleObj.queryByType(type); 
          List lst = new List();
          foreach (DataRow dr in dt.Rows)
          {
              lst.Add(new WcfWaveRule(dr));
          }
          return lst.ToArray();
        }
        public WcfWaveRule getCurrentActiveRule(Utils.enumWaveRuleType enumWaveRuleType)
        {
            WaveRule obj = lWaveRuleObj.getCurrentActiveRule(enumWaveRuleType);
            if (obj != null)
            {
                return new Wcf.WcfWaveRule().getWcfObject(obj);
            }
            return new Wcf.WcfWaveRule();
         
        }
    }
 }