Exemplo n.º 1
0
 private void LoadDanhSachGiangVien()
 {
     try
     {
         GiangVienFilter _filter = new GiangVienFilter();
         _filter.CoSoId = GlobalSettings.CoSoId;
         _filter.NgayBatDauLamViec_Tu  = date_TuNgay.DateTime;
         _filter.NgayBatDauLamViec_Den = date_DenNgay.DateTime;
         List <GiangVien_PlusDTO> _lstGiangVien = GiangVienLogic.Select(_filter);
         if (_lstGiangVien != null && _lstGiangVien.Count > 0)
         {
             for (int i = 0; i < _lstGiangVien.Count; i++)
             {
                 _lstGiangVien[i].Stt = i + 1;
             }
             gridControlDSGiangVien.DataSource = _lstGiangVien;
             lblTongCong.Text = string.Format("Tổng cộng: {0} giảng viên)", _lstGiangVien.Count);
         }
         else
         {
             gridControlDSGiangVien.DataSource = null;
             lblTongCong.Text = string.Format("Tổng cộng: {0} giảng viên)", 0);
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
Exemplo n.º 2
0
 private void gridViewDSGiangVien_Click(object sender, EventArgs e)
 {
     try
     {
         var rowHandle = gridViewDSGiangVien.FocusedRowHandle;
         this.giangvienId_Select = O2S_Common.TypeConvert.Parse.ToInt32(gridViewDSGiangVien.GetRowCellValue(rowHandle, "GiangVienId").ToString());
         GIANGVIEN hocVien = GiangVienLogic.SelectSigleTheoKhoaKhoa(this.giangvienId_Select);
         LoadPanelControl(hocVien);
         LockAndUnlockPanelControl(false);
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }
Exemplo n.º 3
0
 private void LoadGiangVien()
 {
     try
     {
         GiangVienFilter _filter = new GiangVienFilter();
         _filter.CoSoId = GlobalSettings.CoSoId;
         //_filter.IsRemove = 0;
         cboGiangVien.DataSource    = GiangVienLogic.Select(_filter);
         cboGiangVien.DisplayMember = "TenGiangVien";
         cboGiangVien.ValueMember   = "GiangVienId";
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
        private void LoadGiangVien()
        {
            try
            {
                List <XepLich_GiaoVienChinhDTO>    _dataGiaoVienChinh    = new List <XepLich_GiaoVienChinhDTO>();
                List <XepLich_GiaoVienTroGiangDTO> _dataGiaoVienTroGiang = new List <XepLich_GiaoVienTroGiangDTO>();

                GiangVienFilter _filter = new GiangVienFilter();
                _filter.CoSoId = GlobalSettings.CoSoId;
                List <GiangVien_PlusDTO> _dataGiangVien = GiangVienLogic.Select(_filter);
                if (_dataGiangVien != null && _dataGiangVien.Count > 0)
                {
                    foreach (var item in _dataGiangVien)
                    {
                        XepLich_GiaoVienChinhDTO _gvChinh = new XepLich_GiaoVienChinhDTO()
                        {
                            GiaoVien_ChinhId  = item.GiangVienId,
                            TenGiaoVien_Chinh = item.TenGiangVien,
                        };
                        _dataGiaoVienChinh.Add(_gvChinh);
                        //
                        XepLich_GiaoVienTroGiangDTO _gvTroGiang = new XepLich_GiaoVienTroGiangDTO()
                        {
                            GiaoVien_TroGiangId  = item.GiangVienId,
                            TenGiaoVien_TroGiang = item.TenGiangVien,
                        };
                        _dataGiaoVienTroGiang.Add(_gvTroGiang);
                    }
                }

                repositoryItemGrid_GVChinh.DataSource    = _dataGiaoVienChinh;
                repositoryItemGrid_GVChinh.DisplayMember = "TenGiaoVien_Chinh";
                repositoryItemGrid_GVChinh.ValueMember   = "GiaoVien_ChinhId";

                repositoryItemGrid_TroGiang.DataSource    = _dataGiaoVienTroGiang;
                repositoryItemGrid_TroGiang.DisplayMember = "TenGiaoVien_TroGiang";
                repositoryItemGrid_TroGiang.ValueMember   = "GiaoVien_TroGiangId";
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
Exemplo n.º 5
0
 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)
         {
             if (GiangVienLogic.Delete(this.giangvienId_Select))
             {
                 O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.XOA_THANH_CONG);
                 frmthongbao.Show();
                 LoadDanhSachGiangVien();
                 ResetPanelControl();
             }
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CO_LOI_XAY_RA);
         frmthongbao.Show();
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }
Exemplo n.º 6
0
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateLuu();

                if (isInsert)
                {
                    ValidateTrungTaiKhoan(txtTenDangNhap.Text);
                    if (GiangVienLogic.InsertAndTaiKhoan(LoadGiangVien(), LoadTaiKhoan()))
                    {
                        LoadDanhSachGiangVien();
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THANH_CONG);
                        frmthongbao.Show();
                        LockAndUnlockPanelControl(false);
                    }
                }
                else
                {
                    if (GiangVienLogic.Update(LoadGiangVien(), LoadTaiKhoan()))
                    {
                        LoadDanhSachGiangVien();
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG);
                        frmthongbao.Show();
                        LockAndUnlockPanelControl(false);
                    }
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CO_LOI_XAY_RA);
                frmthongbao.Show();
                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);
            }
        }