Esempio n. 1
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         int    r       = tablePhieuSuaChua.CurrentRow.Index;
         string msc     = tablePhieuSuaChua.Rows[r].Cells[0].Value.ToString();
         string noidung = tablePhieuSuaChua.Rows[r].Cells[2].Value.ToString();
         string mavt    = tablePhieuSuaChua.Rows[r].Cells[1].Value.ToString();
         CT_PhieuSuaChuaBUS.CT_PhieuSuaChua_Delete(msc, noidung, mavt);
         MessageBox.Show("Xóa thành công!", "Xóa", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtDonGia.Text     = "";
         txtSoLuong.Text    = "";
         txtThanhTien.Text  = "";
         txtTienCong.Text   = "";
         cbVTPT.Text        = "";
         cbNoiDung.Text     = "";
         lbcSoLuongTon.Text = "";
         txtSoLuong.Text    = "";
         txtMaPhieu.Text    = "";
         LoadDSxeTheoBienSo(cbBienSo.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     btnXoa.Enabled = false;
     btnIn.Enabled  = false;
 }
Esempio n. 2
0
 private void LoadDSxeTheoBienSo(string BienSo)
 {
     try
     {
         tablePhieuSuaChua.DataSource = CT_PhieuSuaChuaBUS.CT_PhieuSuaChua_GetByBienSo(BienSo);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Esempio n. 3
0
        private void btnLapPhieu_Click(object sender, EventArgs e)
        {
            try
            {
                if (KiemTraSoLuongTon())
                {
                    if (KTMaSuaChua(txtMaPhieu.Text))

                    {
                        if (KTNhapXuat())
                        {
                            PhieuSuaChua    psc    = new PhieuSuaChua();
                            CT_PhieuSuaChua ct_psc = new CT_PhieuSuaChua();

                            psc.MaPhieuSuaChua = txtMaPhieu.Text;
                            psc.NgaySuaChua    = dtpNgaySuaChua.Text;
                            psc.BienSo         = cbBienSo.Text;
                            psc.TongTien       = double.Parse(txtThanhTien.Text);
                            PhieuSuaChuaBUS.PhieuSuaChua_Insert(psc);

                            ct_psc.MaPhieuSuaChua = txtMaPhieu.Text;
                            ct_psc.MaVatTuPhuTung = cbVTPT.Text;
                            ct_psc.NoiDungSuaChua = cbNoiDung.Text;
                            ct_psc.SoLuong        = int.Parse(txtSoLuong.Text);
                            ct_psc.DonGia         = double.Parse(txtDonGia.Text);
                            ct_psc.TienCong       = double.Parse(txtTienCong.Text);
                            ct_psc.ThanhTien      = TinhTien();
                            CT_PhieuSuaChuaBUS.CT_PhieuSuaChua_Insert(ct_psc);
                            LoadDSxeTheoBienSo(cbBienSo.Text);
                            lbcSoLuongTon.Text = VatTuPhuTungBUS.VatTuPhuTung_GetSoLuongTon(cbVTPT.Text).ToString();
                            MessageBox.Show("Lập phiếu thành công!");
                            DoanhSo_Insert();
                        }
                    }

                    else
                    {
                        MessageBox.Show("Mã sửa chữa đã có");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SQLDataProvider.connection.Close();
            }

            btnIn.Enabled  = false;
            btnXoa.Enabled = false;
        }
Esempio n. 4
0
        private bool KTnoidungsuachua(string msc, string noidung)
        {
            bool kt = false;

            if (CT_PhieuSuaChuaBUS.CT_PhieuSuaChua_KiemTra(msc, noidung).Rows.Count == 0)
            {
                kt = true;
                SQLDataProvider.connection.Close();
            }
            else
            {
                kt = false;
            }
            return(kt);
        }