Ejemplo n.º 1
0
        public static bool ModifyChargingBase(ChargingBaseEntity entity)
        {
            int result = 0;

            if (entity != null)
            {
                ChargeRepository mr = new ChargeRepository();

                ChargingBaseInfo info = TranslateChargingBaseEntity(entity);


                if (entity.ChargeBaseID > 0)
                {
                    result = mr.ModifyChargingBase(info);
                }
                else
                {
                    info.CreateDate = DateTime.Now;
                    result          = mr.CreateNewChargingBase(info);
                }

                List <ChargingBaseInfo> miList = mr.GetAllChargingBaseInfo();//刷新缓存
                Cache.Add("ChargingBaseALL", miList);
            }
            return(result > 0);
        }
Ejemplo n.º 2
0
        public static int RemoveChargingBase(int id)
        {
            ChargeRepository mr = new ChargeRepository();
            int r = mr.RemoveChargeBase(id);
            List <ChargingBaseInfo> miList = mr.GetAllChargingBaseInfo();//刷新缓存

            Cache.Add("ChargingBaseALL", miList);
            return(r);
        }
Ejemplo n.º 3
0
        public static List <ChargingBaseEntity> GetAllChargingBaseEntity()
        {
            List <ChargingBaseEntity> all    = new List <ChargingBaseEntity>();
            ChargeRepository          mr     = new ChargeRepository();
            List <ChargingBaseInfo>   miList = Cache.Get <List <ChargingBaseInfo> >("ChargingBaseALL");

            if (miList.IsEmpty())
            {
                miList = mr.GetAllChargingBaseInfo();
                Cache.Add("ChargingBaseALL", miList);
            }
            if (!miList.IsEmpty())
            {
                foreach (ChargingBaseInfo mInfo in miList)
                {
                    ChargingBaseEntity chargingBaseEntity = TranslateChargingBaseInfo(mInfo);
                    all.Add(chargingBaseEntity);
                }
            }

            return(all);
        }