protected void BindDropDownList()
    {
        SYS_TemplatePageBSO _tempateBSO = new SYS_TemplatePageBSO();
        DataTable           table       = _tempateBSO.GetSYS_TemplatePageAll(Language.language);
        commonBSO           commonBSO   = new commonBSO();

        ddlTemplate.Items.Clear();
        commonBSO.FillToDropDown(ddlTemplate, table, "~ Chọn Template ~", "0", "TemplateName", "Id", "");
    }
Example #2
0
    private void ViewTemplate()
    {
        SYS_TemplatePageBSO templateBSO = new SYS_TemplatePageBSO();
        DataTable           table       = templateBSO.GetSYS_TemplatePageAll(Language.language);

        commonBSO commonBSO = new commonBSO();

        commonBSO.FillToGridView(grvTemplate, table);
    }
    private void GetRegion()
    {
        List <ControlData> _list = new List <ControlData>();

        try
        {
            int PageLayoutId = TypeHelper.ToInt32(ddlPageLayout.SelectedValue);

            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = _pageLayoutBSO.GetSYS_PageLayoutById(PageLayoutId);

            SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO();
            SYS_TemplatePage    _template    = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId);


            Control           objControl = (Control)this.LoadControl(ResolveUrl("~/") + "Client/Skins/Templates/" + _template.TemplateControl);
            ControlCollection _controls  = objControl.Controls;

            foreach (Control obj1 in _controls)
            {
                Type objType = obj1.GetType();
                if (obj1 != null)
                {
                    if (obj1.ID != null)
                    {
                        ControlData objData = new ControlData();
                        objData.Control = obj1.ID;
                        if (obj1 != null)
                        {
                            objData.Text = obj1.ID;
                            _list.Add(objData);
                        }
                    }
                }
            }

            ddlRegion.Items.Clear();
            ddlRegion.DataSource     = _list;
            ddlRegion.DataTextField  = "Text";
            ddlRegion.DataValueField = "Control";

            ddlRegion.DataBind();
        }
        catch
        {
            ddlRegion.Items.Clear();
            ddlRegion.DataSource     = _list;
            ddlRegion.DataTextField  = "Text";
            ddlRegion.DataValueField = "Control";
            ddlRegion.DataBind();
        }
    }
Example #4
0
    public static string LoadMasterPage(string urlRoot, string strSlugPage, HttpRequest request, Page pageContainer, PlaceHolder placeHolderMainContent, string lang)
    {
        //IList<SYS_PageLayout> list = new List<SYS_PageLayout>();
        string strMaster = "MasterPage.master";

        if (strSlugPage != string.Empty)
        {
            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = new SYS_PageLayout();

            if (!AspNetCache.CheckCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_")))
            {
                _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug(strSlugPage, lang);
                if (_pageLayout == null)
                {
                    _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug("home", lang);
                }

                AspNetCache.SetCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_"), _pageLayout);
            }
            else
            {
                _pageLayout = (SYS_PageLayout)AspNetCache.GetCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_"));
            }


            if (_pageLayout != null)
            {
                SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO();
                SYS_TemplatePage    _template    = new SYS_TemplatePage();

                if (!AspNetCache.CheckCache("Template_" + _pageLayout.TemplateId))
                {
                    _template = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId);
                    AspNetCache.SetCache("Template_" + _pageLayout.TemplateId, _template);
                }
                else
                {
                    _template = (SYS_TemplatePage)AspNetCache.GetCache("Template_" + _pageLayout.TemplateId);
                }


                if (_template != null)
                {
                    strMaster = _template.MasterControl;
                }
            }
        }

        return(strMaster);
    }
Example #5
0
    public static void AddWidgetPage(string urlRoot, string strSlugPage, HttpRequest request, Page pageContainer, PlaceHolder placeHolderMainContent)
    {
        //IList<SYS_PageLayout> list = new List<SYS_PageLayout>();

        if (strSlugPage != string.Empty)
        {
            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = new SYS_PageLayout();

            if (!AspNetCache.CheckCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_")))
            {
                _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug(strSlugPage, Language.language);
                if (_pageLayout == null)
                {
                    _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug("home", Language.language);
                }

                AspNetCache.SetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"), _pageLayout);
            }
            else
            {
                _pageLayout = (SYS_PageLayout)AspNetCache.GetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"));
            }


            if (_pageLayout != null)
            {
                SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO();
                SYS_TemplatePage    _template    = new SYS_TemplatePage();

                if (!AspNetCache.CheckCache("Template_" + _pageLayout.TemplateId))
                {
                    _template = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId);
                    AspNetCache.SetCache("Template_" + _pageLayout.TemplateId, _template);
                }
                else
                {
                    _template = (SYS_TemplatePage)AspNetCache.GetCache("Template_" + _pageLayout.TemplateId);
                }


                if (_template != null)
                {
                    string  _path      = urlRoot + "Client/Skins/Templates/" + _template.TemplateControl;
                    Control objControl = (Control)pageContainer.LoadControl(_path);
                    placeHolderMainContent.Controls.Add(objControl);
                    AddWidgetPageLayout(objControl, _pageLayout.Id, urlRoot, pageContainer);
                }
            }
        }
    }
Example #6
0
    protected void btn_edit_Click(object sender, EventArgs e)
    {
        try
        {
            SYS_TemplatePage template = new SYS_TemplatePage();
            template = ReceiveHtml();

            SYS_TemplatePageBSO templateBSO = new SYS_TemplatePageBSO();
            templateBSO.UpdateSYS_TemplatePage(template);

            ViewTemplate();
            clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
            initControl(template.Id);
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }
Example #7
0
    protected void btn_add_Click_more(object sender, EventArgs e)
    {
        try
        {
            SYS_TemplatePage template = new SYS_TemplatePage();
            template = ReceiveHtml();


            SYS_TemplatePageBSO templateBSO = new SYS_TemplatePageBSO();
            int id = templateBSO.CreateSYS_TemplatePageGet(template);

            ViewTemplate();
            clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }
Example #8
0
    protected void grvTemplate_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    Id    = Convert.ToInt32(e.CommandArgument.ToString());
        string nName = e.CommandName.ToLower();

        switch (nName)
        {
        case "_edit":
            Response.Redirect("~/Admin/EditTemplate/" + Id + "/Default.aspx");
            break;

        case "_delete":
            SYS_TemplatePageBSO templateBSO = new SYS_TemplatePageBSO();
            templateBSO.DeleteSYS_TemplatePage(Id);

            ViewTemplate();
            break;
        }
    }
Example #9
0
    private void initControl(int Id)
    {
        if (Id > 0)
        {
            btn_add.Visible  = false;
            btn_edit.Visible = true;

            btn_add1.Visible  = false;
            btn_add2.Visible  = false;
            btn_edit1.Visible = true;
            try
            {
                SYS_TemplatePageBSO templateBSO = new SYS_TemplatePageBSO();
                SYS_TemplatePage    template    = templateBSO.GetSYS_TemplatePageById(Id);


                hddID.Value = Convert.ToString(template.Id);

                txtName.Text = template.TemplateName;
                txtInfo.Text = template.Info;
                GetFile();
                dropControl.SelectedValue = template.TemplateControl;
                GetFileMasterPage();
                ddlMasterPage.SelectedValue = template.MasterControl;
            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
        else
        {
            GetFile();
            GetFileMasterPage();
            btn_edit.Visible = false;
            btn_add.Visible  = true;

            btn_edit1.Visible = false;
            btn_add1.Visible  = true;
            btn_add2.Visible  = true;
        }
    }