public ActionResult SubmitIEForm(ProposalEntity proposal, int keyValue) { try { var proposalEntity = proposalApp.GetForm(keyValue); if (Request.Files.Count > 0) { for (int i = 0; i < Request.Files.Count; i++) { var file = Request.Files["annex"]; if (!string.IsNullOrEmpty(file.FileName)) { var fileName = file.FileName; foreach (char invalidChar in Path.GetInvalidFileNameChars()) { fileName = fileName.Replace(invalidChar.ToString(), "_"); } fileName = fileName.Replace(" ", ""); var filePath = Path.Combine(HttpContext.Server.MapPath("/Uploads/Proposal/"), fileName); proposalEntity.annex = file.FileName; file.SaveAs(filePath); } } } proposalEntity.plan_che_date = proposal.plan_che_date; proposalEntity.reward = proposal.reward; proposalApp.SubmitForm(proposalEntity, keyValue); return(Success("操作成功")); } catch (Exception ex) { new ErrorLogApp().SubmitForm(ex); return(Error("操作失败")); } }
public ActionResult SubmitForm(ProposalEntity proposalEntity, int?keyValue) { try { if (keyValue == null) { proposalEntity.make_bill_man = OperatorProvider.Provider.GetCurrent().UserName; proposalEntity.make_bill_date = DateTime.Now; proposalApp.SubmitForm(proposalEntity); } else { var proposal = proposalApp.GetForm(keyValue.Value); proposal.pro_title = proposalEntity.pro_title; proposal.pro_id = proposalEntity.pro_id; proposal.pro_man = proposalEntity.pro_man; proposal.pro_date = proposalEntity.pro_date; proposal.pro_dep = proposalEntity.pro_dep; proposal.pro_send_dep = proposalEntity.pro_send_dep; proposal.is_pass = null; proposal.imp_man = null; proposal.plan_finish_date = null; proposal.reasons = null; proposalApp.SubmitForm(proposal, keyValue); } return(Success("操作成功")); } catch (Exception ex) { return(Success("操作失败")); } }
/// <summary> /// 批量更新(事务) /// </summary> /// <returns></returns> public bool Update() { bool result = false; if (ProposalEntity != null) { try { #region 从表单页面获取数据 ProposalEntity.GenerateObjectFromRequest(""); #endregion List <EntityBase> listUpdate = new List <EntityBase>(); listUpdate.Add(ProposalEntity); try { #region 获取初评列表 int index = 0; //循环所有的细项 for (int i = 0; i < 5; i++) { ProjectAssessmentEntity projectAssessmentEntity = new ProjectAssessmentEntity(); projectAssessmentEntity.GenerateObjectFromRequest("txt" + index); if (projectAssessmentEntity.ID > 0) { projectAssessmentEntity.IsGenerateObject = true; } else { projectAssessmentEntity.IsGenerateObject = false; projectAssessmentEntity.ProposalID = ProposalEntity.ProposalID; projectAssessmentEntity.ScoreDate = DateTime.Now; //请计算出得分 } index++; } #endregion } catch { } //开始事务更新,需要主表在最前面 result = ProposalEntity.db.CommitTran(listUpdate.ToArray()); //result = DesignDevelopTask.db.CommitTran(DesignDevelopTask, DesignDevelopTaskHead, DesignDevelopTaskApprove, DesignDevelopTaskCustomerInfo, DesignDevelopTaskProductList, DesignDevelopTaskReview, DesignDevelopTaskApproval); } catch { result = false; } } return(result); }
public ActionResult SubmitDisAgreeForm(ProposalEntity proposal, int keyValue) { try { var proposalEntity = proposalApp.GetForm(keyValue); proposalEntity.reasons = proposal.reasons; proposalEntity.is_pass = proposal.is_pass; proposalEntity.imp_man = proposal.imp_man; proposalEntity.plan_finish_date = proposal.plan_finish_date; proposalApp.SubmitForm(proposalEntity, keyValue); return(Success("操作成功")); } catch (Exception ex) { return(Success("操作失败")); } }
public void SubmitForm(ProposalEntity proposal, int?keyValue = null) { try { if (keyValue != null) { proposal.ID = keyValue.Value; service.Update(proposal); } else { service.Insert(proposal); } } catch (Exception ex) { throw; } }
public ActionResult SubmitEditForm(ProposalEntity proposalEntity, int?keyValue) { try { if (keyValue != null) { var proposal = proposalApp.GetForm(keyValue.Value); proposal.pro_send_dep = proposalEntity.pro_send_dep; proposal.is_pass = proposalEntity.is_pass; proposal.imp_man = proposalEntity.imp_man; proposal.plan_finish_date = proposalEntity.plan_finish_date; proposal.reasons = proposalEntity.reasons; proposalApp.SubmitForm(proposal, keyValue); } return(Success("操作成功")); } catch (Exception ex) { return(Success("操作失败")); } }
/// <summary> /// 提案业务类 /// </summary> /// <param name="intentionID">意向书流水码</param> public ProposalBLL(string billID) { if (!string.IsNullOrEmpty(billID)) { //读取主表 ProposalEntity = new ProposalEntity(); ProposalEntity.ResetForSearch(); ProposalEntity.ProposalID = billID; //新建的情况下,副表没外键,会导致无条件查询,所以一定要给一个不存在的值 if (string.IsNullOrEmpty(ProposalEntity.ProposalID)) { ProposalEntity.ProposalID = "-1"; } ProposalEntity.GetTable(true); //依次读取其他表的实体 if (ProposalEntity.IsGenerateObject == false) {//新建 } else { //读取初评 ProjectAssessmentEntity projectAssessmentEntity = new ProjectAssessmentEntity(); projectAssessmentEntity.ResetForSearch(); projectAssessmentEntity.ProposalID = billID; ProjectAssessmentEntityList = projectAssessmentEntity.ToList <ProjectAssessmentEntity>(); //读取复评 ReviewAccessmentEntity reviewAccessmentEntity = new ReviewAccessmentEntity(); reviewAccessmentEntity.ResetForSearch(); reviewAccessmentEntity.ProposalID = billID; ReviewAccessmentEntityList = reviewAccessmentEntity.ToList <ReviewAccessmentEntity>(); } } }