Esempio n. 1
0
 private void btnInsertHD_Click(object sender, EventArgs e)
 {
     if (txtMaHD.Text == "" || txtMaNhanVien.Text == "" || txtMaKhachHang.Text == "")
     {
         if (txtMaHD.Text == "")
         {
             errorProvider1.SetError(txtMaHD, "Chưa có dữ liệu");
         }
         if (txtMaNhanVien.Text == "")
         {
             errorProvider1.SetError(txtMaNhanVien, "Chưa có dữ liệu");
         }
         if (txtMaKhachHang.Text == "")
         {
             errorProvider1.SetError(txtMaKhachHang, "Chưa có dữ liệu");
         }
         MessageBox.Show("Phải điền thông tin");
         return;
     }
     else
     {
         errorProvider1.Clear();
     }
     try
     {
         string   ma      = txtMaHD.Text;
         string   manv    = txtMaNhanVien.Text;
         DateTime ngaylap = (DateTime)Convert.ToDateTime(dtpNgayLap.Value.ToString("MM/dd/yyyy"));
         string   makh    = txtMaKhachHang.Text;
         if (MessageBox.Show("Bạn có muốn thêm hay không", "Thêm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             if (HoaDonController.Instance.InsertHoaDon(ma, ngaylap, manv, makh))
             {
                 ViewHoaDon();
                 ChiTiet_HD f = new ChiTiet_HD();
                 f.ShowDialog();
                 MessageBox.Show("Thêm thành công!");
             }
         }
         else
         {
             MessageBox.Show("Không thành công");
         }
     }
     catch
     {
         MessageBox.Show("Lỗi thêm dữ liệu");
         return;
     }
 }
Esempio n. 2
0
        private void btnChiTietHD_Click(object sender, EventArgs e)
        {
            ChiTiet_HD f = new ChiTiet_HD();

            f.ShowDialog();
        }