//private string x = SESSION_NAME_USERID; public ActionResult Create() { if (null == Session[this.SESSION_NAME_USERID]) { return(RedirectToAction("Login", "Home")); } if (Session["IsAdmin"] is false) { return(RedirectToAction("Logout", "Home")); } this.SetCommonData(); ViewData["pagename"] = "menu_create"; ViewData["action_block"] = "Menus/block_create_menu"; ViewData["data-form"] = TempData["data"]; string menuId = (Request.QueryString["menuid"] == null ? "0" : Request.QueryString["menuid"].ToString()); this.SetConnectionDB(); MenuServices menuServices = new MenuServices(this.DBConnection); EntityMenuModel entityMenuModel = new EntityMenuModel(); entityMenuModel = menuServices.GetMenuModel(menuId); Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection); ViewData["CurrentOrgId"] = entityMenuModel.DeptID; ViewData["departments"] = departmentServices.GetList(); ViewData["listdepartmentsadmin"] = departmentServices.GetListAdminLogin((string)Session["CodeIsAdmin"]); this.GetLanguage(); ViewData["VIEWDATA_LANGUAGE"] = this.LANGUAGE_OBJECT; BlockCreateMenuLangModel blockLang = new BlockCreateMenuLangModel(); BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_create_menu", this.LANGUAGE_OBJECT, blockLang); blockModel.DataModel = entityMenuModel; ViewData["BlockData"] = blockModel; if (menuServices.ERROR != null) { BI_Project.Helpers.FileHelper.SaveFile(menuServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt"); } return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml")); }
public ActionResult Index(int id) { //lay url tu menu voi id ViewData["pagename"] = "Embed_Tableau"; ViewData["action_block"] = "Tableau/TableauView"; SetCommonData(); GetLanguage(); SetConnectionDB(); BI_Project.Models.UI.PageModel pageModel = new Models.UI.PageModel("Embed_Tableau"); // BI_Project.Models.UI.BlockModel blockModel = new BlockModel("TableauView"); pageModel.SetLanguage(this.LANGUAGE_OBJECT); //pageModel.H1Title = pageModel.GetElementByPath("page_excel.menu" + id + ".h1"); pageModel.Title = pageModel.GetElementByPath("title"); ViewData["page_model"] = pageModel; TableauModel param = new TableauModel(); ViewData["BlockData"] = param; MenuServices _menuServices = new MenuServices(DBConnection); EntityMenuModel _entityMenuModel = _menuServices.GetMenuModel(id.ToString()); UserServices _userServices = new UserServices(DBConnection); DepartmentServices _departmentServices = new DepartmentServices(DBConnection); EntityDepartmentModel _entityDepartmentModel = new EntityDepartmentModel(); //param.Site_Root = _entityMenuModel.Site_Root; param.Ticket = Helpers.TableauHelper.GetTicket(""); param.TableauUrl = _entityMenuModel.TableauUrl; param.Hidden = 1; param.username = Session["UserName"].ToString(); ViewBag.Id = id; var listFilter01 = _departmentServices.GetList().Select(x => x.Filter01).ToArray(); StringBuilder builderOrganization = new StringBuilder(); foreach (var _list in listFilter01) { builderOrganization.Append(_list).Append(','); } string _resultListOrganization = builderOrganization.ToString().TrimEnd(','); ViewBag.ListDepartment = _resultListOrganization; var getUser = _userServices.GetList(); var getUserCheck = getUser.FirstOrDefault(x => x.UserName == param.username); var getDepartment = _departmentServices.GetEntityById(getUserCheck.DeptId); if (getUserCheck.IsAdmin == false && (getDepartment.Filter01 != "PE" || getDepartment.Filter01 != "PA" || getDepartment.Filter01 != "PB" || getDepartment.Filter01 != "PC" || getDepartment.Filter01 != "PD")) { param.GetFilter(id); } //param.GetFilter(id); Random rd = new Random(); int item = rd.Next(100, 999); string log = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) + "_" + item; if (_menuServices.ERROR != null) { FileHelper.SaveFile(new { ERROR = _menuServices.ERROR }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt"); } FileHelper.SaveFile(_entityMenuModel, this.LOG_FOLDER + "/MenuModel_" + log + ".txt"); FileHelper.SaveFile(param.Ticket, this.LOG_FOLDER + "/Ticket_" + log + ".txt"); return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml")); }