private void btnXoa_Click(object sender, System.EventArgs e) { DialogResult dg = BaseMessages.ShowQuestionMessage("Bạn có chắc chắn muốn xóa?"); if (dg == DialogResult.Yes) { try { clsPhieuXuat_ChiTiet cls0 = new clsPhieuXuat_ChiTiet(); cls0.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls0.DeleteWID_PhieuXuatLogic(); clsPhieuXuat_ChiTiet_TheKho cls1 = new clsPhieuXuat_ChiTiet_TheKho(); cls1.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls1.DeleteWID_PhieuXuatLogic(); clsQD_XuatVatTu cls = new clsQD_XuatVatTu(); cls.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls.Delete(); BaseMessages.ShowInformationMessage("Xóa thành công."); Loadfg(); } catch (Exception ex) { BaseMessages.ShowErrorMessage("Lỗi" + ex.ToString()); } } }
private void SavePhieuChiTiet_TheKho(int ID_PhieuXuat) { clsPhieuXuat_ChiTiet_TheKho cls = new clsPhieuXuat_ChiTiet_TheKho(); for (int i = fgChiTietTheKho.Rows.Fixed + 1; i < fgChiTietTheKho.Rows.Count; i++) { if (GlobalVariables.m_Flag == 0) { foreach (DataRow dr in m_dtTmp.Rows) { cls.ID_PhieuXuat = ID_PhieuXuat; cls.ID_VatTu = int.Parse(dr["ID_VatTu"].ToString()); cls.ID_TheKho = int.Parse(dr["ID_TheKho"].ToString()); cls.SoLuong = int.Parse(dr["SoLuong"].ToString()); cls.Insert(); } } else { LoadFgTheKho(); cls.ID_PhieuXuat = ID_PhieuXuat; cls.ID_VatTu = int.Parse(fgChiTietXuat[fgChiTietXuat.Row, "ID_VatTu"].ToString()); cls.ID_TheKho = int.Parse(fgChiTietTheKho[i, "ID_TheKho"].ToString()); cls.SoLuong = int.Parse(fgChiTietTheKho[i, "SoLuongXuat"].ToString()); cls.Update(); } } }
private void UpdateSoLuongDataTableTmp(DataRow dr) { if (GlobalVariables.m_Flag == 0) { for (int i = 0; i < m_dtTmp.Rows.Count; i++) { for (int j = i + 1; j < m_dtTmp.Rows.Count; j++) { if (int.Parse(m_dtTmp.Rows[i]["ID_TheKho"].ToString().Trim()) == int.Parse(m_dtTmp.Rows[j]["ID_TheKho"].ToString().Trim())) { m_dtTmp.Rows.Remove(dr); m_dtTmp.Rows[i]["SoLuong"] = fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"]; } } } } else { clsPhieuXuat_ChiTiet_TheKho cls = new clsPhieuXuat_ChiTiet_TheKho(); cls.ID_PhieuXuat = m_iID_PX; cls.ID_VatTu = int.Parse(fgChiTietXuat[fgChiTietXuat.Row, "ID_VatTu"].ToString()); cls.ID_TheKho = int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "ID_TheKho"].ToString()); cls.SoLuong = int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"].ToString()); cls.Update(); } }
private void DeleteVatTuWTIndex0(int ID_PhieuXuat) { clsPhieuXuat_ChiTiet_TheKho clss = new clsPhieuXuat_ChiTiet_TheKho(); clss.ID_PhieuXuat = ID_PhieuXuat; clss.ID_VatTu = int.Parse(fgChiTietXuat[fgChiTietXuat.Row, "ID_VatTu"].ToString()); for (int j = fgChiTietTheKho.Rows.Fixed + 1; j < fgChiTietTheKho.Rows.Count; j++) { if (int.Parse(fgChiTietTheKho[j, "SoLuongXuat"].ToString()) == 0) { clss.ID_TheKho = int.Parse(fgChiTietTheKho[j, "ID_TheKho"].ToString()); clss.Delete(); } } }