Beispiel #1
0
    protected void initControl(int ID)
    {
        if (ID > 0)
        {
            txtID.Value      = Convert.ToString(ID);
            btn_add.Visible  = false;
            btn_edit.Visible = true;

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

            try
            {
                SYS_WidgetBSO sys_WidgetBSO = new SYS_WidgetBSO();
                SYS_Widget    sys_Widget    = sys_WidgetBSO.GetSYS_WidgetById(ID);

                Bind_ddlWidgetType();
                ddlWidgetType.SelectedValue = Convert.ToString(sys_Widget.WidgetType);

                txtWidgetName.Text = sys_Widget.WidgetName;

                GetFile();
                GetFileControl = sys_Widget.WidgetControl + ".ascx";
                ActipFile();

                try
                {
                    dropFolder.SelectedItem.Text = sys_Widget.WidgetDir.ToString();
                    dropFolder.SelectedValue     = sys_Widget.WidgetDir.ToString();
                }
                catch { }
                txtInfo.Text      = sys_Widget.WidgetInfo;
                chkStatus.Checked = sys_Widget.WidgetStatus;
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }
        }
        else
        {
            GetFile();
            ActipFile();
            Bind_ddlWidgetType();
            txtID.Value = "";
            ddlWidgetType.SelectedIndex = 0;
            btn_add.Visible             = true;
            btn_edit.Visible            = false;

            btn_add1.Visible  = true;
            btn_add2.Visible  = true;
            btn_edit1.Visible = false;
        }
    }
Beispiel #2
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();

        Config config = new 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 = (Config)AspNetCache.GetCache("Config_" + Language.language);
        }
        Page.Title = config.Titleweb;

        if (!string.IsNullOrEmpty(Request["id"]))
        {
            SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
            SYS_WidgetPageLayout    _widgetPageLayout    = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(Convert.ToInt32(Request["id"].ToString()));

            if (_widgetPageLayout != null)
            {
                SYS_WidgetBSO _widgetBSO = new SYS_WidgetBSO();
                SYS_Widget    _widget    = _widgetBSO.GetSYS_WidgetById(_widgetPageLayout.WidgetId);
                if (_widget != null)
                {
                    if (_widget.WidgetControl != "")
                    {
                        Control objControl1 = (Control)this.Page.LoadControl(ResolveUrl("~") + "Client/Modules/" + _widget.WidgetDir + "/" + _widget.WidgetControl + ".ascx");
                        objControl1.ID = _widgetPageLayout.Id.ToString();
                        PlaceHolder1.Controls.Add(objControl1);

                        //  PlaceHolder1.Controls.Add(LoadControl(ResolveUrl("~") + _widget.WidgetDir + "/" + _widget.WidgetControl));

                        ControlAddParameter(objControl1, _widgetPageLayout.Title, _widgetPageLayout.Icon, _widgetPageLayout.Value, Convert.ToInt32(_widgetPageLayout.Record), _widgetPageLayout.Info, _widgetPageLayout.Value2, Convert.ToInt32(_widgetPageLayout.Record2), _widgetPageLayout.HTML);
                    }
                }
            }
        }
    }