/// <summary> /// 保存里程碑 /// 2017/04/14(zhuguanjun) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveLCB_Click(object sender, EventArgs e) { #region 检查 if (string.IsNullOrEmpty(SubID)) { MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "分包合同"); return; } if (string.IsNullOrEmpty(txtLCBName.Text)) { MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "里程碑名称"); return; } #endregion SubContractLCB lcb = new SubContractLCB(); lcb.Condition = txtLCBCondition.Text; lcb.FinishDate = dtiLCBFinishDate.Value; ComboItem item = (ComboItem)cmbLCBFinishStatus.SelectedItem; if (item != null) { lcb.FinishStatus = int.Parse(item.Value.ToString()); } lcb.Name = txtLCBName.Text; lcb.Remark = txtLCBRemark.Text; lcb.SubID = SubID;//版本id; lcb.ID = LCBID; lcb.CREATED = LCBCREATED; JsonResult json = bll.SaveLCB(lcb); MessageHelper.ShowRstMsg(json.result); if (json.result) { btnClearLCB_Click(null, null); } BindLCB(); }
/// <summary> /// 更新付款信息和里程碑 /// Created:20170612(ChengMengjia) /// </summary> /// <param name="entity">日常工作实体</param> /// <param name="listWork">负责人列表</param> public void UpdateEntities(SubContractLCB newlcb, SubContractLCB oldlcb, SubContractSKXX newskxx, SubContractSKXX oldskxx) { ISession s = NHHelper.GetCurrentSession(); try { s.BeginTransaction(); if (newlcb != null) { s.Save(newlcb); } if (oldlcb != null) { s.Update(oldlcb); } if (newskxx != null) { s.Save(newskxx); } if (oldskxx != null) { s.Update(oldskxx); } UpdateProject(s);//更新项目时间 s.Transaction.Commit(); s.Close(); } catch (Exception ex) { s.Transaction.Rollback(); s.Close(); throw new Exception("插入实体失败", ex); } }
/// <summary> /// 保存里程碑 /// 2017/04/14(zhuguanjun) /// </summary> /// <param name="lcb"></param> /// <returns></returns> public JsonResult SaveLCB(SubContractLCB lcb) { JsonResult jsonreslut = new JsonResult(); try { jsonreslut.result = false; string _id; if (string.IsNullOrEmpty(lcb.ID)) { new Repository <SubContractLCB>().Insert(lcb, true, out _id); } else { new Repository <SubContractLCB>().Update(lcb, true, out _id); } jsonreslut.result = true; } catch (Exception ex) { LogHelper.WriteException(ex, LogType.BussinessDLL); jsonreslut.result = false; jsonreslut.msg = ex.Message; } return(jsonreslut); }