private void cboKhoaHoc_SelectedValueChanged(object sender, EventArgs e) { try { KHOAHOC _khoahoc = KhoaHocLogic.SelectSingle(O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString())); if (_khoahoc != null) { numHocPhi.Text = O2S_Common.Number.Convert.NumberToString((_khoahoc.HocPhi ?? 0), 0); numSoTietHoc.Text = O2S_Common.Number.Convert.NumberToString((_khoahoc.SoTietHoc ?? 0), 0); numSoBuoiHVDangKy.Text = O2S_Common.Number.Convert.NumberToString((_khoahoc.SoTietHoc ?? 0), 0); // decimal _sotiethoc = O2S_Common.TypeConvert.Parse.ToDecimal(numSoTietHoc.Text); if (_sotiethoc != 0) { decimal _thanhtien = O2S_Common.TypeConvert.Parse.ToDecimal(numHocPhi.Text) * (O2S_Common.TypeConvert.Parse.ToDecimal(numSoBuoiHVDangKy.Text) / _sotiethoc); lblThanhTienKhoaHoc.Text = O2S_Common.Number.Convert.NumberToString(_thanhtien, 0); } else { lblThanhTienKhoaHoc.Text = "0"; } } //numDaDong.Maximum = O2S_Common.TypeConvert.Parse.ToDecimal(numHocPhi.Text); numTongTien.Text = O2S_Common.Number.Convert.NumberToString(TinhTongTien(), 0); numConNo.Text = O2S_Common.Number.Convert.NumberToString((O2S_Common.TypeConvert.Parse.ToDecimal(numTongTien.Text) - O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", ""))), 0); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void btnXoa_Click(object sender, EventArgs e) { try { var rowHandle = gridViewKhoaHoc.FocusedRowHandle; int _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewKhoaHoc.GetRowCellValue(rowHandle, "KhoaHocId").ToString()); ValidateXoaKhoaHoc(_KhoaHocId); if (MessageBox.Show("Bạn có muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (KhoaHocLogic.Delete(_KhoaHocId)) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.XOA_THANH_CONG); frmthongbao.Show(); LoadGridKhoaHoc(); } } } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }
private void btnInAn_Click(object sender, EventArgs e) { try { SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait)); string tungay = DateTime.ParseExact(date_TuNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy"); string denngay = DateTime.ParseExact(date_DenNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy"); string tungaydenngay = "( Từ " + tungay + " - " + denngay + " )"; List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>(); reportExcelDTO reportitem = new reportExcelDTO(); reportitem.name = Base.bienTrongBaoCao.THOIGIANBAOCAO; reportitem.value = tungaydenngay; thongTinThem.Add(reportitem); //khoa hoc, lop hoc int _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString()); KHOAHOC _khoahoc = KhoaHocLogic.SelectSingle(_KhoaHocId); int _lophocId = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString()); LOPHOC _lophoc = LopHocLogic.SelectSingle(_lophocId); reportExcelDTO _item_makhoahoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.MAKHOAHOC, value = _khoahoc.MaKhoaHoc, }; thongTinThem.Add(_item_makhoahoc); reportExcelDTO _item_tenkhoahoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.TENKHOAHOC, value = _khoahoc.TenKhoaHoc, }; thongTinThem.Add(_item_tenkhoahoc); // reportExcelDTO _item_malophoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.MALOPHOC, value = _lophoc.MaLopHoc, }; thongTinThem.Add(_item_malophoc); reportExcelDTO _item_tenlophoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.TENLOPHOC, value = _lophoc.TenLopHoc, }; thongTinThem.Add(_item_tenlophoc); string fileTemplatePath = "BC03_ThongKeTheoDoiDiem.xlsx"; DataTable _databaocao = O2S_Common.DataTables.Convert.ListToDataTable(this.lstBangDiem); Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _databaocao); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } SplashScreenManager.CloseForm(); }
private void btnInAn_DSLop_Click(object sender, EventArgs e) { try { SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait)); if (cboLopHoc.SelectedValue != null) { List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>(); //khoa hoc, lop hoc int _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString()); KHOAHOC _khoahoc = KhoaHocLogic.SelectSingle(_KhoaHocId); int _lophocId = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString()); LOPHOC _lophoc = LopHocLogic.SelectSingle(_lophocId); reportExcelDTO _item_makhoahoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.MAKHOAHOC, value = _khoahoc.MaKhoaHoc, }; thongTinThem.Add(_item_makhoahoc); reportExcelDTO _item_tenkhoahoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.TENKHOAHOC, value = _khoahoc.TenKhoaHoc, }; thongTinThem.Add(_item_tenkhoahoc); // reportExcelDTO _item_malophoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.MALOPHOC, value = _lophoc.MaLopHoc, }; thongTinThem.Add(_item_malophoc); reportExcelDTO _item_tenlophoc = new reportExcelDTO() { name = Base.bienTrongBaoCao.TENLOPHOC, value = _lophoc.TenLopHoc, }; thongTinThem.Add(_item_tenlophoc); List <XepLopDTO> _lstXepLop = BangDiemLogic.SelectDSHV_Lop(_lophocId); string fileTemplatePath = "FUN_XepLop_DanhSachLopHoc.xlsx"; DataTable _databaocao = O2S_Common.DataTables.Convert.ListToDataTable(_lstXepLop); Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _databaocao); } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } SplashScreenManager.CloseForm(); }
private void LoadKhoaHoc() { try { KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; cboKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "KhoaHocId"; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void frmCacLopDaHoc_Load(object sender, EventArgs e) { dateTuNgay.MaxDate = dateDenNgay.MaxDate = DateTime.Now; KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; cboKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "KhoaHocId"; gridLop.AutoGenerateColumns = false; btnDatLai_Click(sender, e); btnXemTatCa_Click(sender, e); }
public void LoadGridKhoaHoc() { try { KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; _filter.CreatedDate_Tu = date_TuNgay.DateTime; _filter.CreatedDate_Den = date_DenNgay.DateTime; gridControlKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); lblTongCong.Text = string.Format("Tổng cộng: {0} khóa học", gridViewKhoaHoc.RowCount); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void frmHocPhiHocVien_Load(object sender, EventArgs e) { dateTuNgay.MaxDate = dateDenNgay.MaxDate = DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture); btnDatLai_Click(sender, e); gridLop.AutoGenerateColumns = false; KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; cboKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "MaKhoaHoc"; btnXemTatCa_Click(sender, e); }
private void frmXemCacLopDay_Load(object sender, EventArgs e) { dateTuNgay.MaxDate = dateDenNgay.MaxDate = DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture); //load khóa học KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; cboKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "KhoaHocId"; gridKetQuaTimKiem.AutoGenerateColumns = false; btnTimKiem_Click(sender, e); }
private void gridViewKhoaHoc_Click(object sender, EventArgs e) { try { if (gridViewKhoaHoc.RowCount > 0) { var rowHandle = gridViewKhoaHoc.FocusedRowHandle; int _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewKhoaHoc.GetRowCellValue(rowHandle, "KhoaHocId").ToString()); this.khoaHocSelect = KhoaHocLogic.SelectSingle(_KhoaHocId); if (this.khoaHocSelect != null) { KhoaHoc_ClickData(this.khoaHocSelect); LockPanelControl(false); } } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void LoadKhoaHoc() { try { KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; _filter.IsRemove = 0; List <KhoaHoc_PlusDTO> _lstKhoaHoc = KhoaHocLogic.Select(_filter); cboKhoaHoc.DataSource = _lstKhoaHoc; cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "KhoaHocId"; if (_lstKhoaHoc != null && _lstKhoaHoc.Count > 0) { cboKhoaHoc.SelectedIndex = 0; LoadLopCuaKhoaHoc(); } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void frmLapPhieuGhiDanh_Option1_Load(object sender, EventArgs e) { try { date_TuNgay.DateTime = Convert.ToDateTime(DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd") + " 00:00:00"); date_DenNgay.DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"); KhoaHocFilter _filter = new KhoaHocFilter(); _filter.CoSoId = GlobalSettings.CoSoId; cboKhoaHoc.DataSource = KhoaHocLogic.Select(_filter); cboKhoaHoc.DisplayMember = "TenKhoaHoc"; cboKhoaHoc.ValueMember = "KhoaHocId"; LoadPhieuGhiDanh(); LoadKhoanKhacMacDinh(); LoadDanhSachHocVien(); LoadQuyDinh_LapPhieuGD(); btnLuuPhieu.Enabled = false; btnInBienLai.Enabled = 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 (KhoaHocLogic.Insert(LoadKhoaHoc(), ref _khoaHocId)) {//Insert Khoa hoc-mon hoc for (int i = 0; i < gridViewDSMonHoc.RowCount; i++) { bool _IsCheck = O2S_Common.TypeConvert.Parse.ToBoolean(gridViewDSMonHoc.GetRowCellValue(i, "IsCheck").ToString()); if (_IsCheck) { KHOAHOC_MONHOC _khmh = new KHOAHOC_MONHOC(); _khmh.KhoaHocId = _khoaHocId; _khmh.TenKhoaHoc = txtTenKhoaHoc.Text; _khmh.MonHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewDSMonHoc.GetRowCellValue(i, "MonHocId").ToString()); _khmh.TenMonHoc = gridViewDSMonHoc.GetRowCellValue(i, "TenMonHoc").ToString(); _khmh.DiemDat = O2S_Common.TypeConvert.Parse.ToDecimal(gridViewDSMonHoc.GetRowCellValue(i, "DiemDat").ToString()); KhoaHocMonHocLogic.Insert(_khmh); } } 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 //update { if (KhoaHocLogic.Update(LoadKhoaHoc())) { //INsert Khoa hoc-mon hoc KhoaHocMonHocLogic.DeleteTheoKhoaHoc(this.khoaHocSelect.KhoaHocId); for (int i = 0; i < gridViewDSMonHoc.RowCount; i++) { bool _IsCheck = O2S_Common.TypeConvert.Parse.ToBoolean(gridViewDSMonHoc.GetRowCellValue(i, "IsCheck").ToString()); if (_IsCheck) { KHOAHOC_MONHOC _khmh = new KHOAHOC_MONHOC(); _khmh.KhoaHocId = this.khoaHocSelect.KhoaHocId; _khmh.TenKhoaHoc = txtTenKhoaHoc.Text; _khmh.MonHocId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewDSMonHoc.GetRowCellValue(i, "MonHocId").ToString()); _khmh.TenMonHoc = gridViewDSMonHoc.GetRowCellValue(i, "TenMonHoc").ToString(); _khmh.DiemDat = O2S_Common.TypeConvert.Parse.ToDecimal(gridViewDSMonHoc.GetRowCellValue(i, "DiemDat").ToString()); KhoaHocMonHocLogic.Insert(_khmh); } } O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG); frmthongbao.Show(); } } LoadGridKhoaHoc(); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }
private void btnLuuPhieu_Click(object sender, EventArgs e) { try { ValidateLuuPhieu(); KHOAHOC _khoahoc = KhoaHocLogic.SelectSingle(O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString())); //var rowHandle = gridViewKhoanKhac.FocusedRowHandle; //Insert bang PHIEUGHIDANH //insert bang PHIEUTHU; HOCPHIHOCVIEN //cap nhat bang HOCVIEN trang thai hoc vien = hoc vien chinh thuc + TAIKHOAN=chinh thuc PHIEUGHIDANH _phieughidanh = new PHIEUGHIDANH(); _phieughidanh.HocVienId = this.HocVienId_Select; _phieughidanh.KhoaHocId = _khoahoc.KhoaHocId; _phieughidanh.NgayGhiDanh = DateTime.ParseExact(dateNgayGhiDanh.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture); // _phieughidanh.HocPhiKH = _khoahoc.HocPhi; _phieughidanh.SoTietKH = _khoahoc.SoTietHoc; _phieughidanh.HocPhiHocVienKH = O2S_Common.TypeConvert.Parse.ToDecimal(lblThanhTienKhoaHoc.Text.Replace(",", "")); _phieughidanh.SoTietHocVienKH = O2S_Common.TypeConvert.Parse.ToDecimal(numSoBuoiHVDangKy.Text); _phieughidanh.ThuKhoanKhac = TinhTongTien_ThuThem(); _phieughidanh.TongTien = O2S_Common.TypeConvert.Parse.ToDecimal(numTongTien.Text); _phieughidanh.DaDong = O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", "")); _phieughidanh.ConNo = O2S_Common.TypeConvert.Parse.ToDecimal(numConNo.Text); _phieughidanh.MienGiam_PhanTram = O2S_Common.TypeConvert.Parse.ToInt16(numMienGiam_PTram.Value.ToString()); _phieughidanh.MienGiam_Tien = O2S_Common.TypeConvert.Parse.ToDecimal(numMienGiam_Tien.Text.Replace(",", "")); _phieughidanh.LyDoMienGiam = txtLyDoMienGiam.Text; if (GlobalSettings.UserID != -1) { _phieughidanh.NhanVienId = GlobalSettings.UserID; } //insert bang PHIEUTHU PHIEUTHU _phieuthu = new PHIEUTHU(); List <HOCPHIHOCVIEN> _lsthphv = new List <HOCPHIHOCVIEN>(); if (O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", "")) > 0) { //_phieuthuInsert.PhieuGhiDanhId = this.PhieuGhiDanhId; _phieuthu.CoSoId = GlobalSettings.CoSoId; _phieuthu.HocVienId = this.HocVienId_Select; _phieuthu.ThoiGianThu = DateTime.Now; _phieuthu.SoTien = O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", "")); _phieuthu.GhiChu = ""; //Tien Khoa Hoc HOCPHIHOCVIEN _hphv_kh = new HOCPHIHOCVIEN() { Stt = 1, HocVienId = this.HocVienId_Select, DmDichVuId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString()), TenDichVu = cboKhoaHoc.Text, SoTien = O2S_Common.TypeConvert.Parse.ToDecimal(numHocPhi.Text), SoLuong = 1, //PhieuThuId = _phieuthuId, GhiChu = "", }; _lsthphv.Add(_hphv_kh); //tien khoan Khac if (gridViewKhoanKhac.RowCount > 0) { int _stt_thuthem = 2; for (int i = 0; i < gridViewKhoanKhac.RowCount; i++) { object _noidungkt = gridViewKhoanKhac.GetRowCellValue(i, "noidung"); if (_noidungkt != null) { HOCPHIHOCVIEN _hphv_khac = new HOCPHIHOCVIEN() { Stt = _stt_thuthem, HocVienId = this.HocVienId_Select, DmDichVuId = 0, TenDichVu = gridViewKhoanKhac.GetRowCellValue(i, "noidung") == null ? "" : gridViewKhoanKhac.GetRowCellValue(i, "noidung").ToString(), SoTien = O2S_Common.TypeConvert.Parse.ToDecimal(gridViewKhoanKhac.GetRowCellValue(i, "sotien").ToString()), SoLuong = 1, //PhieuThuId = _phieuthuId, GhiChu = gridViewKhoanKhac.GetRowCellValue(i, "ghichu") == null ? "" : gridViewKhoanKhac.GetRowCellValue(i, "ghichu").ToString(), }; _lsthphv.Add(_hphv_khac); _stt_thuthem += 1; } } } } if (PhieuGhiDanhLogic.InsertPGDFull(_phieughidanh, _phieuthu, _lsthphv, ref this.PhieuGhiDanhId, ref this.PhieuThuId)) { HOCVIEN _hv = HocVienLogic.SelectSingle(this.HocVienId_Select); MessageBox.Show(string.Format("Học viên {0} đã được chuyển thành học viên chính thức với tài khoản:{1}Tên đăng nhập: {2}{3}Mật khẩu: {4}", _hv.TenHocVien, Environment.NewLine, _hv.MaHocVien, Environment.NewLine, _hv.MaHocVien), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); isSave = true; btnLuuPhieu.Enabled = false; LoadPhieuGhiDanh(); if (this.PhieuThuId != 0) { btnInBienLai.Enabled = true; if (MessageBox.Show("Bạn có muốn in phiếu ghi danh vừa lưu?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { InBienLaiThuTien_Process(this.PhieuThuId); } } } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THAT_BAI); frmthongbao.Show(); } } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }