protected void BindImages() { BPImages bpu = new BPImages(); DSImages = new BEImages(); if (ddlImageCategories.SelectedValue != "-1") { DSImages.Merge(bpu.SelectAllByImageCategoryID(Convert.ToInt32(ddlImageCategories.SelectedValue))); } else { DSImages.Merge(bpu.SelectAllWithImageCategories()); } int ImageCategoryID = -1; Boolean blnNew = true; ddlImages.Items.Clear(); ddlImages.Items.Add(new ListItem("No Image", "0")); foreach(DataRow dr in DSImages.tbl_Images.Rows) { if ((int) dr["ImageCategoryID"] != ImageCategoryID) { ImageCategoryID = (int) dr["ImageCategoryID"]; blnNew = true; } if (blnNew) { ddlImages.Items.Add(new ListItem("-- " + dr["ImageCategoryName"] + " --", "")); blnNew = false; } ddlImages.Items.Add(new ListItem(HttpUtility.HtmlDecode(" ") + dr["ImageAlias"].ToString(), dr["ImageID"].ToString())); } if (SelectedImage != 0) { ddlImages.SelectedValue = SelectedImage.ToString(); } }
protected void BindImages() { BPImages bpu = new BPImages(); DSImages = new BEImages(); if (FilterID != -1 && FilterID != 0) { DSImages.Merge(bpu.SelectAllByImageCategoryID(FilterID)); } else { DSImages.Merge(bpu.SelectAllWithImageCategories()); } int ImageCategoryID = -1; Boolean blnNew = true; StringBuilder returnImages = new StringBuilder(10000); returnImages.Append("none,No Image|"); foreach(DataRow dr in DSImages.tbl_Images.Rows) { if ((int) dr["ImageCategoryID"] != ImageCategoryID) { ImageCategoryID = (int) dr["ImageCategoryID"]; blnNew = true; } if (blnNew) { returnImages.Append(",-- " + dr["ImageCategoryName"] + " --|"); blnNew = false; } returnImages.Append(dr["ImageID"].ToString() + "," + HttpUtility.HtmlDecode(" ") + dr["ImageAlias"].ToString() + "|"); } lblScript.Text = "<script Language=\"Javascript\">window.parent.handleResponse('" + returnImages + "', 'Image')</script>"; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); BEImages ds = new BEImages(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "tbl_ImagesDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { BEImages ds = new BEImages(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
protected string GetImageName(object strImageID, string prefix) { if (!Convert.IsDBNull(strImageID)) { int ImageID = Convert.ToInt32(strImageID); BPImages bpImages = new BPImages(); DSImages = bpImages.SelectAll(); BEImages.tbl_ImagesRow row = DSImages.tbl_Images.FindByImageID(ImageID); if (row != null) { return "Uploads/" + prefix + row.ImageName; } else { return ""; } } else { return ""; } }
public virtual int Update(BEImages.tbl_ResizeInfoDataTable dataTable) { return this.Adapter.Update(dataTable); }
public virtual int Update(BEImages dataSet) { return this.Adapter.Update(dataSet, "tbl_ResizeInfo"); }
public virtual int Fill(BEImages.tbl_ResizeInfoDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; }
public virtual int Update(BEImages dataSet) { return this.Adapter.Update(dataSet, "tbl_ImageCategories"); }
public virtual int Update(BEImages.tbl_ImageCategoriesDataTable dataTable) { return this.Adapter.Update(dataTable); }
private void Page_Load(object sender, EventArgs e) { this.AuthenticatePage(new string[] {PermissionLevels.EditImages, PermissionLevels.AddImages, PermissionLevels.ViewImages}); if (ImageID > 0) { if (this.CarrielUser.RolePermission(PermissionLevels.EditImages) != 2) { btnSubmit.Visible = false; btnDelete.Visible = false; } else { btnSubmit.Visible = true; btnDelete.Visible = true; } } else { if (this.CarrielUser.RolePermission(PermissionLevels.AddImages) != 2) { btnSubmit.Visible = false; } } if (IsNewSession) { AddToListIfAdmin(); IsNewSession = false; } if (!Page.IsPostBack) { BindImageCategories(); BPImages bp = new BPImages(); if (ImageID != 0) { DSImages = bp.SelectByID(ImageID); Image = DSImages.tbl_Images.FindByImageID(ImageID); //ddlExtranetClients.SelectedValue = Image.ClientID.ToString(); lblImageName.Text = Image.ImageName.ToString(); txtAlias.Text = Image.ImageAlias; chkSingle.Checked = Image.ImageActive; txtDesc.Text = (Image.IsImageDescriptionNull())? string.Empty : Image.ImageDescription; if (ddlImageCategory.Items.FindByValue(Image.ImageCategoryID.ToString()) != null) { ddlImageCategory.SelectedValue = Image.ImageCategoryID.ToString(); } lblTitle.Text = "Edit Image - " + Image.ImageAlias; } else { btnDelete.Visible = false; lblTitle.Text = "Upload Image"; } } }
// private void ddlCategories_SelectedIndexChanged(object sender, System.EventArgs e) // { // BindSubCategories(); // } private void btnDelete_Click(object sender, EventArgs e) { BPImages bp = new BPImages(); BEImages.tbl_ImagesRow Image; DSImages = bp.SelectByID(ImageID); Image = DSImages.tbl_Images.FindByImageID(ImageID); // File.Delete(Server.MapPath(@"\Uploads\" + Image.ImageName)); File.Delete(Server.MapPath(@System.Configuration.ConfigurationSettings.AppSettings["UploadsPath"] + Image.ImageName)); Image.Delete(); bp.Update(DSImages); //remove all instances of this image in Products BPProducts bpProducts = new BPProducts(); bpProducts.RemoveImagesByImageID(ImageID); Response.Redirect("BrowseImages.aspx"); }