예제 #1
0
        //数据持久化
        internal static void  SaveToDb(MainProjectCreateInfo pMainProjectCreateInfo, MainProjectCreate pMainProjectCreate, bool pIsNew)
        {
            pMainProjectCreate.MainProjectCreateId = pMainProjectCreateInfo.mainProjectCreateId;
            pMainProjectCreate.ClientId            = pMainProjectCreateInfo.clientId;
            pMainProjectCreate.ProjectLevelId      = pMainProjectCreateInfo.projectLevelId;
            pMainProjectCreate.ProjectTypeId       = pMainProjectCreateInfo.projectTypeId;
            pMainProjectCreate.YeWuId      = pMainProjectCreateInfo.yeWuId;
            pMainProjectCreate.SheetNum    = pMainProjectCreateInfo.sheetNum;
            pMainProjectCreate.ProjectName = pMainProjectCreateInfo.projectName;
            pMainProjectCreate.PreMoney    = pMainProjectCreateInfo.preMoney;
            pMainProjectCreate.PreProfit   = pMainProjectCreateInfo.preProfit;
            pMainProjectCreate.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pMainProjectCreate.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(MainProjectCreateInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pMainProjectCreateInfo.mainProjectCreateId = pMainProjectCreate.MainProjectCreateId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(MainProjectCreateInfo)))
            {
                ResetCache();
            }
        }
예제 #2
0
        //数据持久化
        internal static void  SaveToDb(ProductTypeInfo pProductTypeInfo, ProductType pProductType, bool pIsNew)
        {
            pProductType.ProductTypeId = pProductTypeInfo.productTypeId;
            pProductType.ProductName   = pProductTypeInfo.productName;
            pProductType.OfferPriceId  = pProductTypeInfo.offerPriceId;
            pProductType.Model         = pProductTypeInfo.model;
            pProductType.Unit          = pProductTypeInfo.unit;
            pProductType.Num           = pProductTypeInfo.num;
            pProductType.Price         = pProductTypeInfo.price;
            pProductType.Sums          = pProductTypeInfo.sums;
            pProductType.IsNew         = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pProductType.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ProductTypeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pProductTypeInfo.productTypeId = pProductType.ProductTypeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)))
            {
                ResetCache();
            }
        }
예제 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <WorkToolSumInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(WorkToolSumInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <WorkToolSumInfo>);
            }
            else
            {
                List <WorkToolSumInfo> list       = new List <WorkToolSumInfo>();
                WorkToolSumCollection  collection = new  WorkToolSumCollection();
                Query qry = new Query(WorkToolSum.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (WorkToolSum workToolSum in collection)
                {
                    WorkToolSumInfo workToolSumInfo = new WorkToolSumInfo();
                    LoadFromDAL(workToolSumInfo, workToolSum);
                    list.Add(workToolSumInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(WorkToolSumInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #4
0
        //数据持久化
        internal static void  SaveToDb(OverTimeInfo pOverTimeInfo, OverTime pOverTime, bool pIsNew)
        {
            pOverTime.OverTimeId  = pOverTimeInfo.overTimeId;
            pOverTime.ApplyDate   = pOverTimeInfo.applyDate;
            pOverTime.TimeFrom    = pOverTimeInfo.timeFrom;
            pOverTime.TimeTo      = pOverTimeInfo.timeTo;
            pOverTime.ApplyEmName = pOverTimeInfo.applyEmName;
            pOverTime.Reason      = pOverTimeInfo.reason;
            pOverTime.IsSubmit    = pOverTimeInfo.isSubmit;
            pOverTime.TimeSpan    = pOverTimeInfo.timeSpan;
            pOverTime.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pOverTime.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(OverTimeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pOverTimeInfo.overTimeId = pOverTime.OverTimeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
            {
                ResetCache();
            }
        }
예제 #5
0
        //数据持久化
        internal static void  SaveToDb(MasterInfo pMasterInfo, Master pMaster, bool pIsNew)
        {
            pMaster.MasterId   = pMasterInfo.masterId;
            pMaster.MasterName = pMasterInfo.masterName;
            pMaster.MasterPsd  = pMasterInfo.masterPsd;
            pMaster.DepartId   = pMasterInfo.departId;
            pMaster.CreateDate = pMasterInfo.createDate;
            pMaster.EmployeeId = pMasterInfo.employeeId;
            pMaster.IsApply    = pMasterInfo.isApply;
            pMaster.State      = pMasterInfo.state;
            pMaster.IsNew      = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pMaster.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(MasterInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pMasterInfo.masterId = pMaster.MasterId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(MasterInfo)))
            {
                ResetCache();
            }
        }
예제 #6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <ProjectStepInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectStepInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <ProjectStepInfo>);
            }
            else
            {
                List <ProjectStepInfo> list       = new List <ProjectStepInfo>();
                ProjectStepCollection  collection = new  ProjectStepCollection();
                Query qry = new Query(ProjectStep.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (ProjectStep projectStep in collection)
                {
                    ProjectStepInfo projectStepInfo = new ProjectStepInfo();
                    LoadFromDAL(projectStepInfo, projectStep);
                    list.Add(projectStepInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectStepInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #7
0
        //数据持久化
        internal static void  SaveToDb(AssetInfo pAssetInfo, Asset pAsset, bool pIsNew)
        {
            pAsset.AssetId    = pAssetInfo.assetId;
            pAsset.AssetName  = pAssetInfo.assetName;
            pAsset.Type       = pAssetInfo.type;
            pAsset.DepartName = pAssetInfo.departName;
            pAsset.SiteName   = pAssetInfo.siteName;
            pAsset.UnitName   = pAssetInfo.unitName;
            pAsset.Amount     = pAssetInfo.amount;
            pAsset.Price      = pAssetInfo.price;
            pAsset.Memo       = pAssetInfo.memo;
            pAsset.IsNew      = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pAsset.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(AssetInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pAssetInfo.assetId = pAsset.AssetId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(AssetInfo)))
            {
                ResetCache();
            }
        }
예제 #8
0
        //数据持久化
        internal static void  SaveToDb(CarApplyInfo pCarApplyInfo, CarApply pCarApply, bool pIsNew)
        {
            pCarApply.CarApplyId = pCarApplyInfo.carApplyId;
            pCarApply.SheetNum   = pCarApplyInfo.sheetNum;
            pCarApply.ApplyTime  = pCarApplyInfo.applyTime;
            pCarApply.BeginSite  = pCarApplyInfo.beginSite;
            pCarApply.EndSite    = pCarApplyInfo.endSite;
            pCarApply.Reason     = pCarApplyInfo.reason;
            pCarApply.Memo       = pCarApplyInfo.memo;
            pCarApply.StateId    = pCarApplyInfo.stateId;
            pCarApply.IsNew      = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pCarApply.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(CarApplyInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pCarApplyInfo.carApplyId = pCarApply.CarApplyId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(CarApplyInfo)))
            {
                ResetCache();
            }
        }
예제 #9
0
        //数据持久化
        internal static void  SaveToDb(WeekScoreInfo pWeekScoreInfo, WeekScore pWeekScore, bool pIsNew)
        {
            pWeekScore.WeekScoreId  = pWeekScoreInfo.weekScoreId;
            pWeekScore.WeekScoreNum = pWeekScoreInfo.weekScoreNum;
            pWeekScore.IsSubmit     = pWeekScoreInfo.isSubmit;
            pWeekScore.EmployeeId   = pWeekScoreInfo.employeeId;
            pWeekScore.TotalScore   = pWeekScoreInfo.totalScore;
            pWeekScore.IsNew        = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pWeekScore.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(WeekScoreInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pWeekScoreInfo.weekScoreId = pWeekScore.WeekScoreId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(WeekScoreInfo)))
            {
                ResetCache();
            }
        }
예제 #10
0
        //数据持久化
        internal static void  SaveToDb(WeekSumInfo pWeekSumInfo, WeekSum pWeekSum, bool pIsNew)
        {
            pWeekSum.WeekSumId      = pWeekSumInfo.weekSumId;
            pWeekSum.WeekSumName    = pWeekSumInfo.weekSumName;
            pWeekSum.IsApprove      = pWeekSumInfo.isApprove;
            pWeekSum.IsApply        = pWeekSumInfo.isApply;
            pWeekSum.IsSend         = pWeekSumInfo.isSend;
            pWeekSum.ApplyTime      = pWeekSumInfo.applyTime;
            pWeekSum.RepplyTime     = pWeekSumInfo.repplyTime;
            pWeekSum.ApplyView      = pWeekSumInfo.applyView;
            pWeekSum.SendEmployeeId = pWeekSumInfo.sendEmployeeId;
            pWeekSum.RecvEmployeeId = pWeekSumInfo.recvEmployeeId;
            pWeekSum.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pWeekSum.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(WeekSumInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pWeekSumInfo.weekSumId = pWeekSum.WeekSumId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
            {
                ResetCache();
            }
        }
예제 #11
0
        //数据持久化
        internal static void  SaveToDb(ClientInfo pClientInfo, Client pClient, bool pIsNew)
        {
            pClient.ClientId      = pClientInfo.clientId;
            pClient.ClientName    = pClientInfo.clientName;
            pClient.ClientLevelId = pClientInfo.clientLevelId;
            pClient.Address       = pClientInfo.address;
            pClient.Telephone     = pClientInfo.telephone;
            pClient.MailNo        = pClientInfo.mailNo;
            pClient.Fax           = pClientInfo.fax;
            pClient.EmployeeId    = pClientInfo.employeeId;
            pClient.ClientTypeId  = pClientInfo.clientTypeId;
            pClient.SheetNum      = pClientInfo.sheetNum;
            pClient.IsNew         = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pClient.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ClientInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pClientInfo.clientId = pClient.ClientId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)))
            {
                ResetCache();
            }
        }
예제 #12
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <EvaluateLevelInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(EvaluateLevelInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <EvaluateLevelInfo>);
            }
            else
            {
                List <EvaluateLevelInfo> list       = new List <EvaluateLevelInfo>();
                EvaluateLevelCollection  collection = new  EvaluateLevelCollection();
                Query qry = new Query(EvaluateLevel.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (EvaluateLevel evaluateLevel in collection)
                {
                    EvaluateLevelInfo evaluateLevelInfo = new EvaluateLevelInfo();
                    LoadFromDAL(evaluateLevelInfo, evaluateLevel);
                    list.Add(evaluateLevelInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(EvaluateLevelInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #13
0
        //数据持久化
        internal static void  SaveToDb(RoleMasterInfo pRoleMasterInfo, RoleMaster pRoleMaster, bool pIsNew)
        {
            pRoleMaster.RoleMasterId = pRoleMasterInfo.roleMasterId;
            pRoleMaster.RoleId       = pRoleMasterInfo.roleId;
            pRoleMaster.MasterId     = pRoleMasterInfo.masterId;
            pRoleMaster.IsPass       = pRoleMasterInfo.isPass;
            pRoleMaster.IsNew        = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pRoleMaster.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(RoleMasterInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pRoleMasterInfo.roleMasterId = pRoleMaster.RoleMasterId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(RoleMasterInfo)))
            {
                ResetCache();
            }
        }
예제 #14
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <FileOfApplyInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(FileOfApplyInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <FileOfApplyInfo>);
            }
            else
            {
                List <FileOfApplyInfo> list       = new List <FileOfApplyInfo>();
                FileOfApplyCollection  collection = new  FileOfApplyCollection();
                Query qry = new Query(FileOfApply.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (FileOfApply fileOfApply in collection)
                {
                    FileOfApplyInfo fileOfApplyInfo = new FileOfApplyInfo();
                    LoadFromDAL(fileOfApplyInfo, fileOfApply);
                    list.Add(fileOfApplyInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(FileOfApplyInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #15
0
        //数据持久化
        internal static void  SaveToDb(NoticeInfo pNoticeInfo, Notice pNotice, bool pIsNew)
        {
            pNotice.NoticeId      = pNoticeInfo.noticeId;
            pNotice.NoticeContent = pNoticeInfo.noticeContent;
            pNotice.SignName      = pNoticeInfo.signName;
            pNotice.NoticeTime    = pNoticeInfo.noticeTime;
            pNotice.NoticeTitle   = pNoticeInfo.noticeTitle;
            pNotice.EmployeeName  = pNoticeInfo.employeeName;
            pNotice.IsNew         = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pNotice.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(NoticeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pNoticeInfo.noticeId = pNotice.NoticeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(NoticeInfo)))
            {
                ResetCache();
            }
        }
예제 #16
0
        //数据持久化
        internal static void  SaveToDb(MessageInfo pMessageInfo, Message pMessage, bool pIsNew)
        {
            pMessage.MessageId      = pMessageInfo.messageId;
            pMessage.Memo           = pMessageInfo.memo;
            pMessage.RecvEmployeeId = pMessageInfo.recvEmployeeId;
            pMessage.Msg            = pMessageInfo.msg;
            pMessage.Url            = pMessageInfo.url;
            pMessage.EmployeeName   = pMessageInfo.employeeName;
            pMessage.MsgType        = pMessageInfo.msgType;
            pMessage.MsgTime        = pMessageInfo.msgTime;
            pMessage.MsgTitle       = pMessageInfo.msgTitle;
            pMessage.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pMessage.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(MessageInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pMessageInfo.messageId = pMessage.MessageId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(MessageInfo)))
            {
                ResetCache();
            }
        }
예제 #17
0
        //数据持久化
        internal static void  SaveToDb(RelateInfo pRelateInfo, Relate pRelate, bool pIsNew)
        {
            pRelate.RelateId   = pRelateInfo.relateId;
            pRelate.RelateName = pRelateInfo.relateName;
            pRelate.Mobile     = pRelateInfo.mobile;
            pRelate.Email      = pRelateInfo.email;
            pRelate.Memo       = pRelateInfo.memo;
            pRelate.ClientId   = pRelateInfo.clientId;
            pRelate.Position   = pRelateInfo.position;
            pRelate.IsNew      = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pRelate.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(RelateInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pRelateInfo.relateId = pRelate.RelateId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(RelateInfo)))
            {
                ResetCache();
            }
        }
예제 #18
0
        //数据持久化
        internal static void  SaveToDb(ContractInfo pContractInfo, Contract pContract, bool pIsNew)
        {
            pContract.ContractId     = pContractInfo.contractId;
            pContract.ContractFileId = pContractInfo.contractFileId;
            pContract.SignName       = pContractInfo.signName;
            pContract.ContractNum    = pContractInfo.contractNum;
            pContract.ContractName   = pContractInfo.contractName;
            pContract.BeginDate      = pContractInfo.beginDate;
            pContract.MoneySum       = pContractInfo.moneySum;
            pContract.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pContract.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ContractInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pContractInfo.contractId = pContract.ContractId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContractInfo)))
            {
                ResetCache();
            }
        }
예제 #19
0
        //数据持久化
        internal static void  SaveToDb(OutRegistInfo pOutRegistInfo, OutRegist pOutRegist, bool pIsNew)
        {
            pOutRegist.OutRegistId = pOutRegistInfo.outRegistId;
            pOutRegist.OutDate     = pOutRegistInfo.outDate;
            pOutRegist.OutTime     = pOutRegistInfo.outTime;
            pOutRegist.OutContent  = pOutRegistInfo.outContent;
            pOutRegist.BackTime    = pOutRegistInfo.backTime;
            pOutRegist.OutTool     = pOutRegistInfo.outTool;
            pOutRegist.Memo        = pOutRegistInfo.memo;
            pOutRegist.ApplyName   = pOutRegistInfo.applyName;
            pOutRegist.DepartName  = pOutRegistInfo.departName;
            pOutRegist.State       = pOutRegistInfo.state;
            pOutRegist.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pOutRegist.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(OutRegistInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pOutRegistInfo.outRegistId = pOutRegist.OutRegistId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(OutRegistInfo)))
            {
                ResetCache();
            }
        }
예제 #20
0
        //数据持久化
        internal static void  SaveToDb(ProjectStepInfo pProjectStepInfo, ProjectStep pProjectStep, bool pIsNew)
        {
            pProjectStep.ProjectStepId   = pProjectStepInfo.projectStepId;
            pProjectStep.ProjectStepName = pProjectStepInfo.projectStepName;
            pProjectStep.IsNew           = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pProjectStep.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ProjectStepInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pProjectStepInfo.projectStepId = pProjectStep.ProjectStepId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectStepInfo)))
            {
                ResetCache();
            }
        }
예제 #21
0
        //数据持久化
        internal static void  SaveToDb(DayInfo pDayInfo, Day pDay, bool pIsNew)
        {
            pDay.DayId       = pDayInfo.dayId;
            pDay.WeekId      = pDayInfo.weekId;
            pDay.WorkContent = pDayInfo.workContent;
            pDay.WorkDate    = pDayInfo.workDate;
            pDay.Result      = pDayInfo.result;
            pDay.WeekSumId   = pDayInfo.weekSumId;
            pDay.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pDay.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(DayInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pDayInfo.dayId = pDay.DayId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(DayInfo)))
            {
                ResetCache();
            }
        }
예제 #22
0
        //数据持久化
        internal static void  SaveToDb(TaskInfo pTaskInfo, Task pTask, bool pIsNew)
        {
            pTask.TaskId      = pTaskInfo.taskId;
            pTask.TaskName    = pTaskInfo.taskName;
            pTask.EmployeeId  = pTaskInfo.employeeId;
            pTask.WorkSheetId = pTaskInfo.workSheetId;
            pTask.RecvTime    = pTaskInfo.recvTime;
            pTask.IsFinish    = pTaskInfo.isFinish;
            pTask.FinishTime  = pTaskInfo.finishTime;
            pTask.BeginTime   = pTaskInfo.beginTime;
            pTask.IsMain      = pTaskInfo.isMain;
            pTask.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pTask.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(TaskInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pTaskInfo.taskId = pTask.TaskId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(TaskInfo)))
            {
                ResetCache();
            }
        }
