コード例 #1
0
        public ActionResult importExcel()
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction("Login", "Admin"));
            }
            m_p = new PhanQuyenHeThong();
            string v_actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string v_controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            var    v_c = m_p.checkQuyenTruyCap(
                Session["IdUserGroup"].ToString()
                , v_controllerName
                , v_actionName);

            if (v_c == false)
            {
                return(RedirectToAction("Login", "Admin"));
            }
            return(PartialView());
        }
コード例 #2
0
        public ActionResult ExcelToDB()
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction("Login", "Admin"));
            }

            m_p = new PhanQuyenHeThong();
            string v_actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string v_controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            var    v_c = m_p.checkQuyenTruyCap(
                Session["IdUserGroup"].ToString()
                , v_controllerName
                , v_actionName);

            if (v_c == false)
            {
                return(RedirectToAction("Login", "Admin"));
            }
            ViewBag.LstNhanVien = ((SLExcelData)Session["SessionExcelData"]).DataRows;
            ViewBag.LstColumn   = Lay_danh_sach_cot_table_khach_hang();
            return(PartialView());
        }
コード例 #3
0
        public ActionResult UploadFile(HttpPostedFileBase excelFile)
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction("Login", "Admin"));
            }

            m_p = new PhanQuyenHeThong();
            string v_actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string v_controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            var    v_c = m_p.checkQuyenTruyCap(
                Session["IdUserGroup"].ToString()
                , v_controllerName
                , v_actionName);

            if (v_c == false)
            {
                return(RedirectToAction("Login", "Admin"));
            }
            var data = (new SLExcelReader()).ReadExcel(excelFile);

            Session["SessionExcelData"] = data;
            return(RedirectToAction("ExcelToDB"));
        }