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 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(); } } }