protected void Page_Load(object sender, EventArgs e) { Entities db = new Entities(); Page.Title += " | 1PromotionalProducts.com"; if (!Page.User.Identity.IsAuthenticated) { btnEditCatList1.Visible = false; btnEditCatList2.Visible = false; loggedincontrols.Visible = false; logincontrols.Visible = true; } else { btnEditCatList1.Visible = true; btnEditCatList2.Visible = true; logincontrols.Visible = false; loggedincontrols.Visible = true; } if (!this.IsPostBack) { if (Page.User.Identity.IsAuthenticated) { loginviewer.Visible = true; } else { loginviewer.Visible = false; } var catalogs = db.Catalogs; catlist1title.InnerText = db.Variables.Single(x => x.Name == "leftSleaveTitle").Value; catlist2title.InnerText = db.Variables.Single(x => x.Name == "rightSleaveTitle").Value; int iMargin = 35; foreach (var catalog in catalogs.Where(x => x.Sleave == "Left")) { string sCatalogName = catalog.Name; string sCatalogURL = catalog.URL; if (catalog.ShowDescription) sCatalogURL = "Catalog.aspx?cn=" + sCatalogName; catlist1.InnerHtml += "<a style=\"margin-left:" + iMargin.ToString() + "px;\" href=\"" + sCatalogURL + "\" >" + sCatalogName + "</a><br />"; iMargin += 10; } iMargin = 35; foreach (var catalog in catalogs.Where(x => x.Sleave == "Right")) { string sCatalogName = catalog.Name; string sCatalogURL = catalog.URL; if (catalog.ShowDescription) sCatalogURL = "Catalog.aspx?cn=" + sCatalogName; catlist2.InnerHtml += "<a style=\"margin-right:" + iMargin.ToString() + "px;\" href=\"" + sCatalogURL + "\" >" + sCatalogName + "</a><br />"; iMargin += 7; } } }
protected void Page_Load(object sender, EventArgs e) { Entities db = new Entities(); if (!User.Identity.IsAuthenticated) { btnEditCatalog.Visible = false; } else { btnEditCatalog.Visible = true; } if (!this.IsPostBack) { string catalogName = Request.QueryString["cn"]; var catalog = db.Catalogs.Single(x => x.Name == catalogName); this.Title = catalog.Name; pagetitle.InnerText = catalog.Name; hlCatalogLink.Text = "Click Here To View The Catalog"; hlCatalogLink.NavigateUrl = catalog.URL; catalogpagecontent.InnerHtml = catalog.Description; } }
protected void btnSubmit_Click(object sender, EventArgs e) { var pageName = Request.QueryString["f"]; Entities db = new Entities(); var pageVariable = db.Variables.Single(x => x.Name == pageName); pageVariable.Value = rteBody.Text; db.SaveChanges(); Response.Redirect(pageVariable.Name + ".aspx", true); }
protected void btnSubmit_Click(object sender, EventArgs e) { Entities db = new Entities(); string sFileName = Request.QueryString["cn"]; var catalog = db.Catalogs.Single(x => x.Name == sFileName); catalog.Description = rteBody.Text; db.SaveChanges(); Response.Redirect("Catalog.aspx?cn=" + sFileName, true); }
protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated) { btnEdit.Visible = false; } else { btnEdit.Visible = true; } Entities db = new Entities(); contactinfo.InnerHtml = db.Variables.Single(x => x.Name == "contactus").Value; }
protected void btnSubmit_Click(object sender, EventArgs e) { Entities db = new Entities(); var passwordVariable = db.Variables.Single(x => x.Name == "Password"); if (tbxCurrentPassword.Text == passwordVariable.Value) { passwordVariable.Value = tbxNewPassword.Text; db.SaveChanges(); Response.Redirect("Default.aspx", true); } }
protected void btnLogin_Click(object sender, EventArgs e) { Entities db = new Entities(); if (tbxUsername.Text.ToUpper() == "ADMIN") { string sPassword = db.Variables.Single(x => x.Name == "Password").Value; if (tbxPassword.Text == sPassword) { FormsAuthentication.SetAuthCookie("Admin", false); Response.Redirect(Request.RawUrl); } else { CustomValidator1.IsValid = false; } } }
protected void Page_Load(object sender, EventArgs e) { Entities db = new Entities(); CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser(); fileBrowser.BasePath = "/ckfinder/"; fileBrowser.SetupCKEditor(rteBody); if (!User.Identity.IsAuthenticated) { Response.Redirect("Default.aspx", true); } if (!this.IsPostBack) { var pageName = Request.QueryString["f"]; rteBody.Text = db.Variables.Single(x => x.Name == pageName).Value; } }
protected void Page_Load(object sender, EventArgs e) { CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser(); fileBrowser.BasePath = "/ckfinder/"; fileBrowser.SetupCKEditor(rteBody); Entities db = new Entities(); if (!User.Identity.IsAuthenticated) { Response.Redirect("Default.aspx", true); } if (!this.IsPostBack) { string sFileName = Request.QueryString["cn"]; var catalog = db.Catalogs.Single(x => x.Name == sFileName); this.Title = "Edit " + catalog.Name; pagetitle.InnerText = "Edit " + catalog.Name; rteBody.Text = catalog.Description; } }
protected void btnSubmit_Click(object sender, EventArgs e) { Entities db = new Entities(); if (Request.QueryString["a"] == "l") { if (!cbxDeleteCatalog1.Visible) { var newCatalog = new Catalog { Name = tbxCatalogName1.Text, URL = tbxCatalogURL1.Text, Sleave = "Left", ShowDescription = cbxShowDescription1.Checked }; db.Catalogs.Add(newCatalog); lbxCatalogs1.Items.Add(tbxCatalogName1.Text); } else { if (cbxDeleteCatalog1.Checked) { int iIndex = lbxCatalogs1.SelectedIndex; lbxCatalogs1.Items.RemoveAt(iIndex); var catalog = db.Catalogs.Single(x => x.Name == tbxCatalogName1.Text); db.Catalogs.Remove(catalog); } else { var catalog = db.Catalogs.Single(x => x.Name == lbxCatalogs1.SelectedItem.Text); catalog.Name = tbxCatalogName1.Text; catalog.URL = tbxCatalogURL1.Text; catalog.ShowDescription = cbxShowDescription1.Checked; int iIndex = lbxCatalogs1.SelectedIndex; lbxCatalogs1.Items.RemoveAt(iIndex); lbxCatalogs1.Items.Insert(iIndex, tbxCatalogName1.Text); } } db.SaveChanges(); imgRefresh1_Click(null, null); } else { if (!cbxDeleteCatalog2.Visible) { var newCatalog = new Catalog { Name = tbxCatalogName2.Text, URL = tbxCatalogURL2.Text, Sleave = "Right", ShowDescription = cbxShowDescription2.Checked }; db.Catalogs.Add(newCatalog); lbxCatalogs1.Items.Add(tbxCatalogName2.Text); } else { if (cbxDeleteCatalog2.Checked) { int iIndex = lbxCatalogs2.SelectedIndex; lbxCatalogs2.Items.RemoveAt(iIndex); var catalog = db.Catalogs.Single(x => x.Name == tbxCatalogName2.Text); db.Catalogs.Remove(catalog); } else { var catalog = db.Catalogs.Single(x => x.Name == lbxCatalogs2.SelectedItem.Text); catalog.Name = tbxCatalogName2.Text; catalog.URL = tbxCatalogURL2.Text; catalog.ShowDescription = cbxShowDescription2.Checked; int iIndex = lbxCatalogs2.SelectedIndex; lbxCatalogs2.Items.RemoveAt(iIndex); lbxCatalogs2.Items.Insert(iIndex, tbxCatalogName2.Text); } } db.SaveChanges(); imgRefresh2_Click(null, null); } }
protected void Page_Load(object sender, EventArgs e) { Entities db = new Entities(); if (!User.Identity.IsAuthenticated) { Response.Redirect("Default.aspx", true); } if (!this.IsPostBack) { if (Request.QueryString["a"] == "l") { pagetitle.InnerText = "Edit Left Sleeve"; leftalign.Visible = true; rightalign.Visible = false; var sleaveTitleVariable = db.Variables.Single(x => x.Name == "leftSleaveTitle"); var catalogs = db.Catalogs.Where(x => x.Sleave == "Left"); tbxListTitle1.Text = sleaveTitleVariable.Value; foreach (var catalog in catalogs) lbxCatalogs1.Items.Add(catalog.Name); if (lbxCatalogs1.Items.Count == 10) { btnNewCatalog1.Enabled = false; lbxCatalogs1.SelectedIndex = 0; lbxCatalogs1_SelectedIndexChanged(null, null); } else { btnNewCatalog1_Click(null, null); } } else { pagetitle.InnerText = "Edit Right Sleeve"; leftalign.Visible = false; rightalign.Visible = true; var sleaveTitleVariable = db.Variables.Single(x => x.Name == "rightSleaveTitle"); var catalogs = db.Catalogs.Where(x => x.Sleave == "Right"); tbxListTitle2.Text = sleaveTitleVariable.Value; foreach (var catalog in catalogs) lbxCatalogs2.Items.Add(catalog.Name); if (lbxCatalogs2.Items.Count == 10) { btnNewCatalog2.Enabled = false; lbxCatalogs2.SelectedIndex = 0; lbxCatalogs1_SelectedIndexChanged(null, null); } else { btnNewCatalog1_Click(null, null); } } } }
protected void lbxCatalogs1_SelectedIndexChanged(object sender, EventArgs e) { Entities db = new Entities(); if (Request.QueryString["a"] == "l") { var catalog = db.Catalogs.Single(x => x.Name == lbxCatalogs1.SelectedItem.Text); cbxDeleteCatalog1.Visible = true; cbxDeleteCatalog1.Checked = false; tbxCatalogName1.Text = catalog.Name; tbxCatalogURL1.Text = catalog.URL; hlEditCatalog1.Visible = true; cbxShowDescription1.Visible = true; cbxShowDescription1.Checked = catalog.ShowDescription; hlEditCatalog1.NavigateUrl = "EditCatalog.aspx?cn=" + lbxCatalogs1.SelectedItem.ToString().Replace(" ", "").Replace("&", ""); } else { var catalog = db.Catalogs.Single(x => x.Name == lbxCatalogs2.SelectedItem.Text); cbxDeleteCatalog2.Visible = true; cbxDeleteCatalog2.Checked = false; tbxCatalogName2.Text = catalog.Name; tbxCatalogURL2.Text = catalog.URL; hlEditCatalog2.Visible = true; cbxShowDescription2.Visible = true; cbxShowDescription2.Checked = catalog.ShowDescription; hlEditCatalog2.NavigateUrl = "EditCatalog.aspx?cn=" + lbxCatalogs2.SelectedItem.ToString().Replace(" ", "").Replace("&", ""); } }
protected void imgRefresh2_Click(object sender, ImageClickEventArgs e) { Entities db = new Entities(); var sleaveTitleVariable = db.Variables.Single(x => x.Name == "rightSleaveTitle"); sleaveTitleVariable.Value = tbxListTitle2.Text; db.SaveChanges(); Response.Redirect(Request.RawUrl, true); }