예제 #1
0
    private bool checkActive(string dll, int id_url)
    {
        ModulesBSO moduleBSO = new ModulesBSO();
        Modules    _module   = new Modules();

        _module = moduleBSO.GetModulesBySlug(dll);

        if (_module.ModulesParent == id_url)
        {
            return(true);
        }
        else
        {
            while (_module.ModulesParent != 0 && _module.ModulesParent != id_url)
            {
                _module = moduleBSO.GetModulesById(_module.ModulesParent);
                if (_module.ModulesParent == id_url)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
예제 #2
0
    private void BindMenuAdminCate(int cId)
    {
        if (Session["Admin_Username"] != null)
        {
            DataTable  table      = new DataTable();
            ModulesBSO modulesBSO = new ModulesBSO();

            if (AspNetCache.CheckCache("HTML_MainHome_Admin_" + Session["Admin_Username"].ToString()) == false)
            {
                table = modulesBSO.ViewMainModulesRoles(Session["Admin_Username"].ToString());
                AspNetCache.SetCacheWithTime("HTML_MainHome_Admin_" + Session["Admin_Username"].ToString(), table, 150);
            }
            else
            {
                table = (DataTable)AspNetCache.GetCache("HTML_MainHome_Admin_" + Session["Admin_Username"].ToString());
            }

            Modules _module = modulesBSO.GetModulesBySlug(Request["dll"].ToString());
            if (_module != null)
            {
                DataView dataView = new DataView(table);
                dataView.RowFilter = "Modules_Parent = " + _module.ModulesID + " And isView = true";
                table = dataView.ToTable();

                DataList2.DataSource = table;
                DataList2.DataBind();
            }
        }
        else
        {
            Response.Redirect("~/Default.aspx");
        }
    }
예제 #3
0
    private void NavigationTitle(string url)
    {
        ModulesBSO modulesBSO = new ModulesBSO();
        Modules    modules    = modulesBSO.GetModulesBySlug(url);

        if (modules != null)
        {
            litModules.Text = modules.ModulesName;
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie_lang = Request.Cookies["LangInfo_CMS"];

        if (cookie_lang == null || cookie_lang["Lang"] == null || cookie_lang["Lang"] == string.Empty)
        {
            cookie_lang         = new HttpCookie("LangInfo_CMS");
            cookie_lang["Lang"] = "vi-VN";
            cookie_lang.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookie_lang);
        }
        Language.language = cookie_lang["Lang"].ToString();
        Session["Lang"]   = cookie_lang["Lang"].ToString();

        ETO.Config config = new ETO.Config();
        if (AspNetCache.CheckCache("Config_" + Language.language) == false)
        {
            ConfigBSO configBSO = new ConfigBSO();

            config = configBSO.GetAllConfig(Language.language);
            AspNetCache.SetCacheWithTime("Config_" + Language.language, config, 150);
        }
        else
        {
            config = (ETO.Config)AspNetCache.GetCache("Config_" + Language.language);
        }
        Page.Title = config.Titleweb;

        ModulesBSO _moduleBSO = new ModulesBSO();
        Modules    _module    = new Modules();

        //string _userName = "";
        //HttpCookie cookie = Request.Cookies["UserInfor_EVNTIT"];
        //if (cookie != null && cookie["UserName"] != null && cookie["UserName"].Trim() != string.Empty)
        //{
        //    _userName = cookie["UserName"];
        //}
        //_userName = //(string)AspNetCache.GetCache(GetIpAddress());

        //Session["Admin_Username"] = _userName;

        //if (Session["Admin_Username"] == null)
        //{
        //    if (!string.IsNullOrEmpty(Request["dll"]))
        //    {
        //        if (Request["dll"].Equals("login"))
        //            Response.Redirect("~/Admin/Login.aspx");
        //         //   PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx"));
        //        else
        //            Response.Redirect("~/Default.aspx");
        //    }
        //    else
        //        Response.Redirect("~/Default.aspx");
        //}
        if (!this.m_UserValidation.IsSigned())
        {
            if (!string.IsNullOrEmpty(Request["dll"]) && Request["dll"].Equals("login"))
            {
                Response.Redirect("~/Admin/Login.aspx");
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
        else
        {
            Session["Admin_Username"] = m_UserValidation.UserName;

            if (!string.IsNullOrEmpty(Request["dll"]))
            {
                if (CheckExit(Request["dll"].ToString()))
                {
                    bool levelAdmin = CheckLevelAdmin(Request["dll"].ToString(), Session["Admin_UserName"].ToString());
                    if (levelAdmin == true)
                    {
                        _module = _moduleBSO.GetModulesBySlug(Request["dll"].ToString());

                        PlaceHolder1.Controls.Add(LoadControl("Client/Admin/" + _module.ModulesDir + "/" + _module.ModulesUrl + ".ascx"));
                    }
                    else
                    if (Request["dll"].Equals("login"))
                    {
                        // PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx"));
                        Response.Redirect("~/Admin/Login.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Default.aspx");
                    }
                }
                else
                {
                    if (Request["dll"].Equals("login"))
                    {
                        // PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx"));
                        Response.Redirect("~/Admin/Login.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Admin/home/Default.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
    }