private void buttonThemKhachHang_Click(object sender, EventArgs e)
        {
            int a;

            try
            {
                if ((a = kh.Insert(LayThongTinKhach(), "@MaKH")) > 0)
                {
                    MessageBox.Show("Thêm thành công");
                    txtIDkh.Text = a.ToString();
                }
                else
                {
                    MessageBox.Show("Thêm thất bại");
                }
            }
            catch (Exception)
            {
                if (txtIDkh.Text.Length > 0)
                {
                    MessageBox.Show("Đã thêm khách hàng trước đó");
                }
                else
                {
                    MessageBox.Show("Thêm thất bại");
                }
            }
        }
예제 #2
0
 private void buttonTaoPhieuMoi_Click(object sender, EventArgs e)
 {
     if (maskedTextBoxMaPhieuNhap.Text.Length > 0)
     {
         MessageBox.Show("Đã tạo phiếu nhập");
     }
     else
     {
         int a;
         if ((a = nh.Insert(LayDuLieuPhieuNhap(), "@MaPhieuNhap")) > 0)
         {
             MessageBox.Show("Thêm thành công");
             maskedTextBoxMaPhieuNhap.Text = a.ToString();
         }
         else
         {
             MessageBox.Show("Thêm không thành công");
         }
     }
 }
        private void buttonTaoHoaDonMoi_Click(object sender, EventArgs e)
        {
            int a;

            try
            {
                if ((a = hd.Insert(LayThongTinHoaDon(), "@SoHoaDon")) > 0)
                {
                    this.maskedTextBoxMaHD.Text = a.ToString();
                    MessageBox.Show("Thêm thành công");
                }
                else
                {
                    MessageBox.Show("Thêm thất bại");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Thêm thất bại");
            }
        }
예제 #4
0
 private void buttonThemLoai_Click(object sender, EventArgs e)
 {
     foreach (var item in loai.SelectAll())
     {
         if (item.TenLoai == comboBoxTenLoai.Text)
         {
             MessageBox.Show("Đã tồn tại");
             return;
         }
     }
     if (comboBoxTenLoai.Text.Length > 0)
     {
         Loai p = new Loai(0, comboBoxTenLoai.Text);
         int  a = loai.Insert(p, "@MaLoai");
         comboBoxTenLoai.SelectedValue = a;
     }
     else
     {
         MessageBox.Show("Tên loại trống");
     }
 }