Пример #1
0
        public ActionResult UploadTableData(BlockDataRowUploadModel model)
        {
            if (null == Session[this.SESSION_NAME_USERID])
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (Session["IsAdmin"] == null || (bool)Session["IsAdmin"] == false)
            {
                return(RedirectToAction("Logout", "Home"));
            }

            this.GetLanguage();

            try
            {
                int output = 0;
                this.SetConnectionDB();
                EVNImporterServices services = new EVNImporterServices(oracleConnection, DBConnection);
                output = services.ExecuteDataTable(model.Month, model.Year, model.File, model.DataString);
                if (output == 0)
                {
                    Session["msg_text"] = BlockLanguageModel.GetElementLang(this.LANGUAGE_OBJECT, "messages.block_upload_excel.success");

                    Session["msg_code"] = 1;
                }
                else
                {
                    if (services.ERROR != null)
                    {
                        throw new Exception(services.ERROR);
                    }
                    //Session["msg_text"] = BlockLanguageModel.GetElementLang(this.LANGUAGE_OBJECT, "messages.block_upload_excel.error") + " Lỗi " + services.ERROR.ToString();
                    Session["msg_text"] = BlockLanguageModel.GetElementLang(this.LANGUAGE_OBJECT, "messages.block_upload_excel.error") + " Lỗi dữ liệu nhập vào.";

                    Session["msg_code"] = -1;
                }
            }
            catch (Exception ex)
            {
                Session["msg_text"] = BlockLanguageModel.GetElementLang(this.LANGUAGE_OBJECT, "messages.block_upload_excel.error") + " Lỗi dữ liệu nhập vào. ";

                Session["msg_code"] = -1;
            }


            if (model.Type == 1)
            {
                var jsonData = new
                {
                    rows = JsonConvert.DeserializeObject <List <object> >(model.DataString)
                };

                return(Json(jsonData, JsonRequestBehavior.AllowGet));
            }

            return(RedirectToAction("AddDNTData"));
        }
Пример #2
0
        public ActionResult AddDNTData()
        {
            if (Session["IsAdmin"] == null || (bool)Session["IsAdmin"] == false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            this.GetLanguage();

            ViewData["pagename"]     = "dnt_upload";
            ViewData["action_block"] = "EVNImportExcelPL/EVNPL_block_upload_dnt";

            BlockLangRowUploadModel blockLang = new BlockLangRowUploadModel();

            BI_Project.Models.UI.BlockModel blockModel = new BlockModel("block_dnt_upload", this.LANGUAGE_OBJECT, blockLang);
            BlockDataRowUploadModel         blockData  = new BlockDataRowUploadModel();

            blockModel.DataModel = blockData;

            ViewData["BlockData"] = blockModel;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }