private void simpleButton5_Click(object sender, EventArgs e) { try { DangKySIMDAL dal = new DangKySIMDAL(); if (txtmakh.Text == "" && cbngaydk.Checked == false && chidk.Text == "") { MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (dal.testnumber(chidk.Text) == 0) { MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MaKH == "") { string a = ""; if (tttt.Checked == true) { a = "True"; } else { a = "False"; } dal.SuaHDDK(txtidhd.Text, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a); MessageBox.Show("Sửa hóa đơn " + txtidhd.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Clear(); } else { if (dal.textexistmakh(Convert.ToInt32(MaKH)) == IDKH_SUA) { string a = ""; if (tttt.Checked == true) { a = "True"; } else { a = "False"; } dal.SuaHDDK(txtidhd.Text, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a); MessageBox.Show("Sửa hóa đơn " + txtidhd.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Clear(); } else { MessageBox.Show("Không được sửa khách hàng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { MessageBox.Show("Đã có lỗi xảy ra!"); } }
private void simpleButton4_Click(object sender, EventArgs e) { try { DangKySIMDAL dal = new DangKySIMDAL(); if (MaKH == "" && cbngaydk.Checked == false && chidk.Text == "" && tttt.Checked == false) { var res = dal.TimHDDK("", "False", "", "", "False"); hoaDonDangKiesBindingSource1.DataSource = res; MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); ClearHD(); } else if (chidk.Text != "" && dal.testnumber(chidk.Text) == 0) { MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string a = ""; string b = ""; if (tttt.Checked == true) { a = "True"; } else { a = "False"; } if (cbngaydk.Checked == true) { b = "True"; } else { b = "False"; } var res = dal.TimHDDK(MaKH, b, ngaydk.Text, chidk.Text, a); hoaDonDangKiesBindingSource1.DataSource = res; MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); ClearHD(); } } catch (Exception ex) { MessageBox.Show("Đã có lỗi xảy ra!"); } }
private void simpleButton1_Click(object sender, EventArgs e) { try { DangKySIMDAL dal = new DangKySIMDAL(); if (txtmakh.Text == "" || cbngaydk.Checked == false || chidk.Text == "") { MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (dal.testnumber(chidk.Text) == 0) { MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (MaKH == "") { MessageBox.Show("Vui lòng chọn khách hàng muốn đăng ký", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string a = ""; if (tttt.Checked == true) { a = "True"; } else { a = "False"; } dal.ThemHDDK(MaKH, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a); MessageBox.Show("Thêm hóa đơn thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Clear(); } } catch (Exception ex) { MessageBox.Show("Đã có lỗi xảy ra!"); } }