Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int _index = 0; string[] Value = new string[((CMSmaster)this.Master).Cookies.CookiesName.Length];

            foreach (var Name in ((CMSmaster)this.Master).Cookies.CookiesName)
            {
                if (Session[Name] != null || Request.Cookies[Name] != null)
                {
                    Value[_index] = Session[Name] == null ? Request.Cookies[Name].Value : Session[Name].ToString(); _index++;
                }
                else
                {
                    Response.Redirect("~/login");
                }
            }
            ((CMSmaster)this.Master).AllPageGetData(Value);

            if (Request.Cookies["_temp_id"] != null)
            {
                var Cookies          = Request.Cookies["_temp_id"].Value;
                ECMS.Design.Design d = new ECMS.Design.Design();
                if (d.AvaiableTemplate(Cookies, ((CMSmaster)this.Master).RegID))
                {
                    TemplateID          = Cookies;
                    template.TemplateID = TemplateID;
                    lblPath.Text        = template.TemplateId_to_RegID(TemplateID);
                    //Response.Write(template.TemplateId_to_RegID(TemplateID));
                    if (!IsPostBack)
                    {
                        PanelShow(panel.FileUpload);
                        showFils_and_Folders();
                    }


                    if (Request.QueryString["fu_id"] != null)
                    {
                        string ID   = Request.QueryString["fu_id"].ToString();
                        string path = template.DeleteFileUpload(ID, ((CMSmaster)this.Master).RegID);
                        if (path != "File is Not Found.")
                        {
                            File.Delete(Server.MapPath("~/" + path));
                            lblResult.Text = "<div class='alert alert-success'> Delete " + template.ErrorMessege + ". " + GetFileName(path) + " </div>";
                            showFils_and_Folders();
                            Response.Redirect(Request.RawUrl.Replace(Request.Url.Query, ""));
                        }
                        else
                        {
                            Response.Redirect("~/500");
                        }
                    }
                }
                else
                {
                    HttpCookie myCookie = new HttpCookie("_temp_id");
                    myCookie.Expires = DateTime.Now.AddDays(-7d);
                    Response.Cookies.Add(myCookie);
                    Response.Redirect("~/CMS/Design");
                }
            }
            else
            {
                Response.Redirect("~/CMS/Design");
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if(chkYoutubeEnable.Checked)
            //{ pnlYoutube.Visible = true; }
            //else { pnlYoutube.Visible = false; }
            int _index = 0; string[] Value = new string[((CMSmaster)this.Master).Cookies.CookiesName.Length];

            foreach (var Name in ((CMSmaster)this.Master).Cookies.CookiesName)
            {
                if (Session[Name] != null || Request.Cookies[Name] != null)
                {
                    Value[_index] = Session[Name] == null ? Request.Cookies[Name].Value : Session[Name].ToString(); _index++;
                }
                else
                {
                    Response.Redirect("../login");
                }
            }
            ((CMSmaster)this.Master).AllPageGetData(Value);
            if (Request.Cookies["_temp_id"] != null)
            {
                Response.Redirect("~/CMS/Template/");
            }

            if (!IsPostBack)
            {
                ViewTemplate();
                foreach (ListItem li in de.AppsCategorys())
                {
                    ddlCategory.Items.Add(li);
                }
                //pnlImage.Visible = false;
                btnUpdate.Visible   = false;
                btnTemplate.Visible = true;
                Image1.Visible      = false;
                if (Request.QueryString["e"] != null)
                {
                    var EncTempID  = Request.QueryString["e"].ToString().Replace(" ", "+");
                    var TemplateID = _dec.Decrypt256bits(EncTempID, E_key);
                    if (design.AvaiableTemplate(TemplateID))
                    {
                        d = design.GetSingleTempletData(TemplateID);
                        txtDiscription.Text          = d.Discription;
                        txtPrice.Text                = d.Price.ToString();
                        txttags.Text                 = d.Tag;
                        txtTitle.Text                = d.Title;
                        txtYoutuleLink.Text          = d.YoutubeLink;
                        chkPublicMode.Checked        = d.PublicMode;
                        chkSEO.Checked               = d.SEO;
                        chkSpeedOptimization.Checked = d.SpeedOptimization;
                        chkSupport.Checked           = d.Support;
                        chkTesting.Checked           = d.Testing;
                        chkVersionUpdate.Checked     = d.Version;
                        btnTemplate.Visible          = false;
                        btnUpdate.Visible            = true;
                        Image1.Visible               = true;
                        Image1.ImageUrl              = "../../" + d.imgaePath;
                        Update_Image                 = d.imgaePath;
                        Update_ImageSize             = d.imageSize;
                        ddlCategory.SelectedValue    = d.CategoryID;
                    }
                    else
                    {
                        Response.Redirect("~/500");
                    }
                }
                if (Request.QueryString["g"] != null)
                {
                    string EncTempID  = Request.QueryString["g"].ToString().Replace(" ", "+");
                    string TemplateID = _dec.Decrypt256bits(EncTempID, G_Key);
                    if (design.AvaiableTemplate(TemplateID))
                    {
                        HttpCookie AddnewCookies = new HttpCookie("_temp_id", TemplateID);
                        Response.Cookies.Add(AddnewCookies);
                        Response.Redirect("~/CMS/Template/");
                    }
                    else
                    {
                        Response.Redirect("~/500");
                    }
                }
                if (Request.QueryString["d"] != null)
                {
                    var EncTempID  = Request.QueryString["d"].ToString().Replace(" ", "+");
                    var TemplateID = _dec.Decrypt256bits(EncTempID, D_Key);
                    if (design.AvaiableTemplate(TemplateID))
                    {
                        if (design.DeleteTemplate(TemplateID))
                        {
                            lblResult.Text = "<div class='alert alert-success'> Template Deleted. </div>";
                            File.Delete(Server.MapPath("~/" + design.ImagePath_forDelete));
                        }
                        else
                        {
                            lblResult.Text = "<div class='alert alert-success'>" + design.ErrorMessege + "</div>";
                        }
                    }
                    else
                    {
                        Response.Redirect("~/500");
                    }
                }
            }
        }