public int XoaGioHang([System.Web.Http.FromBody]string makhoahoc)
        {
            if (Session[SesHocVien] == null)
            {
                return -2;
            }

            int khoahoc;

            if (!int.TryParse(makhoahoc, out khoahoc))
            {
                return -1;
            }

            List<KHOAHOC> giohang = (List<KHOAHOC>)Session["GioHang"];

            KHOAHOC kHOAHOC = giohang.SingleOrDefault(n => n.MaKH == khoahoc);

            if (kHOAHOC == null)
            {
                return -1;
            }

            giohang.Remove(kHOAHOC);

            return giohang.Count;
        }
Пример #2
0
        public int update(string makh, string tenkh, string mota, string tailieu, int thoigian)
        {
            try
            {
                using (QLTTEntities qltt = new QLTTEntities())
                {
                    KHOAHOC data = qltt.KHOAHOCs.Where(p => p.MAKH == makh).FirstOrDefault();
                    if (data != null)
                    {
                        data.TENKH    = tenkh;
                        data.MOTA     = mota;
                        data.TAILIEU  = tailieu;
                        data.THOIGIAN = thoigian;
                        qltt.SaveChanges();
                        return(1);
                    }

                    return(0);
                }
            }
            catch
            {
                return(0);
            }
        }
Пример #3
0
        public int insert(string makh, string tenkh, string mota, string tailieu, int thoigian)
        {
            try
            {
                using (QLTTEntities qltt = new QLTTEntities())
                {
                    KHOAHOC data = new KHOAHOC()
                    {
                        MAKH     = makh,
                        TENKH    = tenkh,
                        MOTA     = mota,
                        TAILIEU  = tailieu,
                        THOIGIAN = thoigian
                    };
                    qltt.KHOAHOCs.Add(data);
                    qltt.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                return(0);
            }
        }
Пример #4
0
        public ActionResult ThemKhoaHoc(KHOAHOC kh, FormCollection c)
        {
            var nambd = c["nambd"];
            var namkt = c["namkt"];
            var ma    = c["maKhoaHoc"];

            if (string.IsNullOrEmpty(ma))
            {
                ViewData["Loi1"] = "Mã khóa học không được để trống";
            }
            else if (string.IsNullOrEmpty(nambd))
            {
                ViewData["Loi2"] = "Năm bắt đầu không được để trống";
            }
            else if (string.IsNullOrEmpty(namkt))
            {
                ViewData["Loi3"] = "Năm kết thúc không được để trống";
            }
            else
            {
                kh.MaKhoaHoc  = ma;
                kh.NamBatDau  = Convert.ToInt32(nambd);
                kh.NamKetThuc = Convert.ToInt32(namkt);
                data.KHOAHOCs.InsertOnSubmit(kh);
                data.SubmitChanges();
                return(RedirectToAction("Index", "KhoaHoc"));
            }
            return(this.ThemKhoaHoc());
        }
Пример #5
0
        public ActionResult XoaKhoaHoc(string id)
        {
            KHOAHOC ct = data.KHOAHOCs.SingleOrDefault(n => n.MaKhoaHoc == id);

            ViewBag.Makhoahoc = ct.MaKhoaHoc;
            return(View(ct));
        }
        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 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();
        }
