public ActionResult Add(Epm_TzFirstNegotiation model) { Result <int> result = new Result <int>(); string fileDataJson = Request.Form["fileDataJsonFile"];//获取上传文件json字符串 if (!string.IsNullOrEmpty(fileDataJson)) { model.TzAttachs = JsonConvert.DeserializeObject <List <Epm_TzAttachs> >(fileDataJson);//将文件信息json字符 } using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { result = proxy.AddTzFirstNegotiation(model); } return(Json(result.ToResultView())); }
///<summary> ///修改: ///</summary> /// <param name="model">要修改的model</param> /// <returns>受影响的行数</returns> public Result <int> UpdateTzFirstNegotiation(Epm_TzFirstNegotiation model) { Result <int> result = new Result <int>(); try { var rows = DataOperateBusiness <Epm_TzFirstNegotiation> .Get().Update(model); result.Data = rows; result.Flag = EResultFlag.Success; //WriteLog(AdminModule.TzFirstNegotiation.GetText(), SystemRight.Modify.GetText(), "修改: " + model.Id); } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "UpdateTzFirstNegotiation"); } return(result); }
///<summary> ///添加: ///</summary> /// <param name="model">要添加的model</param> /// <returns>受影响的行数</returns> public Result <int> AddTzFirstNegotiation(Epm_TzFirstNegotiation model) { Result <int> result = new Result <int>(); try { int rows = 0; bool isAdd = false; var first = DataOperateBusiness <Epm_TzFirstNegotiation> .Get().GetList(t => t.ProjectId == model.ProjectId && t.State != (int)PreProjectState.ApprovalFailure && t.State != (int)PreProjectState.Discarded).FirstOrDefault(); if (first == null) { isAdd = true; first = new Epm_TzFirstNegotiation(); SetCreateUser(first); } first.ProjectId = model.ProjectId; first.TalkTime = model.TalkTime; first.TalkAdress = model.TalkAdress; first.Fees = model.Fees; first.FeesTime = model.FeesTime; first.OurNegotiators = model.OurNegotiators; first.OtherNegotiators = model.OtherNegotiators; first.TalkResultType = model.TalkResultType; first.TalkResultName = model.TalkResultName; first.Remark = model.Remark; first.State = model.State; SetCurrentUser(first); #region 项目谈判调用协同接口 //var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow"); //if (model.State == (int)PreProjectState.Submitted && XtWorkFlow == "1") //{ // var project = DataOperateBusiness<Epm_TzProjectProposal>.Get().GetModel(model.ProjectId); // XtTzNegotiationView view = new XtTzNegotiationView(); // var baseUser = DataOperateBasic<Base_User>.Get().GetModel(model.CreateUserId); // if (baseUser == null) // { // throw new Exception("未找到申请人相关信息!"); // } // else // { // view.hr_sqr = baseUser.ObjeId; // } // view.ProjectName = project.ProjectName; // view.NatureName = project.NatureName; // view.ApplyTime = string.Format("{0:yyyy-MM-dd}", project.ApplyTime); // view.StationName = project.StationName; // view.Position = project.Position; // view.PredictMoney = project.PredictMoney.ToString(); // view.CompanyName = project.CompanyName; // view.TalkTime = string.Format("{0:yyyy-MM-dd}", model.TalkTime); // view.TalkAdress = model.TalkAdress; // view.Fees = model.Fees.ToString(); // view.FeesTime = string.Format("{0:yyyy-MM-dd}", model.FeesTime); // view.OurNegotiators = model.OurNegotiators; // view.OtherNegotiators = model.OtherNegotiators; // view.TalkResultName = model.TalkResultName; // //上传附件 // if (model.TzAttachs != null && model.TzAttachs.Any()) // { // string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl"); // foreach (var item in model.TzAttachs) // { // string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo); // view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs; // } // if (view.Temp_TzAttachs != null) // { // view.Temp_TzAttachs = view.Temp_TzAttachs.Substring(0, view.Temp_TzAttachs.Length - 1); // } // } // model.WorkFlowId = XtWorkFlowService.CreateTzFirstNegotiationWorkFlow(view); //} #endregion if (isAdd) { rows = DataOperateBusiness <Epm_TzFirstNegotiation> .Get().Add(first); } else { rows = DataOperateBusiness <Epm_TzFirstNegotiation> .Get().Update(first); } //上传附件 AddFilesBytzTable(first, model.TzAttachs); //若状态为已提交,生成下一阶段数据 if (model.State == (int)PreProjectState.Submitted) { //生成评审材料上报记录 Epm_TzFormTalkFile tzFormTalkFile = new Epm_TzFormTalkFile(); tzFormTalkFile.ProjectId = model.ProjectId; tzFormTalkFile.State = (int)PreProjectState.WaitSubmitted; // AddTzFormTalkFile(tzFormTalkFile); SetCreateUser(tzFormTalkFile); SetCurrentUser(tzFormTalkFile); DataOperateBusiness <Epm_TzFormTalkFile> .Get().Add(tzFormTalkFile); string houstAddress = System.Configuration.ConfigurationManager.AppSettings.Get("RPAPath"); var project = DataOperateBusiness <Epm_TzProjectProposal> .Get().Single(t => t.Id == model.ProjectId); //提交-生成回写数据 //特许经营项目性质的项目审批到项目批复完成就结束了,不生成工程模块的内容,不用写到机器人表里 if (project.Nature != "XMXZTXJY") { #region RPA_TzFirstNegotiation RPA_TzFirstNegotiation rpafirst = new RPA_TzFirstNegotiation(); rpafirst.TalkTime = model.TalkTime; rpafirst.TalkAdress = model.TalkAdress; rpafirst.Fees = model.Fees; rpafirst.FeesTime = model.FeesTime; rpafirst.OurNegotiators = model.OurNegotiators; rpafirst.OtherNegotiators = model.OtherNegotiators; rpafirst.TalkResultName = model.TalkResultName; rpafirst.Remark = model.Remark; rpafirst.WriteMark = 0; rpafirst.WriteResult = 0; rpafirst.FollowOperate = ""; rpafirst.username = "******"; rpafirst.companys = CurrentUser.CompanyName; rpafirst.ProjectName = project.ProjectName; var fileList = GetFilesByTZTable("Epm_TzFirstNegotiation", first.Id).Data; for (int i = 0; i < fileList.Count; i++) { rpafirst.FilePath += houstAddress + "?path=" + fileList[i].FilePath + "&fileName=" + fileList[i].Name + ","; } rpafirst.FileNumber = fileList.Count; rpafirst.status1 = 0; SetCreateUser(rpafirst); SetCurrentUser(rpafirst); DataOperateBusiness <RPA_TzFirstNegotiation> .Get().Add(rpafirst); #endregion #region OMADS_TzFirstNegotiation var oMADSModel = new OMADS_TzFirstNegotiation(); oMADSModel.TalkTime = model.TalkTime; oMADSModel.TalkAdress = model.TalkAdress; oMADSModel.Fees = model.Fees; oMADSModel.FeesTime = model.FeesTime; oMADSModel.OurNegotiators = model.OurNegotiators; oMADSModel.OtherNegotiators = model.OtherNegotiators; oMADSModel.TalkResultName = model.TalkResultName; oMADSModel.Remark = model.Remark; oMADSModel.WriteMark = 0; oMADSModel.WriteResult = 0; oMADSModel.FollowOperate = ""; oMADSModel.username = "******"; oMADSModel.companys = CurrentUser.CompanyName; oMADSModel.ProjectName = project.ProjectName; for (int i = 0; i < fileList.Count; i++) { oMADSModel.FilePath += houstAddress + "?path=" + fileList[i].FilePath + "&fileName=" + fileList[i].Name + ","; } oMADSModel.FileNumber = fileList.Count; SetCreateUser(oMADSModel); SetCurrentUser(oMADSModel); DataOperateBusiness <OMADS_TzFirstNegotiation> .Get().Add(oMADSModel); #endregion #region TEMP_TzFirstNegotiation var tEMPModel = new TEMP_TzFirstNegotiation(); tEMPModel.TalkTime = model.TalkTime; tEMPModel.TalkAdress = model.TalkAdress; tEMPModel.Fees = model.Fees; tEMPModel.FeesTime = model.FeesTime; tEMPModel.OurNegotiators = model.OurNegotiators; tEMPModel.OtherNegotiators = model.OtherNegotiators; tEMPModel.TalkResultName = model.TalkResultName; tEMPModel.Remark = model.Remark; tEMPModel.WriteMark = 0; tEMPModel.WriteResult = 0; tEMPModel.FollowOperate = ""; tEMPModel.username = "******"; tEMPModel.companys = CurrentUser.CompanyName; tEMPModel.ProjectName = project.ProjectName; for (int i = 0; i < fileList.Count; i++) { tEMPModel.FilePath += houstAddress + "?path=" + fileList[i].FilePath + "&fileName=" + fileList[i].Name + ","; } tEMPModel.FileNumber = fileList.Count; tEMPModel.status1 = 0; SetCreateUser(tEMPModel); SetCurrentUser(tEMPModel); DataOperateBusiness <TEMP_TzFirstNegotiation> .Get().Add(tEMPModel); #endregion } } result.Data = rows; result.Flag = EResultFlag.Success; //WriteLog(AdminModule.TzFirstNegotiation.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id); } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "AddTzFirstNegotiation"); } return(result); }
public TzFirstNegotiationView() { TzFirstNegotiation = new Epm_TzFirstNegotiation(); TzProjectProposal = new Epm_TzProjectProposal(); }