protected void btnNext_Click(object sender, ImageClickEventArgs e) { List <int> list = (List <int>)Session["search"]; HiddenField ID = FormView1.FindControl("ID") as HiddenField; int id = 0; if (int.TryParse(ID.Value, out id)) { int index = list.FindIndex(x => x == id); if (index == list.Count - 1) { index = 0; } else { index = index + 1; } id = list[index]; ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); FormView1.DataSource = table.Rows; FormView1.DataBind(); ArtGalleryDS.Picture_GetWithWaterMarkDataTable table1 = PictureDL.GetWithWaterMark(id); FormView2.DataSource = table1.Rows; FormView2.DataBind(); up1.Update(); up2.Update(); } }
protected bool GenerateInvoice(int id, SpiceLogic.PayPalCtrlForWPS.Controls.BuyNowButton btnBuy, bool unframe) { ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); if (table == null || table.Rows.Count != 1) { return(false); } ArtGalleryDS.PictureRow row = table[0]; btnBuy.ItemName = row.Title + (unframe ? " (unframed)" : ""); btnBuy.ItemNumber = id.ToString(); if (!unframe) { Calculate(btnBuy, row.Width, row.Height, row.Frame, row.weight); } else { btnBuy.Height = (int)Math.Ceiling(Math.Min(row.Width, row.Height)); btnBuy.Width = 3; btnBuy.Handling = 10; btnBuy.Weight = (decimal)2.0; btnBuy.AdditionalDataItems["strongbox"] = "none needed"; } btnBuy.ItemNumber = id.ToString(); btnBuy.AdditionalDataItems["unframed"] = unframe.ToString().ToLower(); btnBuy.AdditionalDataItems["width"] = "0"; btnBuy.AdditionalDataItems["height"] = "0"; btnBuy.Amount = (decimal)row.price; return(true); }
private void ProcessPicture(int id) { ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); FormView1.DataSource = table.Rows; FormView1.DataBind(); ArtGalleryDS.Picture_GetWithWaterMarkDataTable table1 = PictureDL.GetWithWaterMark(id); FormView2.DataSource = table1.Rows; FormView2.DataBind(); }
protected void Page_PreRender(object sender, EventArgs e) { if (Session["search"] != null) { List <int> list = Session["search"] as List <int>; string strlist = ""; foreach (int item in list) { strlist += item.ToString() + ","; } ArtGalleryDS.PictureDataTable newtable = SearchWordDL.GetByList(strlist.Substring(0, strlist.Length - 1)); if (newtable.Rows.Count > 0) { lblSearch.Text = "Search Results"; ListView1.DataSource = newtable.Rows; ListView1.DataBind(); return; } } string id = Request.QueryString["id"]; if (string.IsNullOrWhiteSpace(id)) { lblSearch.Text = "No Results Found"; return; } ArtGalleryDS.PictureDataTable table = SearchWordDL.Get(HttpUtility.UrlDecode(id)); if (table.Rows.Count == 0) { lblSearch.Text = "No Results Found"; } else { lblSearch.Text = "Search Results"; ListView1.DataSource = table.Rows; ListView1.DataBind(); List <int> list = new List <int>(); foreach (ArtGalleryDS.PictureRow row in table) { list.Add(row.id); } Session["search"] = list; } }
public static ArtGalleryDS.OrphanPictureDataTable GetOrphanPicture() { ArtGalleryDS.PictureDataTable table = PictureDL.Get(); ArtGalleryDS.OrphanPictureDataTable missing = new ArtGalleryDS.OrphanPictureDataTable(); string[] files = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/App_Data")); foreach (string file in files) { FileInfo fi = new FileInfo(file); string filename = fi.Name; if (filename == "Missing.jpg" || filename == "artgallery.p12" || filename == "paypal_cert_pem.txt") { continue; } var query = from p in table where filename.ToUpper() == p.PicturePath.ToUpper() select p.PicturePath; if (query.Count() == 0) { object[] missingfile = new object[1]; missingfile[0] = filename; missing.Rows.Add(missingfile); } } return(missing); }