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

namespace PushPlatform.Data.Bll
{
    public partial class BllSysPush
    {
        private DaoAchieve.SysPushDaoAchieve _CurrentDao = null;
        internal DaoAchieve.SysPushDaoAchieve CurrentDao
        {
            get{
                if(_CurrentDao==null)
                {
                    _CurrentDao=new DaoAchieve.SysPushDaoAchieve();
                }
                return _CurrentDao;
            }
        }
        
        public BllSysPush()
        {
            
        }
    
        #region Service Bll
        public int Save(SysPush entity)
        {
            if(entity == null)
                return 0;
            return CurrentDao.Save(entity);
        }
        
        public int Save(List<SysPush> 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(SysPush entity)
        {
            if(entity == null)
                return 0;
            return CurrentDao.Update(entity);
        }
        
        public int Update(List<SysPush> entityList)
        {
            if(entityList == null || entityList.Count == 0)
                return 0;
            return CurrentDao.Save(entityList);
        }
        
        public int SaveOrUpdate(IList<SysPush> entityList)
        {
            if(entityList == null || entityList.Count == 0)
                return 0;
            return CurrentDao.SaveOrUpdate(entityList);
        }
        
        public SysPush Get(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return null;
            }
            return CurrentDao.Get(id);
        }
        
        public int GetCount(PushPlatform.Data.Criteria.CriteriaSysPush mycriteria)
        {
            return CurrentDao.GetCount(mycriteria);
        }
        
        public List<SysPush> Fetch(PushPlatform.Data.Criteria.CriteriaSysPush mycriteria)
        {
            if(mycriteria.UsePage && (mycriteria.PageIndex <= 0 || mycriteria.PageSize < 1))
            {
                mycriteria.PageTotal = 0;
                return new List<SysPush>();
            }
            return CurrentDao.Fetch(mycriteria);
        }
        #endregion
       
    }
}