Пример #8
0
 public bool Update(KHOAHOC KHOAHOC)
 {
     if (baseFunctions.Update(KHOAHOC) > 0)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
 public bool Insert(KHOAHOC KHOAHOC)
 {
     if (baseFunctions.Add(KHOAHOC) > 0)
     {
         return(true);
     }
     return(false);
 }
 public ActionResult Duyetkh(KHOAHOC kh)
 {
     if (ModelState.IsValid)
     {
         UpdateModel(kh);
         db.SubmitChanges();
         return(RedirectToAction("GV"));
     }
     return(View(kh));
 }
 /// <summary>
 /// Nạp khóa học lên giao diện
 /// </summary>
 /// <param name="kh">Khóa học</param>
 public void LoadUI(KHOAHOC kh)
 {
     txtMaKH.Text      = kh.MaKH;
     txtTenKH.Text     = kh.TenKH;
     numHocPhi.Value   = (decimal)kh.HocPhi;
     numDiemNghe.Value = (decimal)kh.HeSoNghe;
     numDiemNoi.Value  = (decimal)kh.HeSoNoi;
     numDiemDoc.Value  = (decimal)kh.HeSoDoc;
     numDiemViet.Value = (decimal)kh.HeSoViet;
 }
 public ActionResult Addkh(KHOAHOC kh)
 {
     if (ModelState.IsValid)
     {
         db.KHOAHOCs.InsertOnSubmit(kh);
         db.SubmitChanges();
         return(RedirectToAction("KH"));
     }
     return(View(kh));
 }
Пример #13
0
        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();
        }
        public ActionResult Duyetkh(int id)
        {
            KHOAHOC kh = db.KHOAHOCs.SingleOrDefault(n => n.MaKH == id);

            ViewBag.MaKH = kh.MaKH;
            if (kh == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(View(kh));
        }
Пример #15
0
        public ActionResult Delete(int id)
        {
            KHOAHOC cd = db.KHOAHOCs.SingleOrDefault(n => n.MaKhoaHoc == id);

            if (cd == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            db.KHOAHOCs.Remove(cd);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #16
0
        /// <summary>
        /// Cập nhật thông tin khóa học
        /// </summary>
        /// <param name="kh">Khóa học cần sửa</param>
        public static void Update(KHOAHOC kh)
        {
            var khoaHocCu = Select(kh.MaKH);

            khoaHocCu.TenKH    = kh.TenKH;
            khoaHocCu.HocPhi   = kh.HocPhi;
            khoaHocCu.HeSoNghe = kh.HeSoNghe;
            khoaHocCu.HeSoNoi  = kh.HeSoNoi;
            khoaHocCu.HeSoDoc  = kh.HeSoDoc;
            khoaHocCu.HeSoViet = kh.HeSoViet;

            Database.SubmitChanges();
        }
Пример #17
0
        public ActionResult Edit(int id)
        {
            //Lấy ra đối tượng sách theo mã
            KHOAHOC cd = db.KHOAHOCs.SingleOrDefault(n => n.MaKhoaHoc == id);

            if (cd == null)
            {
                Response.StatusCode = 404;
                return(null);
            }

            return(View(cd));
        }
Пример #18
0
        public ActionResult XacNhanXoa(string id)
        {
            KHOAHOC ct = data.KHOAHOCs.SingleOrDefault(n => n.MaKhoaHoc == id);

            ViewBag.Makhoahoc = ct.MaKhoaHoc;
            if (ct == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            data.KHOAHOCs.DeleteOnSubmit(ct);
            data.SubmitChanges();
            return(RedirectToAction("Index", "KhoaHoc"));
        }
Пример #19
0
 public int delete(string code)
 {
     using (QLTTEntities qltt = new QLTTEntities())
     {
         KHOAHOC data = qltt.KHOAHOCs.Where(p => p.MAKH == code).FirstOrDefault();
         if (data != null)
         {
             qltt.KHOAHOCs.Remove(data);
             qltt.SaveChanges();
             return(1);
         }
     }
     return(0);
 }
Пример #20
0
        public ActionResult SachLienQuan(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KHOAHOC tl = db.KHOAHOCs.Find(id);

            if (tl == null)
            {
                return(HttpNotFound());
            }
            ViewBag.sachtheoKHOAHOC = tl.DAUSACHes.ToList();
            return(PartialView("_PartitalView_SachLienQuan"));
        }
Пример #21
0
        // GET: KHOAHOC/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KHOAHOC KHOAHOC = db.KHOAHOCs.Find(id);

            if (KHOAHOC == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TenKhoaHoc = KHOAHOC.TenKhoaHoc;
            return(View(db.DAUSACHes.Where(temp => temp.MaKhoaHoc == id).ToList()));
        }
Пример #22
0
        public ActionResult ChiTietKhoaHoc(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            KHOAHOC khoahoc = db.KHOAHOC.FirstOrDefault(s => s.MA_KH == id);

            if (khoahoc == null)
            {
                return(HttpNotFound());
            }

            return(View(khoahoc));
        }
Пример #23
0
 public ActionResult Create(KHOAHOC cd)
 {
     //Thêm vào cơ sở dữ liệu
     if (ModelState.IsValid)
     {
         db.KHOAHOCs.Add(cd);
         db.SaveChanges();
         ViewBag.ThongBao = "Thêm mới thành công";
     }
     else
     {
         ViewBag.ThongBao = "Thêm mới thất bại";
         return(View(cd));
     }
     return(RedirectToAction("Index"));
 }
 private void KhoaHoc_ClickData(KHOAHOC kh)
 {
     try
     {
         txtMaKhoaHoc.Text  = kh.MaKhoaHoc;
         txtTenKhoaHoc.Text = kh.TenKhoaHoc;
         numHocPhi.Text     = O2S_Common.Number.Convert.NumberToString(kh.HocPhi ?? 0, 0);
         numSoTietHoc.Text  = O2S_Common.Number.Convert.NumberToString(kh.SoTietHoc ?? 0, 0);
         decimal _hocphi1buoi = kh.SoTietHoc != 0 ? (kh.HocPhi / kh.SoTietHoc) ?? 0 : 0;
         numHocPhi1Buoi.Text = O2S_Common.Number.Convert.NumberToString(_hocphi1buoi, 0);
         chkDaKhoa.Checked   = kh.IsLock ?? false;
         //Load mon hoc cua Khoa hoc
         List <KhoaHocMonHocDTO> _lstKHMH = this.lstKHMH;
         List <KHOAHOC_MONHOC>   _khmh    = KhoaHocMonHocLogic.SelectTheoKhoaHoc(kh.KhoaHocId);
         if (_khmh != null && _khmh.Count > 0)
         {
             foreach (var item in _lstKHMH)
             {
                 List <KHOAHOC_MONHOC> _kiemtra = _khmh.Where(o => o.MonHocId == item.MonHocId).ToList();
                 if (_kiemtra != null && _kiemtra.Count > 0)
                 {
                     item.IsCheck = true;
                     item.DiemDat = _kiemtra[0].DiemDat ?? 0;
                 }
                 else
                 {
                     item.IsCheck = false;
                     item.DiemDat = 0;
                 }
             }
         }
         else
         {
             foreach (var item in _lstKHMH)
             {
                 item.IsCheck = false;
                 item.DiemDat = 0;
             }
         }
         gridControlDSMonHoc.DataSource = null;
         gridControlDSMonHoc.DataSource = _lstKHMH;
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
        public int ThemGioHang(string khoahoc)
        {
            if (Session[SesHocVien] == null)
            {
                return -4;
            }

            HOCVIEN hocvien = (HOCVIEN)Session[SesHocVien];

            int makhoahoc;
            if (!int.TryParse(khoahoc, out makhoahoc))
            {
                return -3;
            }

            KHOAHOC khoaHoc = db.KHOAHOCs.SingleOrDefault(n => n.MaKH == makhoahoc);

            if (khoaHoc == null)
            {
                return -3;
            }

            CHITIETDONTHANG chitiet = db.CHITIETDONTHANGs.SingleOrDefault(n => n.DONDATHANG.HOCVIEN.MaHV == hocvien.MaHV &&
                                        n.KHOAHOC.MaKH == makhoahoc);

            if (chitiet != null)
            {
                return -2;
            }

            if (Session["GioHang"] == null)
            {
                Session["GioHang"] = new List<KHOAHOC>();
            }

            List<KHOAHOC> giohang = (List<KHOAHOC>)Session["GioHang"];

            if (giohang.SingleOrDefault(n => n.MaKH == makhoahoc) != null)
            {
                return -1;
            }

            giohang.Add(khoaHoc);

            return giohang.Count;
        }
Пример #26
0
        public ActionResult Edit(KHOAHOC cd)
        {
            //Thêm vào cơ sở dữ liệu
            if (ModelState.IsValid)
            {
                //Thực hiện cập nhận trong model
                db.Entry(cd).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                ViewBag.ThongBao = "Lỗi";
                return(View(cd));
            }

            return(RedirectToAction("Index"));
        }
Пример #27
0
        public DataTable get(string code)
        {
            using (QLTTEntities qltt = new QLTTEntities())
            {
                KHOAHOC data = qltt.KHOAHOCs.Where(p => p.MAKH == code).FirstOrDefault();
                if (data != null)
                {
                    DataTable rtnTable = new DataTable();
                    rtnTable.Columns.Add("MAKH", typeof(string));
                    rtnTable.Columns.Add("TENKH", typeof(string));
                    rtnTable.Columns.Add("MOTA", typeof(string));
                    rtnTable.Columns.Add("TAILIEU", typeof(string));
                    rtnTable.Columns.Add("THOIGIAN", typeof(int));

                    rtnTable.Rows.Add(data.MAKH, data.TENKH, data.MOTA, data.TAILIEU, data.THOIGIAN);
                    return(rtnTable);
                }
            }
            return(null);
        }
Пример #28
0
        public static bool Insert(KHOAHOC _khoahoc, ref int _khoaHocId)
        {
            try
            {
                _khoahoc.CreatedDate = DateTime.Now;
                _khoahoc.CreatedBy   = GlobalSettings.UserCode;
                _khoahoc.CreatedLog  = GlobalSettings.SessionMyIP;
                _khoahoc.IsRemove    = 0;
                Database.KHOAHOCs.InsertOnSubmit(_khoahoc);
                Database.SubmitChanges();
                _khoaHocId         = _khoahoc.KhoaHocId;
                _khoahoc.MaKhoaHoc = string.Format("{0}{1:D5}", "KH", _khoaHocId);
                Database.SubmitChanges();
                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);

                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
        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);
            }
        }
        public ActionResult ThongKhoaHoc(int khoahoc)
        {
            KHOAHOC khoaHoc = db.KHOAHOCs.SingleOrDefault(n => n.MaKH == khoahoc);

            ViewBag.MuaHang = false;

            if (khoaHoc == null)
            {
                return(View());
            }

            if (Session[SesHocVien] == null)
            {
                return(View(khoaHoc));
            }

            HOCVIEN hocvien = (HOCVIEN)Session[SesHocVien];

            if (hocvien != null)
            {
                CHITIETDONTHANG chitiet = db.CHITIETDONTHANGs.SingleOrDefault(n => n.DONDATHANG.HOCVIEN.MaHV == hocvien.MaHV &&
                                                                              n.KHOAHOC.MaKH == khoaHoc.MaKH);

                if (chitiet != null)
                {
                    ViewBag.MuaHang = true;
                }
            }

            var baigiangs = khoaHoc.BaiGiangs;

            if (baigiangs.Count != 0)
            {
                ViewBag.BaiGiangs = baigiangs.ToList();
            }

            return(View(khoaHoc));
        }