using System;
using System.Collections.Generic;
using System.Linq;

namespace PushPlatform.Data.Bll
{
    public partial class BllSysSendCfg
    {
        private DaoAchieve.SysSendCfgDaoAchieve _CurrentDao = null;
        internal DaoAchieve.SysSendCfgDaoAchieve CurrentDao
        {
            get{
                if(_CurrentDao==null)
                {
                    _CurrentDao=new DaoAchieve.SysSendCfgDaoAchieve();
                }
                return _CurrentDao;
            }
        }
        
        public BllSysSendCfg()
        {
            
        }
    
        #region Service Bll
        public int Save(SysSendCfg entity)
        {
            if(entity == null)
                return 0;
            return CurrentDao.Save(entity);
        }
        
        public int Save(List<SysSendCfg> entityList)
        {
            if(entityList == null || entityList.Count == 0)
                return 0;
            return CurrentDao.Save(entityList);
        }
        
        
        public int Delete(string id)
        {
            if(string.IsNullOrEmpty(id))
                return 0;
            return CurrentDao.Delete(id);
        }
        
        public int Update(SysSendCfg entity)
        {
            if(entity == null)
                return 0;
            return CurrentDao.Update(entity);
        }
        
        public int Update(List<SysSendCfg> entityList)
        {
            if(entityList == null || entityList.Count == 0)
                return 0;
            return CurrentDao.Save(entityList);
        }
        
        public int SaveOrUpdate(IList<SysSendCfg> entityList)
        {
            if(entityList == null || entityList.Count == 0)
                return 0;
            return CurrentDao.SaveOrUpdate(entityList);
        }
        
        public SysSendCfg Get(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return null;
            }
            return CurrentDao.Get(id);
        }
        
        public int GetCount(PushPlatform.Data.Criteria.CriteriaSysSendCfg mycriteria)
        {
            return CurrentDao.GetCount(mycriteria);
        }
        
        public List<SysSendCfg> Fetch(PushPlatform.Data.Criteria.CriteriaSysSendCfg mycriteria)
        {
            if(mycriteria.UsePage && (mycriteria.PageIndex <= 0 || mycriteria.PageSize < 1))
            {
                mycriteria.PageTotal = 0;
                return new List<SysSendCfg>();
            }
            return CurrentDao.Fetch(mycriteria);
        }
        #endregion
       
    }
}

