/// <summary> /// Save /// </summary> void Save() { int varId = 0; if (this.btnOK.Tag != null) { varId = Convert.ToInt32(this.btnOK.Tag.ToString()); } EntityCpExecPlanVar varVo = new EntityCpExecPlanVar(); varVo.varid = varId; varVo.execid = Convert.ToDecimal(this.ExecPlanDataSource["execid"]); varVo.registerid = patVo.m_strRegisterID; varVo.vardate = Convert.ToDateTime(this.dtpVar.Text); if (this.chkEva1.Checked) { varVo.vartype = 1; } else if (this.chkEva2.Checked) { varVo.vartype = 2; } else if (this.chkEva3.Checked) { varVo.vartype = 3; } varVo.doctid = patVo.m_strDOCTORID_CHR; varVo.operid = this.LoginInfo.m_strEmpID; varVo.operdate = DateTime.Now; varVo.status = 1; varVo.varcontent = this.txtResult.Text.Trim(); if (varVo.vartype == 0) { MessageBox.Show("请选择变异类型。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.chkEva1.Focus(); return; } if (varVo.varcontent == string.Empty) { MessageBox.Show("请输入变异原因。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtResult.Focus(); return; } if (varVo.vartype == 2) { if (this.txtPathName.Tag == null) { MessageBox.Show("请选择新路径。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtPathName.Focus(); return; } else { DataRow dr = this.txtPathName.Tag as DataRow; varVo.newcpid = Convert.ToDecimal(dr["cpid"].ToString()); } } List <EntityCpExecPlanVarDetail> lstVo = new List <EntityCpExecPlanVarDetail>(); if (this.clstTarget.CheckedItems.Count > 0) { EntityCpExecPlanVarDetail vo = null; for (int i = 0; i < this.clstTarget.CheckedItems.Count; i++) { vo = new EntityCpExecPlanVarDetail(); vo.varcontent = this.clstTarget.CheckedItems[i].ToString(); lstVo.Add(vo); } } bool isNew = varId <= 0 ? true : false; clsBIHOrderService svc = new clsDcl_GetSvcObject().m_GetOrderSvcObject(); if (svc.SaveCpExecvariation(ref varId, varVo, lstVo) > 0) { this.btnOK.Tag = varId.ToString(); if (isNew) { GetHistory(svc.GetCpExecVarList(varVo.execid)); } if ((varVo.vartype == 2 || varVo.vartype == 3) && this.IsStopCp == false) { this.IsStopCp = true; } MessageBox.Show("保存变异成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("保存变异失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }