private void Save_Click(object sender, RoutedEventArgs e) { string chkTyp = ""; string dt = dpDate.SelectedDate.Value.ToShortDateString(); string addSQL = ""; string sql = ""; CheckResult2 chkRT = null; dt += " " + tpTime.Text + ":00"; if (true == rdoBody.IsChecked) { addSQL = SQL.ADD_PNTBODYCHK; chkTyp = CT_BODYCHK; } else { addSQL = SQL.ADD_PNTLISCHK; chkTyp = CT_LISCHK; } foreach (object item in lvResult.Items) { chkRT = (CheckResult2)item; if (string.IsNullOrWhiteSpace(chkRT.ResultID)) { sql += string.Format(addSQL, chkRT.ItemCode, chkRT.ItemName, chkRT.Value, chkRT.Unit, dt); } } if (string.IsNullOrWhiteSpace(sql)) { BLPublic.Dialogs.Info("保存成功"); return; } sql = string.Format(SQL.ADD_PNTCHK_1, chkTyp) + string.Format(SQL.ADD_CHK_RCD, this.patientCode, chkTyp, "手工录入", AppConst.LoginEmpCode, dt) + sql; if (AppConst.db.ExecSQL(sql)) { BLPublic.Dialogs.Info("保存成功"); listCheckResult(); } else { BLPublic.Dialogs.Error("添加失败:" + AppConst.db.Error); } }
private void DelRt_Click(object sender, RoutedEventArgs e) { if (null == lvResult.SelectedItem) { BLPublic.Dialogs.Alert("请选择要删除的检查结果."); lvResult.Focus(); return; } CheckResult2 item = (CheckResult2)lvResult.SelectedItem; if (BLPublic.Dialogs.Yes != BLPublic.Dialogs.Ask2("是否确定删除所选记录?")) { return; } string sql = ""; if (true == rdoBody.IsChecked) { sql = SQL.DEL_BODYCHK; } else { sql = SQL.DEL_LISCHK; } if (AppConst.db.ExecSQL(string.Format(sql, item.CheckRecordNo, item.ResultID))) { BLPublic.Dialogs.Info("删除成功"); lvResult.Items.RemoveAt(lvResult.SelectedIndex); } else { BLPublic.Dialogs.Error("删除失败:" + AppConst.db.Error); } }