private void ValidateLuu(XepLichHoc_PlusDTO _xeplich) { if (_xeplich.ThoiGianHoc == null) { throw new ArgumentException("Thời gian học không được trống"); } if (_xeplich.CaHocId == null || _xeplich.CaHocId == 0) { throw new ArgumentException("Ca/tiết học không được trống"); } if (_xeplich.GiaoVien_ChinhId == null || _xeplich.GiaoVien_ChinhId == 0) { throw new ArgumentException("Giảng viên dạy chính không được trống"); } }
private void repositoryItemButton_Xoa_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { if (gridViewLichHoc.RowCount > 1) { var rowHandle = gridViewLichHoc.FocusedRowHandle; int _stt = O2S_Common.TypeConvert.Parse.ToInt32(gridViewLichHoc.GetRowCellValue(rowHandle, "Stt").ToString()); XepLichHoc_PlusDTO _delete = this.lstLichHoc.Where(o => o.Stt == _stt).FirstOrDefault(); this.lstLichHoc.Remove(_delete); gridControlLichHoc.DataSource = null; gridControlLichHoc.DataSource = this.lstLichHoc; } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void repositoryItemButton_them_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { XepLichHoc_PlusDTO _lichhoc = new XepLichHoc_PlusDTO() { Stt = this.lstLichHoc.Count + 1, CoSoId = GlobalSettings.CoSoId, LopHocId = this.LopHocId_Select, TenLopHoc = cboLopHoc.Text, }; this.lstLichHoc.Add(_lichhoc); gridControlLichHoc.DataSource = null; gridControlLichHoc.DataSource = this.lstLichHoc; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
// private void LoadLichHocCuaLopHoc(int _lophocId) { try { //Kiem tra xem co lich hoc chua //-Neu co hien thi len //--neu chua insert 1 dong new XepLichHocFilter _filter = new XepLichHocFilter(); _filter.LopHocId = _lophocId; this.lstLichHoc = XepLichHocLogic.Select(_filter); if (this.lstLichHoc != null && this.lstLichHoc.Count > 0) { for (int i = 0; i < this.lstLichHoc.Count; i++) { this.lstLichHoc[i].Stt = i + 1; } } else { XepLichHoc_PlusDTO _lichhoc = new XepLichHoc_PlusDTO() { Stt = 1, CoSoId = GlobalSettings.CoSoId, LopHocId = _lophocId, TenLopHoc = cboLopHoc.Text, }; this.lstLichHoc = new List <XepLichHoc_PlusDTO>(); this.lstLichHoc.Add(_lichhoc); } gridControlLichHoc.DataSource = this.lstLichHoc; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }