public ActionResult Index(string id)
        {
            int noPages = 0, noRecords = 0;
            BlockUIExcelUploadModel uiModel = new BlockUIExcelUploadModel();

            try
            {
                uiModel.CurrentPage = Int32.Parse(Request.Params["page"]);
            }
            catch (Exception)
            {
                uiModel.CurrentPage = 1;
            }


            this.CheckPermission();

            ViewData["pagename"]     = "upload_excel";
            ViewData["action_block"] = "Excels/block_upload_excel";
            this.SetCommonData();
            this.GetLanguage();

            //DECLARE PAGE MODEL
            BI_Project.Models.UI.PageModel pageModel = new Models.UI.PageModel("upload_excel");
            pageModel.SetLanguage(this.LANGUAGE_OBJECT);
            pageModel.H1Title      = pageModel.GetElementByPath("page_excel.menu" + id + ".h1");
            pageModel.Title        = pageModel.GetElementByPath("page_excel.menu" + id + ".title");
            ViewData["page_model"] = pageModel;


            BlockLangExcelUpload blockLang = new BlockLangExcelUpload();

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

            blockData.PermissionID = id;

            //BI_Project.Helpers.Utility.JTokenHelper.GetLanguage("~/" + this.LANGUAGE_FOLDER, this.LANGUAGE);
            string xmlConfigFilePath = this.CONFIG_FOLDER + "\\excel_format_" + blockData.PermissionID.ToString() + ".xml";

            blockData.HelpDoc = BI_Project.Helpers.Utility.JTokenHelper.GetElementValue(xmlConfigFilePath, "excel_source.HelpDocumentPath");
            blockData.Note    = BI_Project.Helpers.Utility.JTokenHelper.GetElementValue(xmlConfigFilePath, "excel_source.Note.#cdata-section");
            ImporterServices services = new ImporterServices(this.DBConnection);

            blockData.ListHistory   = services.GetHistoryList(uiModel.CurrentPage, uiModel.PerPage, id, ref noPages, ref noRecords, uiModel.Month, uiModel.Year);
            blockData.NumberPages   = noPages;
            blockData.NumberRecords = noPages;
            blockData.CurrentPage   = uiModel.CurrentPage;
            blockData.FolderUpload  = pageModel.GetElementByPath("page_excel.menu" + id + ".UploadedDirectory");
            blockModel.DataModel    = blockData;
            //blockModel.DataModel = ViewData["block_menu_left_data"];
            if (services.ERROR != null)
            {
                FileHelper.SaveFile(services.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }

            ViewData["BlockData"] = blockModel;

            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #2
0
        public ActionResult Create(int?roleId)
        {
            this.SaveAccessLog("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"]     = "role_create";
            ViewData["action_block"] = "Roles/block_role_create";
            ViewData["data-form"]    = TempData["data"];

            string roleid = (Request.QueryString["roleid"] == null ? "0" : Request.QueryString["roleid"].ToString());

            this.SetConnectionDB();
            RoleServices services = new RoleServices(this.DBConnection);

            BlockDataRoleCreateModel model = new BlockDataRoleCreateModel();

            if (ViewData["data-form"] != null)
            {
                model = (BlockDataRoleCreateModel)ViewData["data-form"];
            }
            else
            {
                model = services.GetEntityById(Int32.Parse(roleid));
            }

            //BlockDataRoleCreateModel model = services.GetEntityById(Int32.Parse(roleid));
            this.GetLanguage();
            if (model.RoleId > 0)
            {
                ViewData["pagename"] = "role_edit";
            }

            Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection);

            ViewData["departments"]          = departmentServices.GetList();
            ViewData["listdepartmentsadmin"] = departmentServices.GetListAdminLogin((string)Session["CodeIsAdmin"]);

            if (services.ERROR != null)
            {
                FileHelper.SaveFile(new { data = model, ERROR = services.ERROR }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }
            BlockLangRoleCreateModel blockLang = new BlockLangRoleCreateModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_role_create", this.LANGUAGE_OBJECT, blockLang);
            blockModel.DataModel      = model;
            ViewData["BlockData"]     = blockModel;
            ViewData["CurrentRoleId"] = roleId;
            ViewData["CurrentOrgId"]  = model.DeptID;

            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #3
0
        public ActionResult Create()
        {
            this.SaveAccessLog("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"]     = "department_create";
            ViewData["action_block"] = "Departments/block_department_create";
            ViewData["data-form"]    = TempData["data"];

            string departId = (Request.QueryString["departid"] == null ? "0" : Request.QueryString["departid"].ToString());

            this.SetConnectionDB();
            DepartmentServices services = new DepartmentServices(this.DBConnection);

            EntityDepartmentModel model = new EntityDepartmentModel();

            if (ViewData["data-form"] != null)
            {
                model = (EntityDepartmentModel)ViewData["data-form"];
            }
            else
            {
                model = services.GetEntityById(Int32.Parse(departId));
            }

            //EntityDepartmentModel modelResponse = services.GetEntityById(Int32.Parse(departId));
            this.GetLanguage();
            if (model.DepartId > 0)
            {
                ViewData["pagename"] = "department_edit";
            }

            if (services.ERROR != null)
            {
                FileHelper.SaveFile(new { data = model, ERROR = services.ERROR }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }
            BlockDepartmentCreateLangModel blockLang = new BlockDepartmentCreateLangModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_department_create", this.LANGUAGE_OBJECT, blockLang);
            blockModel.DataModel  = model;
            ViewData["BlockData"] = blockModel;


            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #4
0
        //public ActionResult List()
        //{
        //    if (null == Session[this.SESSION_NAME_USERID])
        //    {
        //        return RedirectToAction("Login", "Home");
        //    }
        //    if (Session["IsAdmin"] is false)
        //    {
        //        return RedirectToAction("Logout", "Home");
        //    }
        //    this.SetCommonData();
        //    ViewData["pagename"] = "role_list";
        //    ViewData["action_block"] = "Roles/block_role_list";


        //    this.GetLanguage();


        //    this.SetConnectionDB();
        //    RoleServices services = new RoleServices(this.DBConnection);

        //    BlockLangRoleListModel blockLang = new BlockLangRoleListModel();
        //    BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_role_list", this.LANGUAGE_OBJECT, blockLang);
        //    //blockModel.DataModel = ViewData["block_menu_left_data"];
        //    blockModel.DataModel = services.GetList();
        //    blockModel.Hidden = 0;

        //    Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection);

        //    ViewData["departments"] = departmentServices.GetList();

        //    if (services.ERROR != null) FileHelper.SaveFile(services.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
        //    this.SaveAccessLog("list");
        //    ViewData["BlockData"] = blockModel;
        //    return View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml");
        //}

        public ActionResult List(int?DepartID = null)
        {
            if (Session["IsAdmin"] is false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            if (!Request.IsAjaxRequest())
            {
                if (null == Session[SESSION_NAME_USERID])
                {
                    return(RedirectToAction("Login", "Home"));
                }
                if (Session["IsAdmin"] is false)
                {
                    return(RedirectToAction("Logout", "Home"));
                }
                SetCommonData();
                ViewData["pagename"]     = "role_list";
                ViewData["action_block"] = "Roles/block_role_list";


                GetLanguage();


                SetConnectionDB();
                RoleServices services = new RoleServices(DBConnection);

                BlockLangRoleListModel blockLang  = new BlockLangRoleListModel();
                BlockModel             blockModel = new Models.UI.BlockModel("block_role_list", LANGUAGE_OBJECT, blockLang);
                //blockModel.DataModel = ViewData["block_menu_left_data"];
                if ((bool)Session["IsSuperAdmin"])
                {
                    blockModel.DataModel = services.GetList();
                }
                else
                {
                    blockModel.DataModel = services.GetList((int)Session["DepartIdUserLogin"]);
                }
                ViewData["BlockData"] = blockModel;
                return(View("~/" + THEME_FOLDER + "/" + THEME_ACTIVE + "/index.cshtml"));
            }
            else
            {
                SetConnectionDB();
                RoleServices services = new RoleServices(DBConnection);
                var          roleList = services.GetListDept(DepartID);
                return(Json(roleList, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult List()
        {
            if (null == Session[this.SESSION_NAME_USERID])
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (Session["IsAdmin"] == null)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            ViewData["pagename"]     = "department_list";
            ViewData["action_block"] = "Departments/block_department_list";


            this.GetLanguage();


            this.SetConnectionDB();
            DepartmentServices services = new DepartmentServices(this.DBConnection);

            BlockDepartmentListLangModel blockLang = new BlockDepartmentListLangModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_department_list", this.LANGUAGE_OBJECT, blockLang);
            //blockModel.DataModel = ViewData["block_menu_left_data"];


            if ((bool)Session["IsSuperAdmin"])
            {
                ViewData["departments"] = services.GetList();
            }
            else if ((bool)Session["IsAdmin"])
            {
                ViewData["listdepartmentsadmin"] = services.GetListAdminLogin((string)Session["CodeIsAdmin"]);
            }
            blockModel.DataModel = services.GetList();
            blockModel.Hidden    = 0;

            if (services.ERROR != null)
            {
                FileHelper.SaveFile(services.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }
            this.SaveAccessLog("list");
            ViewData["BlockData"] = blockModel;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #6
0
        //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"));
        }
예제 #7
0
        public ActionResult ChangePassword()
        {
            Logging.WriteToLog(this.GetType().ToString() + "-changepww()", LogType.Access);
            if (Session[this.SESSION_NAME_USERID] == null)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            ViewData["pagename"]     = "change_password";
            ViewData["action_block"] = "Users/block_user_changepw";
            this.GetLanguage();
            BlockLangUserChangepwModel blockLang = new BlockLangUserChangepwModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_user_changepw", this.LANGUAGE_OBJECT, blockLang);
            //blockModel.DataModel = ViewData["block_menu_left_data"];

            ViewData["BlockData"] = blockModel;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #8
0
        public ActionResult List()
        {
            if (Session["IsAdmin"] == null || (bool)Session["IsAdmin"] == false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            ViewData["pagename"]     = "user_list";
            ViewData["action_block"] = "Users/block_user_list";


            this.GetLanguage();


            this.SetConnectionDB();
            UserServices services = new UserServices(this.DBConnection);

            BlockLangUserListModel blockLang = new BlockLangUserListModel();

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

            //Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection);

            //ViewData["departments"] = departmentServices.GetList();

            if ((bool)Session["IsSuperAdmin"])
            {
                blockModel.DataModel = services.GetList();
            }
            else if ((bool)Session["IsAdmin"])
            {
                blockModel.DataModel = services.GetList((int)Session["DepartIdUserLogin"]);
            }

            if (services.ERROR != null)
            {
                FileHelper.SaveFile(services.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }

            Logging.WriteToLog(this.GetType().ToString() + "-List()", LogType.Access);
            ViewData["BlockData"] = blockModel;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
예제 #9
0
        public ActionResult Create()
        {
            if (Session["IsAdmin"] == null || (bool)Session["IsAdmin"] == false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();


            ViewData["pagename"]     = "user_create";
            ViewData["action_block"] = "Users/block_user_create";
            ViewData["data_form"]    = TempData["data"];

            string id = (Request.QueryString["id"] == null ? "0" : Request.QueryString["id"].ToString());

            this.SetConnectionDB();
            UserServices             services = new UserServices(this.DBConnection);
            BlockDataUserCreateModel model    = new BlockDataUserCreateModel();

            if (TempData["data"] != null)
            {
                model = (BlockDataUserCreateModel)ViewData["data_form"];
            }
            else
            {
                model = services.GetEntityById(Int32.Parse(id));
            }
            ViewData["data_form"] = model;
            Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection);

            ViewData["departments"]          = departmentServices.GetList();
            ViewData["listdepartmentsadmin"] = departmentServices.GetListAdminLogin((string)Session["CodeIsAdmin"]);
            ViewData["CurrentUser"]          = id;
            ViewData["currentOrgId"]         = model.DeptId;
            this.GetLanguage();
            if (model.UserId > 0)
            {
                ViewData["pagename"] = "user_edit";
            }

            BI_Project.Services.Roles.RoleServices roleServices = new Services.Roles.RoleServices(this.DBConnection);

            model.ListAllRoles = roleServices.GetList();

            MenuServices menuServices = new MenuServices(DBConnection);
            var          menuData     = menuServices.GetMenusByDepId((int)Session[SESSION_NAME_USERID]);

            //ViewData["CurrentDeptId"] = deptId;
            ViewData["MenuData"] = menuData;

            BlockLangUserCreateModel blockLang = new BlockLangUserCreateModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_user_create", this.LANGUAGE_OBJECT, blockLang);
            blockModel.DataModel  = model;
            ViewData["BlockData"] = blockModel;

            if (roleServices.ERROR != null)
            {
                FileHelper.SaveFile(roleServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt");
            }
            if (services.ERROR != null)
            {
                FileHelper.SaveFile(services.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"));
        }