Esempio n. 1
0
        public static bool ModifyBaseData(BaseDataEntity baseDataEntity)
        {
            int result = 0;

            if (baseDataEntity != null)
            {
                BaseDataRepository mr = new BaseDataRepository();

                BaseDataInfo baseDataInfo = TranslateBaseDataInfo(baseDataEntity);


                if (baseDataEntity.ID > 0)
                {
                    result = mr.ModifyData(baseDataInfo);
                }
                else
                {
                    baseDataInfo.CreateDate = DateTime.Now;
                    result = mr.CreateNew(baseDataInfo);
                }
                List <BaseDataInfo> miList = mr.GetAllData();//刷新缓存
                Cache.Add("BaseDataALL", miList);
            }
            return(result > 0);
        }
Esempio n. 2
0
        public static List <BaseDataEntity> GetBaseDataAll()
        {
            List <BaseDataEntity> all    = new List <BaseDataEntity>();
            BaseDataRepository    mr     = new BaseDataRepository();
            List <BaseDataInfo>   miList = mr.GetAllData();//Cache.Get<List<BaseDataInfo>>("BaseDataALLN");

            //if (miList.IsEmpty())
            //{
            //    miList = mr.GetAllData();
            //    Cache.Add("BaseDataALL", miList);
            //}

            if (!miList.IsEmpty())
            {
                foreach (BaseDataInfo mInfo in miList)
                {
                    BaseDataEntity BaseDataEntity = TranslateBaseDataEntity(mInfo);
                    all.Add(BaseDataEntity);
                }
            }

            return(all);
        }