private void Del_Click(object sender, RoutedEventArgs e) { if (null == lvMonitor.SelectedItem) { BLPublic.Dialogs.Alert("选择要删除的审方记录."); lvMonitor.Focus(); return; } if (BLPublic.Dialogs.Yes != BLPublic.Dialogs.Ask2("是否确定删除所选审方记录?")) { return; } MonitorModel mnt = (MonitorModel)lvMonitor.SelectedItem; if (!AppConst.db.ExecSQL(string.Format(SQL.DEL_TPNMNT, mnt.MonitorID))) { BLPublic.Dialogs.Error("删除审方记录失败:" + AppConst.db.Error); return; } lvMonitor.Items.Remove(mnt); if (this.selMntID == mnt.MonitorID) { clearInput(); } BLPublic.Dialogs.Info("删除成功"); }
private void Mod_Click(object sender, RoutedEventArgs e) { if (null == lvMonitor.SelectedItem) { BLPublic.Dialogs.Alert("选择要修改的审方记录."); lvMonitor.Focus(); return; } MonitorModel mnt = (MonitorModel)lvMonitor.SelectedItem; this.selMntID = mnt.MonitorID; lvCondition.Items.Clear(); foreach (ConditionModel c in this.lstMntCdt) { if (this.selMntID == c.MonitorID) { lvCondition.Items.Add(c); } } addNullCondition(); cbbChkTyp.Text = mnt.ResultType; txtResultDesc.Text = mnt.ResultDesc; cbbRef.Text = mnt.RefName; if (rdo5Degress.Content.ToString().Equals(mnt.Degress)) { rdo5Degress.IsChecked = true; } else { rdo3Degress.IsChecked = true; } }
private void Save_Click(object sender, RoutedEventArgs e) { if (0 == lvCondition.Items.Count) { BLPublic.Dialogs.Alert("请输入审方条件."); lvCondition.Focus(); return; } /* * foreach (ConditionModel c in lvCondition.Items) * { * if (!string.IsNullOrWhiteSpace(c.ItemCode) && string.IsNullOrWhiteSpace(c.Condition)) * { * BLPublic.Dialogs.Alert("请输入" + c.ItemName + "审方条件."); * lvCondition.Focus(); * return; * } * }*/ if (string.IsNullOrWhiteSpace(cbbChkTyp.Text)) { BLPublic.Dialogs.Alert("请选择或输入审方项目."); cbbChkTyp.Focus(); return; } string rtDesc = txtResultDesc.Text.Trim(); if (string.IsNullOrWhiteSpace(rtDesc) || "结果描述".Equals(rtDesc)) { BLPublic.Dialogs.Alert("请输入结果描述."); txtResultDesc.Focus(); return; } if (string.IsNullOrWhiteSpace(cbbRef.Text)) { BLPublic.Dialogs.Alert("请选择或输入参考文献."); cbbRef.Focus(); return; } MonitorModel edtMnt = null; if (0 < this.selMntID) //修改记录 { if (!AppConst.db.ExecSQL(string.Format(SQL.MOD_TPNMNT, cbbChkTyp.Text.Trim(), (true == rdo3Degress.IsChecked ? 3 : 5), rtDesc, cbbRef.Text.Trim(), this.selMntID))) { BLPublic.Dialogs.Error("修改审方记录失败:" + AppConst.db.Error); return; } foreach (MonitorModel m in lvMonitor.Items) { if (this.selMntID == m.MonitorID) { edtMnt = m; m.ResultType = cbbChkTyp.Text.Trim(); m.ResultDesc = rtDesc; m.RefName = cbbRef.Text.Trim(); m.Degress = true == rdo3Degress.IsChecked ? rdo3Degress.Content.ToString() : rdo5Degress.Content.ToString(); } } } else //增加记录 if (!AppConst.db.InsertAndGetId(string.Format(SQL.ADD_TPNMNT, cbbChkTyp.Text.Trim(), (true == rdo3Degress.IsChecked ? 3 : 5), rtDesc, cbbRef.Text.Trim(), AppConst.LoginEmpCode), out this.selMntID)) { BLPublic.Dialogs.Error("增加审方记录失败:" + AppConst.db.Error); return; } else { edtMnt = new MonitorModel { MonitorID = this.selMntID, Condition = "", ResultType = cbbChkTyp.Text.Trim(), ResultDesc = rtDesc, RefName = cbbRef.Text.Trim(), Degress = true == rdo3Degress.IsChecked ? rdo3Degress.Content.ToString() : rdo5Degress.Content.ToString(), SetTime = DateTime.Now.ToLongDateString(), Setter = AppConst.LoginEmpCode }; lvMonitor.Items.Add(edtMnt); } string sql = string.Format(SQL.DEL_TPNMNT_CDT, this.selMntID.ToString()); foreach (ConditionModel c in lvCondition.Items) { if (!string.IsNullOrWhiteSpace(c.ItemCode)) { sql += ";"; if ("tpn".Equals(c.ItemType)) { sql += string.Format(SQL.ADD_TPNMNT_TPN, this.selMntID, c.ItemCode, c.Condition, BLPublic.Utils.bool2Bit(c.IsIn)); } else if ("icd".Equals(c.ItemType)) { sql += string.Format(SQL.ADD_TPNMNT_DIG, this.selMntID, c.ItemCode, c.ItemName, BLPublic.Utils.bool2Bit(c.IsIn)); } else if ("drug".Equals(c.ItemType) || "class".Equals(c.ItemType)) { sql += string.Format(SQL.ADD_TPNMNT_DRUG, this.selMntID, c.ItemCode, BLPublic.Utils.bool2Bit("class".Equals(c.ItemType)), c.ConditionCode, BLPublic.Utils.bool2Bit("class".Equals(c.ConditionType)), BLPublic.Utils.bool2Bit(c.IsIn)); } } } if (!AppConst.db.ExecSQL(sql)) { BLPublic.Dialogs.Error("修改审方条件失败:" + AppConst.db.Error); return; } foreach (ConditionModel c in lvCondition.Items) { if (!string.IsNullOrWhiteSpace(c.ItemCode)) { if (0 == c.MonitorID) { c.MonitorID = this.selMntID; this.lstMntCdt.Add(c); } } } edtMnt.Condition = getMonitorCdt(this.selMntID); lvMonitor.Items.Refresh(); BLPublic.Dialogs.Info("保存成功"); if (0 > cbbChkTyp.SelectedIndex) { cbbChkTyp.Items.Add(cbbChkTyp.Text); } if (0 > cbbRef.SelectedIndex) { cbbRef.Items.Add(cbbRef.Text); } clearInput(); }