Ejemplo n.º 1
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);
     }
 }
        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);
            }
        }