///<summary> ///添加: ///</summary> /// <param name="model">要添加的model</param> /// <returns>受影响的行数</returns> public Result <int> AddTzBidResult(Epm_TzBidResult model) { Result <int> result = new Result <int>(); try { int rows = 0; bool isAdd = false; var bidResult = DataOperateBusiness <Epm_TzBidResult> .Get().GetList(t => t.BidTd == model.BidTd && t.State != (int)PreProjectState.ApprovalFailure && t.State != (int)PreProjectState.Discarded).FirstOrDefault(); if (bidResult == null) { isAdd = true; bidResult = new Epm_TzBidResult(); SetCreateUser(bidResult); } bidResult.TenderingName = model.TenderingName; bidResult.ProjectId = model.ProjectId; bidResult.BidTd = model.BidTd; bidResult.ProjectName = model.ProjectName; bidResult.ApprovalNo = model.ApprovalNo; bidResult.UndertakeContacts = model.UndertakeContacts; bidResult.BidType = model.BidType; bidResult.BidName = model.BidName; bidResult.UndertakeTel = model.UndertakeTel; bidResult.BidderOne = model.BidderOne; bidResult.QuotationOne = model.QuotationOne; bidResult.RemarkOne = model.RemarkOne; bidResult.BidderTwo = model.BidderTwo; bidResult.QuotationTwo = model.QuotationTwo; bidResult.RemarkTwo = model.RemarkTwo; bidResult.BidderThree = model.BidderThree; bidResult.QuotationThree = model.QuotationThree; bidResult.RemarkThree = model.RemarkThree; bidResult.BidderFour = model.BidderFour; bidResult.QuotationFour = model.QuotationFour; bidResult.RemarkFour = model.RemarkFour; bidResult.RecommendUnit = model.RecommendUnit; bidResult.RecommendReason = model.RecommendReason; bidResult.Remark = model.Remark; bidResult.State = model.State; SetCurrentUser(bidResult); #region 招标结果协同接口 var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow"); if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1") { //招标申请实体信息 var tenderingApplyInfo = DataOperateBusiness <Epm_TzTenderingApply> .Get().GetModel(model.BidTd.Value); XtTzBidResultView view = new XtTzBidResultView(); view.ProjectName = tenderingApplyInfo.ProjectName; view.UndertakeDepartment = tenderingApplyInfo.UndertakeDepartment; view.UndertakeContacts = tenderingApplyInfo.UndertakeContacts; view.UndertakeTel = tenderingApplyInfo.UndertakeTel; view.Minutes = tenderingApplyInfo.Minutes; view.BidName = tenderingApplyInfo.BidName; view.CapitalBudget = tenderingApplyInfo.CapitalBudget; view.ProjectSummary = tenderingApplyInfo.ProjectSummary; view.InvitationNegotiate = tenderingApplyInfo.InvitationNegotiate; view.InvitationNegotiator = tenderingApplyInfo.InvitationNegotiator; view.BidderOne = model.BidderOne; view.QuotationOne = model.QuotationOne; view.RemarkOne = model.RemarkOne; view.BidderTwo = model.BidderTwo; view.QuotationTwo = model.QuotationTwo; view.RemarkTwo = model.RemarkTwo; view.BidderThree = model.BidderThree; view.QuotationThree = model.QuotationThree; view.RemarkThree = model.RemarkThree; view.RecommendUnit = model.RecommendUnit; view.RecommendReason = model.RecommendReason; var baseUser = DataOperateBasic <Base_User> .Get().GetModel(bidResult.CreateUserId); if (baseUser == null) { throw new Exception("未找到申请人相关信息!"); } view.hr_sqr = baseUser.ObjeId; bidResult.WorkFlowId = XtWorkFlowService.CreateTzBidResultWorkFlow(view); } #endregion if (isAdd) { rows = DataOperateBusiness <Epm_TzBidResult> .Get().Add(bidResult); } else { rows = DataOperateBusiness <Epm_TzBidResult> .Get().Update(bidResult); } result.Data = rows; result.Flag = EResultFlag.Success; } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "AddTzBidResult"); } return(result); }
///<summary> ///修改: ///</summary> /// <param name="model">要修改的model</param> /// <returns>受影响的行数</returns> public Result <int> UpdateTzBidResult(Epm_TzBidResult model) { Result <int> result = new Result <int>(); try { #region 招标结果协同接口 var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow"); if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1") { //招标申请实体信息 var tenderingApplyInfo = DataOperateBusiness <Epm_TzTenderingApply> .Get().GetModel(model.BidTd.Value); XtTzBidResultView view = new XtTzBidResultView(); view.ProjectName = tenderingApplyInfo.ProjectName; view.UndertakeDepartment = tenderingApplyInfo.UndertakeDepartment; view.UndertakeContacts = tenderingApplyInfo.UndertakeContacts; view.UndertakeTel = tenderingApplyInfo.UndertakeTel; view.Minutes = tenderingApplyInfo.Minutes; view.BidName = tenderingApplyInfo.BidName; view.CapitalBudget = tenderingApplyInfo.CapitalBudget; view.ProjectSummary = tenderingApplyInfo.ProjectSummary; view.InvitationNegotiate = tenderingApplyInfo.InvitationNegotiate; view.InvitationNegotiator = tenderingApplyInfo.InvitationNegotiator; view.BidderOne = model.BidderOne; view.QuotationOne = model.QuotationOne; view.RemarkOne = model.RemarkOne; view.BidderTwo = model.BidderTwo; view.QuotationTwo = model.QuotationTwo; view.RemarkTwo = model.RemarkTwo; view.BidderThree = model.BidderThree; view.QuotationThree = model.QuotationThree; view.RemarkThree = model.RemarkThree; view.RecommendUnit = model.RecommendUnit; view.RecommendReason = model.RecommendReason; var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.CreateUserId); if (baseUser == null) { throw new Exception("未找到申请人相关信息!"); } view.hr_sqr = baseUser.ObjeId; model.WorkFlowId = XtWorkFlowService.CreateTzBidResultWorkFlow(view); } #endregion var rows = DataOperateBusiness <Epm_TzBidResult> .Get().Update(model); result.Data = rows; result.Flag = EResultFlag.Success; //WriteLog(AdminModule.TzBidResult.GetText(), SystemRight.Modify.GetText(), "修改: " + model.Id); } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "UpdateTzBidResult"); } return(result); }