public static bool FormValidate(Form f) { foreach (Control item in f.Controls) { if (item is TextBox && ((item as TextBox).Text == "" && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString()))) { MyMSB.Show(item.Tag.ToString(), "0", false); return(false); } if (item is DateTimePicker && ((DateTime.Now.Date.ToString() == ((item as DateTimePicker).Value.Date.ToString())) && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString()))) { MyMSB.Show(item.Tag.ToString(), "0", false); return(false); } if (item is ComboBox && ((item as ComboBox).Text == "" && item.Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString()))) { MyMSB.Show(item.Tag.ToString(), "0", false); return(false); } if (item is NumericUpDown && ((item as NumericUpDown).Value == 0 && (item as NumericUpDown).Enabled == true && !string.IsNullOrEmpty(item.Tag.ToString()))) { MyMSB.Show(item.Tag.ToString(), "0", false); return(false); } } return(true); }
private void btn_Patient_Search_Click(object sender, EventArgs e) { try { if (cboSearchChoice.SelectedIndex == 0) { this.fun_getAllPatientTableAdapter.FillByPatTel(dentist_DS.fun_getAllPatient, txtSearch.Text); } else if (cboSearchChoice.SelectedIndex == 1) { this.fun_getAllPatientTableAdapter.FillByPatName(dentist_DS.fun_getAllPatient, txtSearch.Text); } else if (cboSearchChoice.SelectedIndex == 2) { this.fun_getAllPatientTableAdapter.FillByPatId(dentist_DS.fun_getAllPatient, int.Parse(txtSearch.Text)); } else if (cboSearchChoice.SelectedIndex == 3) { this.fun_getAllPatientTableAdapter.FillByPatLatinName(dentist_DS.fun_getAllPatient, txtSearch.Text); } if (dataGridView1.Rows.Count == 0) { MyMSB.Show("មិនមានពត៌មានទេ សូមពិនិត្យមើលទិន្នន័យដែលបានបញ្ចូលម្តងទៀត", "0", false); return; } } catch (Exception) { MyMSB.Show("សូមពិនិត្យមើលពត៌មានដែលបានបញ្ចូលឡើងវិញ", "0", false); return; } }
private void btnAdd_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvMd.Rows) { if (row.Cells["md_id"].Value.ToString() == cboMd.SelectedValue.ToString()) { MyMSB.Show("ប្រវតិ្តវេជ្ជសាស្រ្តបានបញ្ចូលរួចហើយ", "0", false); return; } } dgvMd.Rows.Add(txtId.Text, cboMd.SelectedValue, GlobalMethod.getCboData(cboMd, "md_name"), txtDes.Text, "active"); }
private void btn_Reg_Pat_Save_Click(object sender, EventArgs e) { try { byte[] imgByte = null; if (!GlobalMethod.FormValidate(this)) { return; } if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true)) { return; } if (imgLoc != null) { imgByte = GlobalMethod.GetImageByte(imgLoc); } StoreProcedure.spd_update_patientByID( int.Parse(txtId.Text), txtKhFname.Text, txtKhLname.Text, txtFname.Text, txtLname.Text, txtGender.Text, nudDob.Value.ToString(), txtJob.Text, txtAddress.Text, imgByte, dtpAppoint.Value.ToString("yyyy-MM-dd"), txtNati.Text, txtTel.Text, string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString()) ); if (dgvMd.Rows.Count > 0) { StoreProcedure.spd_insert_patient_md(dgvMd); } GlobalVariable._Patient_id = txtId.Text; if (MyMSB.Show("ការកែរប្រែបានជោគជ័យ", "1", false)) { btn_Reg_Pat_Cancel.PerformClick(); } ; } catch (Exception t) { GlobalMethod.HandleException("frm_Patient_Detail_Edit / btn_Reg_Pat_Save_Click : " + t.Message); } }
private void btnAdd_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvMd.Rows) { if (row.Cells["md_id"].Value.ToString() == cboMd.SelectedValue.ToString()) { MyMSB.Show("ប្រវតិ្តវេជ្ជសាស្រ្តបានបញ្ចូលរួចហើយ", "0", false); return; } } dgvMd.Rows.Add(txtId.Text, cboMd.SelectedValue, GlobalMethod.getCboData(cboMd, "md_name"), txtDes.Text, "Active"); if (dgvMd.Rows.Count > 0) { StoreProcedure.spd_insert_patient_md(dgvMd); } GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive"); }
private void btn_Reg_Pat_Save_Click(object sender, EventArgs e) { if (!GlobalMethod.FormValidate(this) || IsPassValidated()) { return; } if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true)) { return; } byte[] imgBinary = GlobalMethod.GetImageByte(imgLoc); StoreProcedure.spd_insert_patient( txtKhFname.Text, txtKhLname.Text, txtFname.Text, txtLname.Text, cboGender.Text, nudDob.Value.ToString(), txtJob.Text, txtAddress.Text, imgBinary, dtpAppoint.Value.ToString("yyyy-MM-dd"), txtNati.Text, txtTel.Text, string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString()) ); if (dgvMd.Rows.Count > 0) { StoreProcedure.spd_insert_patient_md(dgvMd); } GlobalVariable._Patient_id = txtId.Text; MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", true); this.Close(); Thread th = new Thread(openPatient); th.SetApartmentState(ApartmentState.STA); th.Start(); }