private void button7_Click(object sender, EventArgs e) { if (this.searchPatientBox1.patientSet == true) { writeTicketForPatient(); } else { Warnings.WarnMessages ChoPa = new Warnings.WarnMessages(); ChoPa.warnChoosePatient(); } }
/// <summary> // Запись диагноза пациента в базу /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void diagDataAddToBase() { if (this.searchPatientBox1.pIdN >= 0 && comboBoxDiagDescr.SelectedIndex >= 0) { if (checkPatDiag() == false) { string insCom; string txtCom; if (this.textBox1.Text.Trim().Length > 1) { insCom = ", comment"; txtCom = ", '" + this.textBox1.Text.Trim() + "'"; } else { insCom = ""; txtCom = ""; } NpgsqlCommand insPatDiag = new NpgsqlCommand("insert into diag_data (usr_id, pat_id, diag_date, diag, type, main_mark " + insCom + ") " + "values ('" + DBExchange.Inst.dbUsrId + "','" + this.searchPatientBox1.pIdN + "', '" + this.dateTimePicker1.Value.Date + "','" + _tabDiagEnv.diagNumList[comboBoxDiagDescr.SelectedIndex] + "'," + " '" + this.comboBox8.SelectedIndex + "', '" + checkBox1.Checked.ToString().ToLower() + "' " + txtCom + ");", DBExchange.Inst.connectDb); try { insPatDiag.ExecuteNonQuery(); System.Windows.Forms.MessageBox.Show("Диагноз добавлен", "Отлично!"); } catch (Exception exception) { Warnings.WarnLog log = new Warnings.WarnLog(); log.writeLog(MethodBase.GetCurrentMethod().Name, exception.Message.ToString(), exception.StackTrace.ToString()); } } else { System.Windows.Forms.MessageBox.Show("Диагноз для пациента уже существует.", "Ошибка!!! Такой диагноз установлен"); } } else { Warnings.WarnMessages ChoPa = new Warnings.WarnMessages(); ChoPa.warnChoosePatient(); } }