private void btnOK_Click(object sender, EventArgs e) { DataTable dtCTKK = ChiTietKiemKeService.LoadDataTable(); if (validateForm()) { int i; for (i = 0; i < dtCTKK.Rows.Count; i++) { if (lueHangHoa.EditValue.ToString().Equals(dtCTKK.Rows[i][0].ToString())) { XtraMessageBox.Show("Hàng hóa đã được kiểm kê"); return; } } ChiTietKiemKe ctkk = new ChiTietKiemKe(); ctkk.MaHangHoa = lueHangHoa.EditValue.ToString(); ctkk.MaPhieuKiemKe = MaPKK; ctkk.SLTonTrenQuay = Convert.ToInt32(txtSLTonTrenQuay.Text.ToString().Trim()); ctkk.SLTonTrongKho = Convert.ToInt32(txtSLTonTrongKho.Text.ToString().Trim()); if (ChiTietKiemKeService.Insert(ctkk)) { isDataChanged = true; XtraMessageBox.Show("Thêm thành công"); } else { XtraMessageBox.Show("Thêm thất bại"); } } }
private void btnLuu_Click(object sender, EventArgs e) { PhieuKiemKe pkk = new PhieuKiemKe(); pkk.MaNhanVien = "NV0001"; pkk.MaPhieuKiemKe = txtMaPhieu.Text.Trim(); pkk.NgayLap = deNgayLap.DateTime; if (PhieuKiemKeService.Insert(pkk)) { for (int i = 0; i < grvPhieuKiemKe.RowCount; i++) { ChiTietKiemKe ctkk = new ChiTietKiemKe(); ctkk.MaPhieuKiemKe = pkk.MaPhieuKiemKe; ctkk.MaHangHoa = grvPhieuKiemKe.GetRowCellValue(i, "MaHangHoa").ToString(); ctkk.SLTonTrenQuay = Convert.ToInt32(grvPhieuKiemKe.GetRowCellValue(i, "SLTonTrenQuay").ToString()); ctkk.SLTonTrongKho = Convert.ToInt32(grvPhieuKiemKe.GetRowCellValue(i, "SLTonTrongKho").ToString()); if (!ChiTietKiemKeService.Insert(ctkk)) { XtraMessageBox.Show("Lưu thất bại!"); if (i > 0) { if (!ChiTietKiemKeService.Delete(pkk.MaPhieuKiemKe)) { XtraMessageBox.Show("Roll back không thành công!"); return; } } if (PhieuKiemKeService.Delete(pkk.MaPhieuKiemKe)) { XtraMessageBox.Show("Roll back thành công!"); } else { XtraMessageBox.Show("Roll back không thành công!"); } return; } } XtraMessageBox.Show("Lưu thành công!"); isSaved = true; } else { XtraMessageBox.Show("Lưu thất bại!"); } }
public static bool Update(ChiTietKiemKe ctkk) { return(Controller.Update(ctkk)); }
public static bool Insert(ChiTietKiemKe ctkk) { return(Controller.Insert(ctkk)); }
public bool Update(ChiTietKiemKe ctkk) { return(_connect.Update("SP_CHITIETKIEMKE_UPD", ctkk)); }
public bool Insert(ChiTietKiemKe ctkk) { return(_connect.Update(ctkk)); }