//数据持久化 internal static void SaveToDb(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice,bool pIsNew) { pOfferPrice.OfferPriceId = pOfferPriceInfo.offerPriceId; pOfferPrice.EmployeeId = pOfferPriceInfo.employeeId; pOfferPrice.MainProjectCreateId = pOfferPriceInfo.mainProjectCreateId; pOfferPrice.MainOfferPriceId = pOfferPriceInfo.mainOfferPriceId; pOfferPrice.ProjectDes = pOfferPriceInfo.projectDes; pOfferPrice.SheetNum = pOfferPriceInfo.sheetNum; pOfferPrice.FillTableDate = pOfferPriceInfo.fillTableDate; pOfferPrice.FinaceView = pOfferPriceInfo.finaceView; pOfferPrice.SectionView = pOfferPriceInfo.sectionView; pOfferPrice.MangerView = pOfferPriceInfo.mangerView; pOfferPrice.IsApply = pOfferPriceInfo.isApply; pOfferPrice.IsApply1 = pOfferPriceInfo.isApply1; pOfferPrice.IsApply2 = pOfferPriceInfo.isApply2; pOfferPrice.IsOver1 = pOfferPriceInfo.isOver1; pOfferPrice.IsOver2 = pOfferPriceInfo.isOver2; pOfferPrice.ApplyTime = pOfferPriceInfo.applyTime; pOfferPrice.Apply1Time = pOfferPriceInfo.apply1Time; pOfferPrice.Apply2Time = pOfferPriceInfo.apply2Time; pOfferPrice.SendEmployeeId = pOfferPriceInfo.sendEmployeeId; pOfferPrice.Recv1EmployeeId = pOfferPriceInfo.recv1EmployeeId; pOfferPrice.Recv2EmployeeId = pOfferPriceInfo.recv2EmployeeId; pOfferPrice.SendEmployeeName = pOfferPriceInfo.sendEmployeeName; pOfferPrice.Recv1EmployeeName = pOfferPriceInfo.recv1EmployeeName; pOfferPrice.Recv2EmployeeName = pOfferPriceInfo.recv2EmployeeName; pOfferPrice.PreEmployeeId = pOfferPriceInfo.preEmployeeId; pOfferPrice.PreEmployeeName = pOfferPriceInfo.preEmployeeName; pOfferPrice.PreIsApply = pOfferPriceInfo.preIsApply; pOfferPrice.PreIsOver = pOfferPriceInfo.preIsOver; pOfferPrice.PreApplyTime = pOfferPriceInfo.preApplyTime; pOfferPrice.RecvEmployeeId = pOfferPriceInfo.recvEmployeeId; pOfferPrice.IsMain = pOfferPriceInfo.isMain; pOfferPrice.IsMain1 = pOfferPriceInfo.isMain1; pOfferPrice.IsMain2 = pOfferPriceInfo.isMain2; pOfferPrice.IsMain3 = pOfferPriceInfo.isMain3; pOfferPrice.IsNewCreate = pOfferPriceInfo.isNewCreate; pOfferPrice.IsApprove = pOfferPriceInfo.isApprove; pOfferPrice.ApproveTime = pOfferPriceInfo.approveTime; pOfferPrice.Today = pOfferPriceInfo.today; pOfferPrice.OfferPriceTypeId = pOfferPriceInfo.offerPriceTypeId; pOfferPrice.OfferFileId = pOfferPriceInfo.offerFileId; pOfferPrice.MoneySum = pOfferPriceInfo.moneySum; pOfferPrice.BigMoney = pOfferPriceInfo.bigMoney; pOfferPrice.ProductMoneySum = pOfferPriceInfo.productMoneySum; pOfferPrice.IsSignName = pOfferPriceInfo.isSignName; pOfferPrice.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pOfferPrice.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(OfferPriceInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { ResetCache(); } }
//数据持久化 internal static void SaveToDb(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice, bool pIsNew) { pOfferPrice.OfferPriceId = pOfferPriceInfo.offerPriceId; pOfferPrice.EmployeeId = pOfferPriceInfo.employeeId; pOfferPrice.MainProjectCreateId = pOfferPriceInfo.mainProjectCreateId; pOfferPrice.MainOfferPriceId = pOfferPriceInfo.mainOfferPriceId; pOfferPrice.ProjectDes = pOfferPriceInfo.projectDes; pOfferPrice.SheetNum = pOfferPriceInfo.sheetNum; pOfferPrice.FillTableDate = pOfferPriceInfo.fillTableDate; pOfferPrice.FinaceView = pOfferPriceInfo.finaceView; pOfferPrice.SectionView = pOfferPriceInfo.sectionView; pOfferPrice.MangerView = pOfferPriceInfo.mangerView; pOfferPrice.IsApply = pOfferPriceInfo.isApply; pOfferPrice.IsApply1 = pOfferPriceInfo.isApply1; pOfferPrice.IsApply2 = pOfferPriceInfo.isApply2; pOfferPrice.IsOver1 = pOfferPriceInfo.isOver1; pOfferPrice.IsOver2 = pOfferPriceInfo.isOver2; pOfferPrice.ApplyTime = pOfferPriceInfo.applyTime; pOfferPrice.Apply1Time = pOfferPriceInfo.apply1Time; pOfferPrice.Apply2Time = pOfferPriceInfo.apply2Time; pOfferPrice.SendEmployeeId = pOfferPriceInfo.sendEmployeeId; pOfferPrice.Recv1EmployeeId = pOfferPriceInfo.recv1EmployeeId; pOfferPrice.Recv2EmployeeId = pOfferPriceInfo.recv2EmployeeId; pOfferPrice.SendEmployeeName = pOfferPriceInfo.sendEmployeeName; pOfferPrice.Recv1EmployeeName = pOfferPriceInfo.recv1EmployeeName; pOfferPrice.Recv2EmployeeName = pOfferPriceInfo.recv2EmployeeName; pOfferPrice.PreEmployeeId = pOfferPriceInfo.preEmployeeId; pOfferPrice.PreEmployeeName = pOfferPriceInfo.preEmployeeName; pOfferPrice.PreIsApply = pOfferPriceInfo.preIsApply; pOfferPrice.PreIsOver = pOfferPriceInfo.preIsOver; pOfferPrice.PreApplyTime = pOfferPriceInfo.preApplyTime; pOfferPrice.RecvEmployeeId = pOfferPriceInfo.recvEmployeeId; pOfferPrice.IsMain = pOfferPriceInfo.isMain; pOfferPrice.IsMain1 = pOfferPriceInfo.isMain1; pOfferPrice.IsMain2 = pOfferPriceInfo.isMain2; pOfferPrice.IsMain3 = pOfferPriceInfo.isMain3; pOfferPrice.IsNewCreate = pOfferPriceInfo.isNewCreate; pOfferPrice.IsApprove = pOfferPriceInfo.isApprove; pOfferPrice.ApproveTime = pOfferPriceInfo.approveTime; pOfferPrice.Today = pOfferPriceInfo.today; pOfferPrice.OfferPriceTypeId = pOfferPriceInfo.offerPriceTypeId; pOfferPrice.OfferFileId = pOfferPriceInfo.offerFileId; pOfferPrice.MoneySum = pOfferPriceInfo.moneySum; pOfferPrice.BigMoney = pOfferPriceInfo.bigMoney; pOfferPrice.ProductMoneySum = pOfferPriceInfo.productMoneySum; pOfferPrice.IsSignName = pOfferPriceInfo.isSignName; pOfferPrice.IsNew = pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pOfferPrice.Save(UserName); } catch (Exception ex) { LogManager.getInstance().getLogger(typeof(OfferPriceInfo)).Error(ex); if (ex.Message.Contains("插入重复键")) //违反了唯一键 { throw new AppException("此对象已经存在"); //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { ResetCache(); } }