private void LoadPhongHoc() { try { PhongHocFilter _filter = new PhongHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; _filter.IsRemove = 0; List <PHONGHOC> dataPhongHoc = PhongHocLogic.Select(_filter); repositoryItemGrid_PhongHoc.DataSource = dataPhongHoc; repositoryItemGrid_PhongHoc.DisplayMember = "TenPhongHoc"; repositoryItemGrid_PhongHoc.ValueMember = "PhongHocId"; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void btnXoa_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Bạn có muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var rowHandle = gridViewPhongHoc.FocusedRowHandle; int _caHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewPhongHoc.GetRowCellValue(rowHandle, "PhongHocId").ToString()); if (PhongHocLogic.Delete(_caHocId)) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.XOA_THANH_CONG); frmthongbao.Show(); LoadGridPhongHoc(); } } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }
private void LoadGridPhongHoc() { try { PhongHocFilter _filter = new PhongHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; List <PHONGHOC> _lstPhongHoc = PhongHocLogic.Select(_filter); if (_lstPhongHoc != null && _lstPhongHoc.Count > 0) { gridControlPhongHoc.DataSource = _lstPhongHoc; } else { gridControlPhongHoc.DataSource = null; } lblTongCong.Text = string.Format("Tổng cộng: {0} ca/tiết học", gridViewPhongHoc.RowCount); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void gridViewPhongHoc_Click(object sender, EventArgs e) { try { if (gridViewPhongHoc.RowCount > 0) { var rowHandle = gridViewPhongHoc.FocusedRowHandle; int _PhongHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewPhongHoc.GetRowCellValue(rowHandle, "PhongHocId").ToString()); this.PhongHocSelect = PhongHocLogic.SelectSingle(_PhongHocId); if (this.PhongHocSelect != null) { PhongHoc_ClickData(this.PhongHocSelect); LockAndUnLookPanelControl(false); } } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void btnLuuThongTin_Click(object sender, EventArgs e) { try { if (isInsert) { int _khoaHocId = 0; if (PhongHocLogic.Insert(LoadPhongHoc(), ref _khoaHocId)) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THANH_CONG); frmthongbao.Show(); } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THAT_BAI); frmthongbao.Show(); } } else { if (PhongHocLogic.Update(LoadPhongHoc())) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG); frmthongbao.Show(); } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI); frmthongbao.Show(); } } LoadGridPhongHoc(); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }
private void btnLuuLai_Click(object sender, EventArgs e) { try { if (this.LopHocId_Select != 0) { //Xoa di het roi insert lai if (XepLichHocLogic.DeleteTheoLopHoc(this.LopHocId_Select)) { List <XEPLICHHOC> _lstInsert = new List <XEPLICHHOC>(); foreach (var item in this.lstLichHoc) { var culture = new System.Globalization.CultureInfo("vi-VN"); var day_tiengViet = culture.DateTimeFormat.GetDayName(item.ThoiGianHoc.DayOfWeek); ValidateLuu(item); CAHOC _cahoc = CaHocLogic.SelectSingle(item.CaHocId ?? 0); PHONGHOC _phonghoc = PhongHocLogic.SelectSingle(item.PhongHocId ?? 0); GIANGVIEN _gv_chinh = GiangVienLogic.SelectSigleTheoKhoaKhoa(item.GiaoVien_ChinhId ?? 0); GIANGVIEN _gv_trogiang = GiangVienLogic.SelectSigleTheoKhoaKhoa(item.GiaoVien_TroGiangId ?? 0); XEPLICHHOC _xeplich = new XEPLICHHOC() { CoSoId = GlobalSettings.CoSoId, KhoaHocId = this.KhoaHocId_Select, LopHocId = this.LopHocId_Select, TenLopHoc = cboLopHoc.Text, ThoiGianHoc = item.ThoiGianHoc, ThoiGianHoc_Full = day_tiengViet + " - " + item.ThoiGianHoc.ToString("dd/MM/yyyy"), CaHocId = item.CaHocId, TenCaHocFull = _cahoc != null ? _cahoc.TenCaHocFull : "", PhongHocId = item.PhongHocId, TenPhongHoc = _phonghoc != null ? _phonghoc.TenPhongHoc : "", GiaoVien_ChinhId = item.GiaoVien_ChinhId, TenGiaoVien_Chinh = _gv_chinh != null ? _gv_chinh.TenGiangVien : "", TienGiaoVien_Chinh = item.TienGiaoVien_Chinh, GiaoVien_TroGiangId = item.GiaoVien_TroGiangId, TenGiaoVien_TroGiang = _gv_trogiang != null ? _gv_trogiang.TenGiangVien : "", TienGiaoVien_TroGiang = item.TienGiaoVien_TroGiang, GhiChu = item.GhiChu, IsLock = item.IsLock, }; _lstInsert.Add(_xeplich); } if (XepLichHocLogic.InsertMultiRow(_lstInsert)) { //Thread.Sleep(2500); O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG); frmthongbao.Show(); LoadLichHocCuaLopHoc(this.LopHocId_Select); } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI); frmthongbao.Show(); } } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI); frmthongbao.Show(); } } } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }