/// <summary> /// default constructor /// </summary> public Productsku() { _sku = null; _productid = null; _inserttimestamp = DateTime.Now; _updatetimestamp = DateTime.Now; }
/// <summary> /// default constructor /// </summary> public ProductImage() { _imageid = 0; _productid = null; _imageurl = null; _width = 0; _height = 0; _alttext = null; _imagetype = 0; _inserttimestamp = DateTime.Now; _updatetimestamp = DateTime.Now; }
/// <summary> /// default constructor /// </summary> public BasketItem() { _basketitemid = 0; _basket = null; _product = null; _lineTaxDecimal = 0; _linePreTaxDecimal = 0; _quantity = 0; _itemtypeid = 0; _pricingstatusid = 0; _inserttimestamp = DateTime.Now; _updatetimestamp = DateTime.Now; _optionList = new ArrayList(); Status = PricingStatus.NotChecked; ItemType = BasketItemType.StandardItem; _linePreTaxMoney = null; }
protected void Page_Load(object sender, EventArgs e) { this._page = (ModuleAdminBasePage)this.Page; try { ProductID = Int32.Parse(Request.Params[PARAM_PRODUCT_ID]); Confirmed = Request.Params[PARAM_CONFIRMED]; } catch { } if (Confirmed == "true") { CatalogueViewModule controller = Module as CatalogueViewModule; if (ProductID > 0) { product = controller.CatalogueViewer.GetECommerceProduct(controller.Section.Node.Site.Id, controller.Section.Node.Culture, ProductID); ctlBreadCrumb.RenderBreadCrumbTrail(controller.CatalogueViewer.GetProductView(controller.Section.Node.Site.Id, controller.Section.Node.Culture, ProductID).BreadCrumbTrail); } string message = "The product was unable to be deleted. Please try again."; if (product != null) { product.IsPublished = false; try { controller.EditService.SaveProduct(controller.Section.Node.Site.Id, product); message = "The product was deleted successfully"; } catch (Exception ex) { message = ex.Message; } } Response.Redirect(CatalogueBrowser.GetBrowserUrlForProduct(this, controller, ProductID, message)); } else { //ask them to confirm Response.Redirect(String.Format("~/Modules/ECommerce/Admin/Catalogue/ConfirmDelete.aspx{0}", this._page.GetBaseQueryString()) + "&pid=" + ProductID); } }
public List<IRelatedProducts> GetRelatedProducts(DbProduct ep, string typeOfRelation) { List<IRelatedProducts> relatedProducts = new List<IRelatedProducts>(); using (SpHandler sph = new SpHandler("getFamilyRelatedProducts", new SqlParameter("@productID", ep.ProductID), new SqlParameter("@relationshipType", typeOfRelation))) { sph.ExecuteReader(); while (sph.DataReader.Read()) { IRelatedProducts rp = new RelatedProducts(); rp.AccessoryPartNo = sph.DataReader["itemcode"].ToString(); rp.AccessoryDescription = sph.DataReader["productdescription"].ToString(); rp.AccessoryName = sph.DataReader["productname"].ToString(); relatedProducts.Add(rp); } } return relatedProducts; }
public virtual IBasketLine AddItem(Product product, int quantity, BasketItemType itemType) { BasketItem item = new BasketItem(); item.Basket = this; item.Product = product; item.Quantity = quantity; item.ItemType = itemType; BasketItemList.Add(item); return item; }
public virtual IBasketLine AddItem(Product product, int quantity) { return AddItem(product, quantity, BasketItemType.StandardItem); }
//I don't like this. The item code version is much better. public virtual IBasketLine AddItem(Product product, System.Collections.Generic.IList<IAttributeSelection> optionList, int quantity) { BasketItem item = new BasketItem(); item.Basket = this; item.Quantity = quantity; item.Product = product; if (optionList != null) { for (int i = 0; i < optionList.Count; i++) { BasketItemAttribute attr = new BasketItemAttribute(); attr.AttributeID = optionList[i].AttributeID; attr.OptionValue = optionList[i].OptionValue; item.OptionList.Add(attr); } } BasketItemList.Add(item); return item; }
public bool SaveEditedProduct(DbProduct p, List<ProductAttributeOptionValue> paovList, List<IImage> images, List<ProductRelation> crossSellList, List<ProductDocument> documentList, List<ProductSynonym> synonymList) { bool isNewProduct = (p.ProductID == 0); CatalogueViewModule controller = Module as CatalogueViewModule; try { controller.EditService.SaveProduct(1, p); productEditor.txtProductID.Text = p.ProductID.ToString(); } catch (Exception) { return false; } if (isNewProduct) { ProductCategory pc = new ProductCategory(); pc.CategoryID = CatID; pc.ProductID = p.ProductID; pc.Product = p; if (!controller.EditService.SaveProductCategory(1, "", pc)) { return false; } } if (p.Images != null) { foreach (ProductImage pi in p.Images) { controller.EditService.DeleteProductImage(1, pi); } } if (images != null) { foreach (IImage i in images) { ProductImage pi = new ProductImage(); ImageHelper.CopyImage(i, pi); pi.ProductID = p; pi.ProductID.ProductID = p.ProductID; controller.EditService.SaveProductImage(1, pi); } } if (p.RelatedProducts != null) { foreach (ProductRelation pr in p.RelatedProducts) { controller.EditService.DeleteProductRelation(controller.Section.Node.Site.Id, pr); } } if (crossSellList != null) { foreach (ProductRelation pr in crossSellList) { controller.EditService.SaveProductRelation(1, pr); } } if (p.Documents != null) { foreach (ProductDocument d in p.Documents) { if (!controller.EditService.DeleteProductDocument(controller.Section.Node.Site.Id, controller.Section.Node.Culture, d)) { return false; } } } if (documentList != null) { foreach (ProductDocument pd in documentList) { if (!controller.EditService.SaveProductDocument(controller.Section.Node.Site.Id, controller.Section.Node.Culture, pd)) { return false; } } } if (p.Synonyms != null) { foreach (ProductSynonym ps in p.Synonyms) { if (!controller.EditService.DeleteProductSynonym(controller.Section.Node.Site.Id, controller.Section.Node.Culture, ps)) { return false; } } } if (synonymList != null) { foreach (ProductSynonym ps in synonymList) { if (!controller.EditService.SaveProductSynonym(controller.Section.Node.Site.Id, controller.Section.Node.Culture, ps)) { return false; } } } return true; }
private void btnSave_Click(object sender, EventArgs e) { ReadRequestParameters(); CatalogueViewModule controller = Module as CatalogueViewModule; DbProduct p; try { if (!string.IsNullOrEmpty(productEditor.txtProductID.Text)) { p = controller.CatalogueViewer.GetECommerceProduct(1, controller.Section.Node.Culture, Convert.ToInt64(productEditor.txtProductID.Text)); p.ProductID = Convert.ToInt64(productEditor.txtProductID.Text); } else { p = new DbProduct(); } p.ItemCode = productEditor.txtItemCode.Text; p.ProductName = productEditor.txtProductName.Text; p.ProductDescription = productEditor.fckDescription.Value; p.BasePriceDescription = productEditor.txtPriceDescription.Text; p.IsPublished = true; if (!string.IsNullOrEmpty(productEditor.txtPrice.Text)) { try { p.BasePrice = Convert.ToDecimal(productEditor.txtPrice.Text); } catch { p.BasePrice = 0; //hmmm } } else { p.BasePrice = 0; } //Kit specific items p.ShortProductDescription = productEditor.fckShortDescription.Value; p.AdditionalInformation = productEditor.fckKitComprises.Value; p.Features = productEditor.fckFeatures.Value; List<IImage> images = imageEditor.GetUpdatedImages(); List<ProductRelation> crossSellList = crossSellEditor.GetUpdatedCrossSellProducts(); List<ProductAttributeOptionValue> aList = attributeEditor.GetUpdatedAttributes(p.ProductID); List<ProductDocument> documentList = documentEditor.GetUpdatedDocuments(); List<ProductSynonym> synonymList = synonymEditor.GetUpdatedSynonyms(); if (SaveEditedProduct(p, aList, images, crossSellList, documentList, synonymList)) { //Save has removed old values, adding new ones p.SetProductAttributeValue("weight_kg", productEditor.txtWeight.Text); p.SetProductAttributeValue("finish_type", productEditor.txtFinish.Text); long catID = CatID; if (p.Categories != null && p.Categories.Count > 0) { ProductCategory cat = (ProductCategory)p.Categories[0]; catID = cat.CategoryID; } Response.Redirect(CatalogueBrowser.GetBrowserUrl(this, catID, "Product saved successfully")); } } catch (System.Threading.ThreadAbortException) { } catch (Exception f) { //Something went wrong, possibly field lengths too large LogManager.GetLogger(GetType()).Error(f); } lblSave.Text = "Your changes have failed to save"; }
public IBasketLine AddItem(IStoreContext context, Product product, IList<IAttributeSelection> optionList, int quantity) { CheckAddItemRequest(context, quantity); Basket basket = GetOrCreateBasket(context) as Basket; return basket.AddItem(product, optionList, quantity); }
public IBasketLine AddItem(IStoreContext context, Product product, int quantity) { CheckAddItemRequest(context, quantity); Basket basket = GetOrCreateBasket(context) as Basket; return basket.AddItem(product, quantity); }