protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); CategoryTableAdapter categoryAdapter = new CategoryTableAdapter(); DollarSaverDB.CategoryDataTable categories = categoryAdapter.GetPrimaryCategoriesByStation(StationId); categoryGrid.DataSource = categories.Rows; categoryGrid.DataBind(); }
protected override void OnPreInit(EventArgs e) { int categoryId = GetValueFromQueryString("category_id"); if (categoryId > 0) { CategoryTableAdapter categoryAdapter = new CategoryTableAdapter(); DollarSaverDB.CategoryDataTable categories = categoryAdapter.GetCategory(categoryId); if (categories.Count == 1) { category = categories[0]; } } base.OnPreInit(e); }
protected void Page_Load(object sender, EventArgs e) { saveButton.Click += new EventHandler(saveButton_Click); cancelButton.Click += new EventHandler(cancelButton_Click); deleteButton.Click += new EventHandler(deleteButton_Click); deleteButton.Attributes["onclick"] = "javascript: return confirm('Are you sure want to delete this item?');"; subCategoryGrid.RowCommand += new GridViewCommandEventHandler(subCategoryGrid_RowCommand); categoryId = GetIdFromQueryString(); CategoryTableAdapter categoryAdapter = new CategoryTableAdapter(); if (categoryId != 0) { DollarSaverDB.CategoryDataTable categories = categoryAdapter.GetCategory(categoryId); if (categories.Rows.Count != 1) { Response.Redirect("~/admin/CategoryList.aspx"); } category = categories[0]; if (category.StationId != StationId) { Response.Redirect("~/admin/CategoryList.aspx"); } if (!category.IsParentCategoryIdNull()) { parentCategoryId = category.ParentCategoryId; parentCategory = categoryAdapter.GetCategory(parentCategoryId)[0]; } } else { parentCategoryId = GetParentIdFromQueryString(); DollarSaverDB.CategoryDataTable parentCategories = categoryAdapter.GetCategory(parentCategoryId); if (parentCategories.Rows.Count != 1) { Response.Redirect("~/admin/CategoryList.aspx"); } parentCategory = parentCategories[0]; if (parentCategory.StationId != StationId) { Response.Redirect("~/admin/CategoryList.aspx"); } isNew = true; } if (isNew || !category.IsParentCategoryIdNull()) { isSubCategory = true; } }
protected void Page_Load(object sender, EventArgs e) { saveButton.Click += new EventHandler(saveButton_Click); cancelButton.Click += new EventHandler(cancelButton_Click); if (Station.SiteTypeId != (int)SiteType.Standard) { Response.Redirect("~/admin/Default.aspx"); } specialTable = specialAdapter.GetStationSpecial(StationId, 1); if (specialTable.Count == 1) { specialOne = specialTable[0]; } specialTable = specialAdapter.GetStationSpecial(StationId, 2); if (specialTable.Count == 1) { specialTwo = specialTable[0]; } specialTable = specialAdapter.GetStationSpecial(StationId, 3); if (specialTable.Count == 1) { specialThree = specialTable[0]; } specialTable = specialAdapter.GetStationSpecial(StationId, 4); if (specialTable.Count == 1) { specialFour = specialTable[0]; } if (!Page.IsPostBack) { CategoryTableAdapter categoryAdapter = new CategoryTableAdapter(); DollarSaverDB.CategoryDataTable categories = categoryAdapter.GetPrimaryCategoriesByStation(StationId); CertificateTableAdapter certificateAdapter = new CertificateTableAdapter(); DollarSaverDB.CertificateDataTable certificates = certificateAdapter.GetActive(StationId); //certificates.DefaultView.Sort SpecialSettingsTableAdapter specialSettingsAdapter = new SpecialSettingsTableAdapter(); DollarSaverDB.SpecialSettingsDataTable specialSettingsTable = specialSettingsAdapter.GetSpecialSettings(StationId); if (specialSettingsTable.Count == 1) { if (specialSettingsTable[0].DailyHeader) { dailyWeeklyList.SelectedValue = "1"; } else { dailyWeeklyList.SelectedValue = "2"; } } // Daily/Weekly Special 1 /* * specialOneCategoryList.DataSource = categories; * specialOneCategoryList.DataTextField = "Name"; * specialOneCategoryList.DataValueField = "CategoryId"; * specialOneCategoryList.DataBind(); */ specialOneCertificateList.DataSource = certificates.Rows; specialOneCertificateList.DataTextField = "AdvertiserAndCertificate"; specialOneCertificateList.DataValueField = "CertificateId"; specialOneCertificateList.DataBind(); if (specialOne != null) { if (!specialOne.IsCertificateIdNull()) { //specialOneCertificateBox.Checked = true; if (certificates.FindByCertificateId(specialOne.CertificateId) != null) { specialOneCertificateList.SelectedValue = specialOne.CertificateId.ToString(); } } /* * else if (!specialOne.IsCategoryIdNull()) { * specialOneCategoryBox.Checked = true; * * specialOneCategoryList.SelectedValue = specialOne.CategoryId.ToString(); * } else { * specialOneRandomBox.Checked = true; * } */ } // Special 2 specialTwoCategoryList.DataSource = categories; specialTwoCategoryList.DataTextField = "Name"; specialTwoCategoryList.DataValueField = "CategoryId"; specialTwoCategoryList.DataBind(); specialTwoCertificateList.DataSource = certificates.Rows; specialTwoCertificateList.DataTextField = "AdvertiserAndCertificate"; specialTwoCertificateList.DataValueField = "CertificateId"; specialTwoCertificateList.DataBind(); if (specialTwo != null) { if (!specialTwo.IsCertificateIdNull()) { specialTwoCertificateBox.Checked = true; if (certificates.FindByCertificateId(specialTwo.CertificateId) != null) { specialTwoCertificateList.SelectedValue = specialTwo.CertificateId.ToString(); } } else if (!specialTwo.IsCategoryIdNull()) { specialTwoCategoryBox.Checked = true; specialTwoCategoryList.SelectedValue = specialTwo.CategoryId.ToString(); } else { specialTwoRandomBox.Checked = true; } } // Special 3 specialThreeCategoryList.DataSource = categories; specialThreeCategoryList.DataTextField = "Name"; specialThreeCategoryList.DataValueField = "CategoryId"; specialThreeCategoryList.DataBind(); specialThreeCertificateList.DataSource = certificates.Rows; specialThreeCertificateList.DataTextField = "AdvertiserAndCertificate"; specialThreeCertificateList.DataValueField = "CertificateId"; specialThreeCertificateList.DataBind(); if (specialThree != null) { if (!specialThree.IsCertificateIdNull()) { specialThreeCertificateBox.Checked = true; if (certificates.FindByCertificateId(specialThree.CertificateId) != null) { specialThreeCertificateList.SelectedValue = specialThree.CertificateId.ToString(); } } else if (!specialThree.IsCategoryIdNull()) { specialThreeCategoryBox.Checked = true; specialThreeCategoryList.SelectedValue = specialThree.CategoryId.ToString(); } else { specialThreeRandomBox.Checked = true; } } // Special 4 specialFourCategoryList.DataSource = categories; specialFourCategoryList.DataTextField = "Name"; specialFourCategoryList.DataValueField = "CategoryId"; specialFourCategoryList.DataBind(); specialFourCertificateList.DataSource = certificates.Rows; specialFourCertificateList.DataTextField = "AdvertiserAndCertificate"; specialFourCertificateList.DataValueField = "CertificateId"; specialFourCertificateList.DataBind(); if (specialFour != null) { if (!specialFour.IsCertificateIdNull()) { specialFourCertificateBox.Checked = true; if (certificates.FindByCertificateId(specialFour.CertificateId) != null) { specialFourCertificateList.SelectedValue = specialFour.CertificateId.ToString(); } } else if (!specialFour.IsCategoryIdNull()) { specialFourCategoryBox.Checked = true; specialFourCategoryList.SelectedValue = specialFour.CategoryId.ToString(); } else { specialFourRandomBox.Checked = true; } } } }
protected void Page_Load(object sender, EventArgs e) { List <MenuItem> categoryMenu = new List <MenuItem>(); advertiserGrid.RowDataBound += new GridViewRowEventHandler(advertiserGrid_RowDataBound); MenuItem allAdvertisers = new MenuItem("View All", "0", null, "/admin/AdvertiserList.aspx"); categoryMenu.Add(allAdvertisers); bool inactive = Globals.ConvertToBool(Request.QueryString["inactive"]); String inactiveLinkAppender = String.Empty; if (inactive) { inactiveLinkAppender = "&inactive=1"; } foreach (DollarSaverDB.CategoryRow category in Station.PrimaryCategories) { MenuItem item = new MenuItem(category.Name, category.CategoryId.ToString(), null, "/admin/AdvertiserList.aspx?id=" + category.CategoryId + inactiveLinkAppender); categoryMenu.Add(item); } categoryMenuRepeater.DataSource = categoryMenu; categoryMenuRepeater.DataBind(); int categoryId = GetIdFromQueryString(); DollarSaverDB.AdvertiserDataTable advertisers; if (categoryId > 0) { CategoryTableAdapter categoryAdapter = new CategoryTableAdapter(); DollarSaverDB.CategoryDataTable categories = categoryAdapter.GetCategory(categoryId); if (categories.Count != 1) { Response.Redirect("~/admin/AdvertiserList.aspx"); } DollarSaverDB.CategoryRow category = categories[0]; if (category.StationId != StationId) { Response.Redirect("~/admin/AdvertiserList.aspx"); } if (inactive) { advertisers = category.InactiveAdvertisers; } else { advertisers = category.ActiveAdvertisers; } } else { if (inactive) { advertisers = Station.InactiveAdvertisers; } else { advertisers = Station.ActiveAdvertisers; } } if (advertisers.Count > 0) { advertiserHolder.Visible = true; noAdvertiserHolder.Visible = false; advertiserGrid.DataSource = advertisers.Rows; advertiserGrid.DataBind(); } else { advertiserHolder.Visible = false; noAdvertiserHolder.Visible = true; } if (inactive) { activeLinkHolder.Visible = true; inactiveLinkHolder.Visible = false; headerCell.Text = "Inactive Advertisers"; } else { activeLinkHolder.Visible = false; inactiveLinkHolder.Visible = true; } if (CurrentUser.Role == AdminRole.Root || CurrentUser.Role == AdminRole.Admin) { categoryHolder.Visible = true; } else { categoryHolder.Visible = false; } }