Esempio n. 1
0
 private void BtnLuu_Click(object sender, EventArgs e)
 {
     if (them == true)
     {
         if (dbKho.KiemTraMaKho(txtMaKho.Text) == 0)
         {
             if (dbKho.ThemKho(this.txtMaKho.Text, this.txtTenKho.Text, this.txtDiaChi.Text, this.txtMaCN.Text) == true)
             {
                 MessageBox.Show("Thêm Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 LoadData();
             }
             else
             {
                 MessageBox.Show("Không Thể Thêm", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
         }
         else
         {
             MessageBox.Show("Trùng Mã Kho", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         if (dbKho.CapNhatKho(this.txtMaKho.Text, this.txtTenKho.Text, this.txtDiaChi.Text, this.txtMaCN.Text) == true)
         {
             MessageBox.Show("Cập nhật Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             LoadData();
         }
         else
         {
             MessageBox.Show("Không Thể Cập Nhật", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
     }
 }