private void btnCapNhat_Click(object sender, EventArgs e) { // Nếu MonKy có dữ liệu thì insert hoặc Update, nếu không có thì xóa hết. if (dtMonKy != null) { try { if (dtMonKy.Rows.Count > 0) { string MonHocNotIn = ""; foreach (DataRow dr in dtMonKy.Rows) { pXL_MonHocTrongKyInfo = new XL_MonHocTrongKyInfo(); pXL_MonHocTrongKyInfo.IDDM_Lop = IDDM_Lop; pXL_MonHocTrongKyInfo.IDKQHT_CTDT_ChiTiet = int.Parse(dr["IDKQHT_CTDT_ChiTiet"].ToString()); pXL_MonHocTrongKyInfo.IDDM_NamHoc = Program.IDNamHoc; pXL_MonHocTrongKyInfo.HocKy = Program.HocKy; pXL_MonHocTrongKyInfo.IDDM_HinhThucThi = int.Parse(dr["IDDM_HinhThucThi"].ToString()); pXL_MonHocTrongKyInfo.SoHocTrinh = float.Parse("0" + dr["SoHocTrinh"]); pXL_MonHocTrongKyInfo.LyThuyet = int.Parse("0" + dr["LyThuyet"]); pXL_MonHocTrongKyInfo.ThucHanh = int.Parse("0" + dr["ThucHanh"]); pXL_MonHocTrongKyInfo.SoTiet = pXL_MonHocTrongKyInfo.LyThuyet + pXL_MonHocTrongKyInfo.ThucHanh; pXL_MonHocTrongKyInfo.ChoPhepXepLich = bool.Parse(dr["ChoPhepXepLich"].ToString()); pXL_MonHocTrongKyInfo.TinhDiemToanKhoa = bool.Parse(dr["TinhDiemToanKhoa"].ToString()); pXL_MonHocTrongKyInfo.HocOLopTachGop = false; MonHocNotIn += pXL_MonHocTrongKyInfo.IDKQHT_CTDT_ChiTiet.ToString() + ","; if (int.Parse(dr["XL_MonHocTrongKyID"].ToString()) > 0) { pXL_MonHocTrongKyInfo.XL_MonHocTrongKyID = int.Parse(dr["XL_MonHocTrongKyID"].ToString()); oBXL_MonHocTrongKy.Update(pXL_MonHocTrongKyInfo); } else { dr["XL_MonHocTrongKyID"] = oBXL_MonHocTrongKy.Add(pXL_MonHocTrongKyInfo); } } MonHocNotIn = MonHocNotIn.Substring(0, MonHocNotIn.Length - 1); oBXL_MonHocTrongKy.DeleteMonHocNotIn(IDDM_Lop, Program.IDNamHoc, Program.HocKy, MonHocNotIn); } else { oBXL_MonHocTrongKy.DeleteByHocKyNamHoc(IDDM_Lop, Program.IDNamHoc, Program.HocKy); } // ghi log GhiLog("Cập nhật thay đổi môn học trong kỳ của lớp '" + pDM_LopInfo.TenLop + "'", "Cập nhật", this.Tag.ToString()); LoadMonKy(IDDM_Lop); cmbKyKhung_SelectedValueChanged(null, null); if (e != null) { ThongBao("Thay đổi thành công."); } } catch { ThongBaoLoi("Có thể một số môn học của lớp này đã phân công giáo viên."); } } }
public List <XL_MonHocTrongKyInfo> GetList(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { List <XL_MonHocTrongKyInfo> oXL_MonHocTrongKyInfoList = new List <XL_MonHocTrongKyInfo>(); DataTable dtb = Get(pXL_MonHocTrongKyInfo); if (dtb != null) { for (int i = 0; i < dtb.Rows.Count; i++) { oXL_MonHocTrongKyInfo = new XL_MonHocTrongKyInfo(); oXL_MonHocTrongKyInfo.XL_MonHocTrongKyID = int.Parse(dtb.Rows[i]["XL_MonHocTrongKyID"].ToString()); oXL_MonHocTrongKyInfo.IDKQHT_CTDT_ChiTiet = int.Parse(dtb.Rows[i]["IDKQHT_CTDT_ChiTiet"].ToString()); oXL_MonHocTrongKyInfo.IDDM_Lop = int.Parse(dtb.Rows[i]["IDDM_Lop"].ToString()); oXL_MonHocTrongKyInfo.HocKy = int.Parse(dtb.Rows[i]["HocKy"].ToString()); oXL_MonHocTrongKyInfo.IDDM_NamHoc = int.Parse(dtb.Rows[i]["IDDM_NamHoc"].ToString()); oXL_MonHocTrongKyInfo.SoTiet = int.Parse(dtb.Rows[i]["SoTiet"].ToString()); oXL_MonHocTrongKyInfo.LyThuyet = int.Parse(dtb.Rows[i]["LyThuyet"].ToString()); oXL_MonHocTrongKyInfo.ThucHanh = int.Parse(dtb.Rows[i]["ThucHanh"].ToString()); oXL_MonHocTrongKyInfo.LoaiTietKhac1 = int.Parse(dtb.Rows[i]["LoaiTietKhac1"].ToString()); oXL_MonHocTrongKyInfo.LoaiTietKhac2 = int.Parse(dtb.Rows[i]["LoaiTietKhac2"].ToString()); oXL_MonHocTrongKyInfo.SoHocTrinh = double.Parse(dtb.Rows[i]["SoHocTrinh"].ToString()); oXL_MonHocTrongKyInfo.ChoPhepXepLich = bool.Parse(dtb.Rows[i]["ChoPhepXepLich"].ToString()); oXL_MonHocTrongKyInfo.IDDM_HinhThucThi = int.Parse(dtb.Rows[i]["IDDM_HinhThucThi"].ToString()); oXL_MonHocTrongKyInfo.SapXep = int.Parse(dtb.Rows[i]["SapXep"].ToString()); oXL_MonHocTrongKyInfoList.Add(oXL_MonHocTrongKyInfo); } } return(oXL_MonHocTrongKyInfoList); }
public DataTable Get(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { using (var client = new UnimOsServiceClient()) { return(ConvertList.ToDataTable <sp_XL_MonHocTrongKy_GetResult>(client.cDXL_MonHocTrongKy_Get(GlobalVar.MaXacThuc, pXL_MonHocTrongKyInfo))); } }
public void Delete(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { ArrayList colParam = new ArrayList(); colParam.Add(CreateParam("@XL_MonHocTrongKyID", SqlDbType.Int, pXL_MonHocTrongKyInfo.XL_MonHocTrongKyID)); RunProcedure("sp_XL_MonHocTrongKy_Delete", colParam); }
public DataTable Get(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { ArrayList colParam = new ArrayList(); colParam.Add(CreateParam("@XL_MonHocTrongKyID", SqlDbType.Int, pXL_MonHocTrongKyInfo.XL_MonHocTrongKyID)); return(RunProcedureGet("sp_XL_MonHocTrongKy_Get", colParam)); }
public int Add(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { int ID = 0; ID = oDXL_MonHocTrongKy.Add(pXL_MonHocTrongKyInfo); mErrorMessage = oDXL_MonHocTrongKy.ErrorMessages; mErrorNumber = oDXL_MonHocTrongKy.ErrorNumber; return(ID); }
public void Delete(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { var client = new UnimOsServiceClient(); client.cDXL_MonHocTrongKy_Delete(GlobalVar.MaXacThuc, pXL_MonHocTrongKyInfo); client.Close(); mErrorMessage = oDXL_MonHocTrongKy.ErrorMessages; mErrorNumber = oDXL_MonHocTrongKy.ErrorNumber; }
public int Add(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { int ID = 0; var client = new UnimOsServiceClient(); ID = client.cDXL_MonHocTrongKy_Add(GlobalVar.MaXacThuc, pXL_MonHocTrongKyInfo); client.Close(); mErrorMessage = oDXL_MonHocTrongKy.ErrorMessages; mErrorNumber = oDXL_MonHocTrongKy.ErrorNumber; return(ID); }
public void ToDataRow(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo, ref DataRow dr) { dr[pXL_MonHocTrongKyInfo.strXL_MonHocTrongKyID] = pXL_MonHocTrongKyInfo.XL_MonHocTrongKyID; dr[pXL_MonHocTrongKyInfo.strIDKQHT_CTDT_ChiTiet] = pXL_MonHocTrongKyInfo.IDKQHT_CTDT_ChiTiet; dr[pXL_MonHocTrongKyInfo.strIDDM_Lop] = pXL_MonHocTrongKyInfo.IDDM_Lop; dr[pXL_MonHocTrongKyInfo.strHocKy] = pXL_MonHocTrongKyInfo.HocKy; dr[pXL_MonHocTrongKyInfo.strIDDM_NamHoc] = pXL_MonHocTrongKyInfo.IDDM_NamHoc; dr[pXL_MonHocTrongKyInfo.strSoTiet] = pXL_MonHocTrongKyInfo.SoTiet; dr[pXL_MonHocTrongKyInfo.strLyThuyet] = pXL_MonHocTrongKyInfo.LyThuyet; dr[pXL_MonHocTrongKyInfo.strThucHanh] = pXL_MonHocTrongKyInfo.ThucHanh; dr[pXL_MonHocTrongKyInfo.strLoaiTietKhac1] = pXL_MonHocTrongKyInfo.LoaiTietKhac1; dr[pXL_MonHocTrongKyInfo.strLoaiTietKhac2] = pXL_MonHocTrongKyInfo.LoaiTietKhac2; dr[pXL_MonHocTrongKyInfo.strSoHocTrinh] = pXL_MonHocTrongKyInfo.SoHocTrinh; dr[pXL_MonHocTrongKyInfo.strChoPhepXepLich] = pXL_MonHocTrongKyInfo.ChoPhepXepLich; dr[pXL_MonHocTrongKyInfo.strIDDM_HinhThucThi] = pXL_MonHocTrongKyInfo.IDDM_HinhThucThi; dr[pXL_MonHocTrongKyInfo.strSapXep] = pXL_MonHocTrongKyInfo.SapXep; dr[pXL_MonHocTrongKyInfo.strTinhDiemToanKhoa] = pXL_MonHocTrongKyInfo.TinhDiemToanKhoa; }
public void Update(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { ArrayList colParam = new ArrayList(); colParam.Add(CreateParam("@IDKQHT_CTDT_ChiTiet", SqlDbType.BigInt, pXL_MonHocTrongKyInfo.IDKQHT_CTDT_ChiTiet)); colParam.Add(CreateParam("@IDDM_Lop", SqlDbType.Int, pXL_MonHocTrongKyInfo.IDDM_Lop)); colParam.Add(CreateParam("@HocKy", SqlDbType.Int, pXL_MonHocTrongKyInfo.HocKy)); colParam.Add(CreateParam("@IDDM_NamHoc", SqlDbType.Int, pXL_MonHocTrongKyInfo.IDDM_NamHoc)); colParam.Add(CreateParam("@SoTiet", SqlDbType.Int, pXL_MonHocTrongKyInfo.SoTiet)); colParam.Add(CreateParam("@LyThuyet", SqlDbType.Int, pXL_MonHocTrongKyInfo.LyThuyet)); colParam.Add(CreateParam("@ThucHanh", SqlDbType.Int, pXL_MonHocTrongKyInfo.ThucHanh)); colParam.Add(CreateParam("@LoaiTietKhac1", SqlDbType.Int, pXL_MonHocTrongKyInfo.LoaiTietKhac1)); colParam.Add(CreateParam("@LoaiTietKhac2", SqlDbType.Int, pXL_MonHocTrongKyInfo.LoaiTietKhac2)); colParam.Add(CreateParam("@SoHocTrinh", SqlDbType.Real, pXL_MonHocTrongKyInfo.SoHocTrinh)); colParam.Add(CreateParam("@ChoPhepXepLich", SqlDbType.Bit, pXL_MonHocTrongKyInfo.ChoPhepXepLich)); colParam.Add(CreateParam("@IDDM_HinhThucThi", SqlDbType.Int, pXL_MonHocTrongKyInfo.IDDM_HinhThucThi)); colParam.Add(CreateParam("@HocOLopTachGop", SqlDbType.Bit, pXL_MonHocTrongKyInfo.HocOLopTachGop)); colParam.Add(CreateParam("@SapXep", SqlDbType.Int, pXL_MonHocTrongKyInfo.SapXep)); colParam.Add(CreateParam("@TinhDiemToanKhoa", SqlDbType.Bit, pXL_MonHocTrongKyInfo.TinhDiemToanKhoa)); colParam.Add(CreateParam("@XL_MonHocTrongKyID", SqlDbType.Int, pXL_MonHocTrongKyInfo.XL_MonHocTrongKyID)); RunProcedure("sp_XL_MonHocTrongKy_Update", colParam); }
public DataTable Get(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { return(oDXL_MonHocTrongKy.Get(pXL_MonHocTrongKyInfo)); }
public void Delete(XL_MonHocTrongKyInfo pXL_MonHocTrongKyInfo) { oDXL_MonHocTrongKy.Delete(pXL_MonHocTrongKyInfo); mErrorMessage = oDXL_MonHocTrongKy.ErrorMessages; mErrorNumber = oDXL_MonHocTrongKy.ErrorNumber; }