protected void uiDataListPhotos_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Delete") { PartySupplierImages image = new PartySupplierImages(); image.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); image.MarkAsDeleted(); image.Save(); BindImages(); ClientScript.RegisterStartupScript(this.GetType(), "selectTab", "$(document).ready(function (){ $('#myTab a[href=\"#t-2\"]').tab('show'); $('#myTab a[href=\"#t-1\"]').removeClass('active'); $('#myTab a[href=\"#t-2\"]').addClass('active'); });", true); } }
protected void uiButtonSaveText_Click(object sender, EventArgs e) { if (uiFileUploadProdImage.HasFile) { PartySupplierImages image = new PartySupplierImages(); image.AddNew(); image.CardID = CurrentCard.CardID; string path = "/images/ProductImages/" + uiFileUploadProdImage.FileName; uiFileUploadProdImage.SaveAs(Server.MapPath("~" + path)); image.ImagePath = path; image.Save(); BindImages(); } ClientScript.RegisterStartupScript(this.GetType(), "selectTab", "$(document).ready(function (){ $('#myTab a[href=\"#t-2\"]').tab('show'); $('#myTab a[href=\"#t-1\"]').removeClass('active'); $('#myTab a[href=\"#t-2\"]').addClass('active'); });", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CardID != 0) { Cards card = new Cards(); card.LoadByPrimaryKey(CardID); uiLabelName.Text = card.CardNameEng; uiLabelPriceFrom.Text = card.PriceBefore.ToString(); if (card.PriceBefore == 0 || (card.PriceBefore <= card.PriceNow)) uiPlaceholderPriceFrom.Visible = false; else uiPlaceholderPriceFrom.Visible = true; uiLabelPriceTo.Text = card.PriceNow.ToString(); uiImagemain.ImageUrl = card.GeneralPreviewPhoto; uiLabelDate.Text = card.UploadDate.ToString("dd/MM/yyyy"); uiLiteralDesc.Text = card.DescriptionEng; if (card.IsPartySupplier) { uipanelIsCard.Visible = false; uiLinkButtonCustomize.Visible = false; uiLinkButtonAddToCart.Visible = true; uipanelImages.Visible = true; uiImagemain.Visible = false; PartySupplierImages images = new PartySupplierImages(); images.Where.CardID.Value = card.CardID; images.Where.CardID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; images.Query.Load(); images.AddNew(); images.CardID = card.CardID; images.ImagePath = card.GeneralPreviewPhoto; uiRepeaterImages.DataSource = images.DefaultView; uiRepeaterImages.DataBind(); uiRepeaterthumbs.DataSource = images.DefaultView; uiRepeaterthumbs.DataBind(); } else { uipanelImages.Visible = false; CardColor colors = new CardColor(); colors.GetCardColorsByCardID(card.CardID); uiRepeaterColor.DataSource = colors.DefaultView; uiRepeaterColor.DataBind(); uiLinkButtonCustomize.PostBackUrl = "customize.aspx?cid=" + card.CardID; } BindReviews(); Master.PageTitle = card.CardNameEng; Categories cat = new Categories(); cat.LoadByPrimaryKey(card.CategoryID); MainCat mcat = new MainCat(); mcat.LoadByPrimaryKey(cat.MainCatId); TopLevelCat tcat = new TopLevelCat(); tcat.LoadByPrimaryKey(mcat.TopLevelCatID); Master.Path = "<li><a href='#'>" + tcat.NameEng + "</a></li>" + "<li><a href='#'>" + mcat.NameEng + "</a></li>"; Master.ViewPath = true; } else { Response.Redirect("~/browse.aspx"); } } }
private void BindImages() { PartySupplierImages images = new PartySupplierImages(); images.Where.CardID.Value = CurrentCard.CardID; images.Where.CardID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; images.Query.Load(); uiDataListPhotos.DataSource = images.DefaultView; uiDataListPhotos.DataBind(); }