protected void BindImageCategoriesList()
		{
			BPImageCategories bpcat = new BPImageCategories();
			DSImageCategories = bpcat.SelectAll();
			//DSImageCategories.tbl_ImageCategories.DefaultView.Sort = "ImageCategoryOrder";
			DSImageCategories.tbl_ImageCategories.DefaultView.Sort = "ImageCategoryName";
			dgImageCategories.DataBind();
		}
Пример #2
0
		protected void BindImageCategories()
		{
			ddlImageCategories.Attributes.Add("onchange", "callToServer(this.form.name, this.name, 'Image', 'ddlImages', 'ImageLoader.aspx');");

			BPImageCategories bp = new BPImageCategories();
			DSImageCategories = bp.SelectAllActive();
			DSImageCategories.tbl_ImageCategories.DefaultView.Sort = "ImageCategoryName";
			ddlImageCategories.DataBind();

			ddlImageCategories.Items.Insert(0, new ListItem("(All Image Categories)", "-1"));
		}
Пример #3
0
		private void Page_Load(object sender, EventArgs e)
		{
			this.AuthenticatePage(new string[] {PermissionLevels.EditImageCategories, PermissionLevels.AddImageCategories, PermissionLevels.ViewImageCategories});
			if (ImageCategoryID > 0)
			{
				if (this.CarrielUser.RolePermission(PermissionLevels.EditImageCategories) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
				}
				else
				{
					btnSubmit.Visible = true;
					btnDelete.Visible = true;
				}
			}
			else
			{
				if (this.CarrielUser.RolePermission(PermissionLevels.AddImageCategories) != 2)
				{
					btnSubmit.Visible = false;
				}
			}

//			if (IsNewSession)
//			{
//				AddToListIfAdmin();
//				IsNewSession = false;
//			}

			if(!IsPostBack)
			{
				if (ImageCategoryID == 0)
				{
					lblTitle.Text = "Add Image Category";
					btnDelete.Visible = false;
					lblActiveWarning.Visible = false;
				}
				else
				{
					BPImageCategories bpCat = new BPImageCategories();
					BEImageCategories ds = bpCat.SelectImageCategoryByID(ImageCategoryID);
					BEImageCategories.tbl_ImageCategoriesRow category = ds.tbl_ImageCategories.FindByImageCategoryID(ImageCategoryID);

					txtImageCategoryName.Text = category.ImageCategoryName;
					lblTitle.Text = "Edit Image Category - " + category.ImageCategoryName;

					txtImageCategoryDescription.Text = category.ImageCategoryDescription;

					chkImageCategoryActive.Checked = category.ImageCategoryActive;

					lblActiveWarning.Visible = true;
				}
			}
		}
Пример #4
0
		private void btnDelete_Click(object sender, EventArgs e)
		{
			BPImageCategories bp = new BPImageCategories();
			BEImageCategories.tbl_ImageCategoriesRow ImageCategory;
			
			DSImageCategories = bp.SelectImageCategoryByID(ImageCategoryID);
			ImageCategory = DSImageCategories.tbl_ImageCategories.FindByImageCategoryID(ImageCategoryID);

			ImageCategory.Delete();
			bp.Update(DSImageCategories);

			bp.UpdateByImageCategoryID(ImageCategoryID);

			Response.Redirect("BrowseImageCategories.aspx");
		}
Пример #5
0
		private void btnSubmit_ServerClick(object sender, EventArgs e)
		{
			BPImageCategories bp = new BPImageCategories();
			BEImageCategories.tbl_ImageCategoriesRow category;
			DSImageCategories = new BEImageCategories();

			//if they are making this category inactive make all items below this category unassigned and inactive
			if (ImageCategoryID > 0)
			{
				bool wasActive = GetImageCategoryActiveStatus(ImageCategoryID);

				if ((wasActive) && (! chkImageCategoryActive.Checked))
				{
					bp.UpdateByImageCategoryID(ImageCategoryID);
				}
			}

			if (ImageCategoryID == 0)
			{
				// Add a Image Category
				category = DSImageCategories.tbl_ImageCategories.Newtbl_ImageCategoriesRow();
			}
			else
			{
				// Edit a Image Category
				DSImageCategories = bp.SelectImageCategoryByID(ImageCategoryID);
				category = DSImageCategories.tbl_ImageCategories.FindByImageCategoryID(ImageCategoryID);				
			}
			//all content to be updated/inserted between here
			category.ImageCategoryName = txtImageCategoryName.Text;
			category.ImageCategoryDescription = txtImageCategoryDescription.Text;
			category.ImageCategoryActive = chkImageCategoryActive.Checked;

			category.DateModified = DateTime.Now;
			category.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID);
			//all content to be updated/inserted between here			
			if (ImageCategoryID == 0)
			{
				//Add new Image Category
				category.ImageCategoryOrder = bp.GetImageCategoryMaxOrder();
				category.DateCreated = DateTime.Now;

				DSImageCategories.tbl_ImageCategories.Addtbl_ImageCategoriesRow(category);
			}

			bp.Update(DSImageCategories);

			Response.Redirect("BrowseImageCategories.aspx");
		}
Пример #6
0
		protected bool GetImageCategoryActiveStatus(int ImageCategoryID)
		{
			BPImageCategories bp = new BPImageCategories();
			DSImageCategories = bp.SelectImageCategoryByID(ImageCategoryID);
			BEImageCategories.tbl_ImageCategoriesRow category = DSImageCategories.tbl_ImageCategories[0];
			category = DSImageCategories.tbl_ImageCategories[0];
			return category.ImageCategoryActive;
		}
Пример #7
0
		private void BindImageCategories()
		{
			BPImageCategories bp = new BPImageCategories();
			BEImageCategories DSImageCategories = bp.SelectAllActive();
			DSImageCategories.tbl_ImageCategories.DefaultView.Sort = "ImageCategoryName";
			ddlImageCategory.DataSource = DSImageCategories.tbl_ImageCategories;
			ddlImageCategory.DataMember = "tbl_ImageCategories";
			ddlImageCategory.DataTextField = "ImageCategoryName";
			ddlImageCategory.DataValueField = "ImageCategoryID";
			ddlImageCategory.DataBind();

			ddlImageCategory.Items.Insert(0, new ListItem("Select an Image Category", "0"));
		}