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

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

