Пример #1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (txtTenKho.Text.Trim() == string.Empty)
     {
         MessageBox.Show("Nhập tên kho");
         txtTenKho.Focus();
         return;
     }
     else
     {
         KHOHANG k = new KHOHANG();
         k.MAKHO     = txtMaKho.Text.Trim();
         k.TENKHO    = txtTenKho.Text;
         k.DIACHIKHO = txtDiaChiKho.Text;
         k.MOTA      = txtMoTa.Text;
         if (kho.ThemKho(k))
         {
             dataGridViewKho.DataSource = kho.LoadKho();
             btnLuu.Enabled             = false;
             btnThem.PerformClick();
         }
         else
         {
             MessageBox.Show("Thêm Kho thất bại");
         }
     }
 }
Пример #2
0
 public static void ThemKho(CKho kho)
 {
     try
     {
         Kho dao = new Kho();
         dao.ThemKho(kho);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }