private void btnLapPhieu_Click(object sender, EventArgs e) { if (!fMainForm.cNullTB(cboBienSo.Text) && !fMainForm.cNullTB(txtSoPhieuSuaChua.Text)) { string MaPhieuSuaChua = txtSoPhieuSuaChua.Text.Trim(); string BienSo = cboBienSo.SelectedValue.ToString(); DateTime NgaySuaChua = dtmNgaySuaChua.Value; Decimal _TongTien = int.Parse(txtTongTien.Text); if (!PhieuSuaChuaBUS.checkPK(MaPhieuSuaChua)) { PhieuSuaChuaDTO PhieuSuaChua = new PhieuSuaChuaDTO(MaPhieuSuaChua, BienSo, NgaySuaChua, _TongTien); PhieuSuaChuaBUS.addPhieuSuaChua(PhieuSuaChua); for (int i = 0; i < dgvPhieuSuaChua.Rows.Count - 1; i++) { string NoiDung = dgvPhieuSuaChua.Rows[i].Cells["NoiDung"].Value.ToString(); string MaVatTuPhuTung = dgvPhieuSuaChua.Rows[i].Cells["VatTuPhuTung"].Value.ToString(); int SoLuongSuaChua = int.Parse(dgvPhieuSuaChua.Rows[i].Cells["SoLuong"].Value.ToString()); int TienCong = int.Parse(dgvPhieuSuaChua.Rows[i].Cells["TienCong"].Value.ToString()); Decimal ThanhTien = int.Parse(dgvPhieuSuaChua.Rows[i].Cells["ThanhTien"].Value.ToString()); ChiTietPhieuSuaChuaDTO CTPhieuSuaChua = new ChiTietPhieuSuaChuaDTO(MaPhieuSuaChua, NoiDung, MaVatTuPhuTung, SoLuongSuaChua, TienCong, ThanhTien); ChiTietPhieuSuaChuaBUS.addChiTietPhieuSuaChua(CTPhieuSuaChua); VatTuPhuTungBUS.decreaseSoLuongVatTu(MaVatTuPhuTung, SoLuongSuaChua); } KhachSuaXeDAO.addTienNo(BienSo, _TongTien); dgvLichSuLapPhieu.DataSource = PhieuSuaChuaBUS.selectAllPhieuSuaChua(); #region Clear dgvTable reset = true; rownum = 1; this.dgvPhieuSuaChua.Rows.Clear(); TongTien = 0; txtTongTien.Text = TongTien.ToString(); reset = false; #endregion } else { MessageBox.Show("Dữ liệu vừa nhập vào không hợp lệ, do bị trùng khóa chính."); } } else { MessageBox.Show("Bạn chưa nhập vào đủ dữ liệu xin vui lòng nhập lại."); } }
private void btnLapPhieu_Click(object sender, EventArgs e) { if (!fMainForm.cNullTB(cboBienSo.Text) && !fMainForm.cNullTB(cboTenChuXe.Text) && !fMainForm.cNullTB(txtDienThoai.Text) && !fMainForm.cNullTB(txtEmail.Text) && !fMainForm.cNullTB(txtSoTienNo.Text) && !fMainForm.cNullTB(txtSoTienNo.Text) && !fMainForm.cNullTB(txtTienKhachTra.Text)) { string BienSo = cboBienSo.Text; DateTime NgayThuTien = dtmNgayThuTien.Value; int SoTienKhachTra = int.Parse(txtTienKhachTra.Text); int SoTienTraKhach; int SoTienNo = int.Parse(txtSoTienNo.Text); if (SoTienNo > SoTienKhachTra) { SoTienTraKhach = 0; SoTienNo -= SoTienKhachTra; KhachSuaXeDAO.addTienNo(BienSo, SoTienNo); } else { SoTienTraKhach = SoTienKhachTra - SoTienNo; KhachSuaXeDAO.payTienNo(BienSo, SoTienNo); } int SoTienThu = SoTienNo; PhieuThuTienDTO PhieuThu = new PhieuThuTienDTO("", BienSo, NgayThuTien, SoTienThu, SoTienKhachTra, SoTienTraKhach); PhieuThuTienBUS.addPhieuThuTien(PhieuThu); dgvLichSuPTT.DataSource = PhieuThuTienBUS.selectAllPhieuThuTien(); #region Reset value of form after insertion cboBienSo.SelectedIndex = -1; dtmNgayThuTien.Value = DateTime.Today; cboTenChuXe.SelectedIndex = -1; txtDienThoai.Clear(); txtEmail.Clear(); txtSoTienNo.Clear(); txtTienKhachTra.Clear(); txtTienTraKhach.Clear(); #endregion } else { MessageBox.Show("Bạn chưa nhập vào đủ dữ liệu xin vui lòng nhập lại."); } }
public static bool cPrimaryKey(string _cPrim) { return(KhachSuaXeDAO.CheckPrimary(_cPrim)); }
public static DataTable SearchAllCustomer(KhachSuaXeDTO kh, string SoTienNoCompareType) { return(KhachSuaXeDAO.SearchCustomer(kh, SoTienNoCompareType)); }
public static bool delCustomer(int _MaKhachSuaXe, string exception = "") { return(KhachSuaXeDAO.RemoveCustomer(_MaKhachSuaXe, exception)); }
public static void updateCustomer(KhachSuaXeDTO kh) { KhachSuaXeDAO.UpdateCustomer(kh); }
//public static void addCustomer(KhachSuaXeDTO kh) //{ // KhachSuaXeDAO.InsertCustomer(kh); //} public static bool InsertCustomer(KhachSuaXeDTO kh, string exception = "") { return(KhachSuaXeDAO.InsertCustomer(kh, exception)); }
public static DataTable loadAllCustomer() { return(KhachSuaXeDAO.getData()); }