예제 #23
0
        //数据持久化
        internal static void  SaveToDb(DayScoreInfo pDayScoreInfo, DayScore pDayScore, bool pIsNew)
        {
            pDayScore.DayScoreId  = pDayScoreInfo.dayScoreId;
            pDayScore.Today       = pDayScoreInfo.today;
            pDayScore.Item        = pDayScoreInfo.item;
            pDayScore.FinishTime  = pDayScoreInfo.finishTime;
            pDayScore.Roles       = pDayScoreInfo.roles;
            pDayScore.TimeSpan    = pDayScoreInfo.timeSpan;
            pDayScore.Memo        = pDayScoreInfo.memo;
            pDayScore.Score       = pDayScoreInfo.score;
            pDayScore.WeekScoreId = pDayScoreInfo.weekScoreId;
            pDayScore.DayRoleId   = pDayScoreInfo.dayRoleId;
            pDayScore.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pDayScore.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(DayScoreInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pDayScoreInfo.dayScoreId = pDayScore.DayScoreId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(DayScoreInfo)))
            {
                ResetCache();
            }
        }
예제 #24
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <DayScoreInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(DayScoreInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <DayScoreInfo>);
            }
            else
            {
                List <DayScoreInfo> list       = new List <DayScoreInfo>();
                DayScoreCollection  collection = new  DayScoreCollection();
                Query qry = new Query(DayScore.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (DayScore dayScore in collection)
                {
                    DayScoreInfo dayScoreInfo = new DayScoreInfo();
                    LoadFromDAL(dayScoreInfo, dayScore);
                    list.Add(dayScoreInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(DayScoreInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #25
0
        //数据持久化
        internal static void  SaveToDb(FileEmployeeInfo pFileEmployeeInfo, FileEmployee pFileEmployee, bool pIsNew)
        {
            pFileEmployee.FileEmployeeId = pFileEmployeeInfo.fileEmployeeId;
            pFileEmployee.FileId         = pFileEmployeeInfo.fileId;
            pFileEmployee.EmployeeId     = pFileEmployeeInfo.employeeId;
            pFileEmployee.IsMsg          = pFileEmployeeInfo.isMsg;
            pFileEmployee.IsDelete       = pFileEmployeeInfo.isDelete;
            pFileEmployee.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pFileEmployee.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(FileEmployeeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pFileEmployeeInfo.fileEmployeeId = pFileEmployee.FileEmployeeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(FileEmployeeInfo)))
            {
                ResetCache();
            }
        }
예제 #26
0
        //数据持久化
        internal static void  SaveToDb(ContactInfo pContactInfo, Contact pContact, bool pIsNew)
        {
            pContact.ContactId   = pContactInfo.contactId;
            pContact.Mobile      = pContactInfo.mobile;
            pContact.Officephone = pContactInfo.officephone;
            pContact.PhoneExt    = pContactInfo.phoneExt;
            pContact.Homephone   = pContactInfo.homephone;
            pContact.Email       = pContactInfo.email;
            pContact.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pContact.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ContactInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pContactInfo.contactId = pContact.ContactId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContactInfo)))
            {
                ResetCache();
            }
        }
예제 #27
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <MainWorkSheetInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(MainWorkSheetInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <MainWorkSheetInfo>);
            }
            else
            {
                List <MainWorkSheetInfo> list       = new List <MainWorkSheetInfo>();
                MainWorkSheetCollection  collection = new  MainWorkSheetCollection();
                Query qry = new Query(MainWorkSheet.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (MainWorkSheet mainWorkSheet in collection)
                {
                    MainWorkSheetInfo mainWorkSheetInfo = new MainWorkSheetInfo();
                    LoadFromDAL(mainWorkSheetInfo, mainWorkSheet);
                    list.Add(mainWorkSheetInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(MainWorkSheetInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #28
0
        //数据持久化
        internal static void  SaveToDb(StampInfo pStampInfo, Stamp pStamp, bool pIsNew)
        {
            pStamp.StampId         = pStampInfo.stampId;
            pStamp.UseDate         = pStampInfo.useDate;
            pStamp.StampFileTypeId = pStampInfo.stampFileTypeId;
            pStamp.StampTypeId     = pStampInfo.stampTypeId;
            pStamp.Stampuse        = pStampInfo.stampuse;
            pStamp.Memo            = pStampInfo.memo;
            pStamp.ApplyName       = pStampInfo.applyName;
            pStamp.DepartName      = pStampInfo.departName;
            pStamp.State           = pStampInfo.state;
            pStamp.ApplyTime       = pStampInfo.applyTime;
            pStamp.IsNew           = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pStamp.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(StampInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pStampInfo.stampId = pStamp.StampId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(StampInfo)))
            {
                ResetCache();
            }
        }
예제 #29
0
        //数据持久化
        internal static void  SaveToDb(ProjectCreateInfo pProjectCreateInfo, ProjectCreate pProjectCreate, bool pIsNew)
        {
            pProjectCreate.ProjectCreateId  = pProjectCreateInfo.projectCreateId;
            pProjectCreate.ClientId         = pProjectCreateInfo.clientId;
            pProjectCreate.ProjectLevelId   = pProjectCreateInfo.projectLevelId;
            pProjectCreate.ProjectTypeId    = pProjectCreateInfo.projectTypeId;
            pProjectCreate.YeWuId           = pProjectCreateInfo.yeWuId;
            pProjectCreate.ProjectName      = pProjectCreateInfo.projectName;
            pProjectCreate.PreMoney         = pProjectCreateInfo.preMoney;
            pProjectCreate.PreProfit        = pProjectCreateInfo.preProfit;
            pProjectCreate.ApplyDate        = pProjectCreateInfo.applyDate;
            pProjectCreate.CreatePhaseExp   = pProjectCreateInfo.createPhaseExp;
            pProjectCreate.ProposePhaseExp  = pProjectCreateInfo.proposePhaseExp;
            pProjectCreate.CallbidPhaseExp  = pProjectCreateInfo.callbidPhaseExp;
            pProjectCreate.TalkPhaseExp     = pProjectCreateInfo.talkPhaseExp;
            pProjectCreate.CarryPhaseExp    = pProjectCreateInfo.carryPhaseExp;
            pProjectCreate.NeedDescribe     = pProjectCreateInfo.needDescribe;
            pProjectCreate.CompitDescribe   = pProjectCreateInfo.compitDescribe;
            pProjectCreate.ClientDescribe   = pProjectCreateInfo.clientDescribe;
            pProjectCreate.TechDescribe     = pProjectCreateInfo.techDescribe;
            pProjectCreate.BusinessDescribe = pProjectCreateInfo.businessDescribe;
            pProjectCreate.RiskDescribe     = pProjectCreateInfo.riskDescribe;
            pProjectCreate.StrategyDesribe  = pProjectCreateInfo.strategyDesribe;
            pProjectCreate.Memo             = pProjectCreateInfo.memo;
            pProjectCreate.MarketView       = pProjectCreateInfo.marketView;
            pProjectCreate.TechView         = pProjectCreateInfo.techView;
            pProjectCreate.ManagerView      = pProjectCreateInfo.managerView;
            pProjectCreate.SheetNum         = pProjectCreateInfo.sheetNum;
            pProjectCreate.Today            = pProjectCreateInfo.today;
            pProjectCreate.ApplyName        = pProjectCreateInfo.applyName;
            pProjectCreate.DepartName       = pProjectCreateInfo.departName;
            pProjectCreate.State            = pProjectCreateInfo.state;
            pProjectCreate.ApplyTime        = pProjectCreateInfo.applyTime;
            pProjectCreate.IsNew            = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pProjectCreate.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ProjectCreateInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pProjectCreateInfo.projectCreateId = pProjectCreate.ProjectCreateId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo)))
            {
                ResetCache();
            }
        }
예제 #30
0
        //数据持久化
        internal static void  SaveToDb(EmployeeInfo pEmployeeInfo, Employee pEmployee, bool pIsNew)
        {
            pEmployee.EmployeeId   = pEmployeeInfo.employeeId;
            pEmployee.ContactId    = pEmployeeInfo.contactId;
            pEmployee.EmployeeName = pEmployeeInfo.employeeName;
            pEmployee.PositionId   = pEmployeeInfo.positionId;
            pEmployee.Sex          = pEmployeeInfo.sex;
            pEmployee.Birthday     = pEmployeeInfo.birthday;
            pEmployee.Marrage      = pEmployeeInfo.marrage;
            pEmployee.Address      = pEmployeeInfo.address;
            pEmployee.NativePlace  = pEmployeeInfo.nativePlace;
            pEmployee.PoliticsId   = pEmployeeInfo.politicsId;
            pEmployee.IdentyNum    = pEmployeeInfo.identyNum;
            pEmployee.School       = pEmployeeInfo.school;
            pEmployee.Major        = pEmployeeInfo.major;
            pEmployee.EducationId  = pEmployeeInfo.educationId;
            pEmployee.LanguageId   = pEmployeeInfo.languageId;
            pEmployee.Certificate  = pEmployeeInfo.certificate;
            pEmployee.JobTime      = pEmployeeInfo.jobTime;
            pEmployee.JoinTime     = pEmployeeInfo.joinTime;
            pEmployee.DepartId     = pEmployeeInfo.departId;
            pEmployee.State        = pEmployeeInfo.state;
            pEmployee.OffJobTime   = pEmployeeInfo.offJobTime;
            pEmployee.Image        = pEmployeeInfo.image;
            pEmployee.Qq           = pEmployeeInfo.qq;
            pEmployee.TurnTime     = pEmployeeInfo.turnTime;
            pEmployee.EmLevelId    = pEmployeeInfo.emLevelId;
            pEmployee.EmDangId     = pEmployeeInfo.emDangId;
            pEmployee.IsNew        = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pEmployee.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(EmployeeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pEmployeeInfo.employeeId = pEmployee.EmployeeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(EmployeeInfo)))
            {
                ResetCache();
            }
        }