private void BindProductLineDdl() { using (SpHandler sph = new SpHandler("getProductLines")) { ddlProductLine.Items.Clear(); ddlProductLine.Items.Add(new ListItem("--- select---", CAT_ID_NONE)); sph.ExecuteReader(); while (sph.DataReader.Read()) { ddlProductLine.Items.Add(new ListItem(sph.DataReader[1].ToString(), sph.DataReader[0].ToString())); } } }
public decimal GetMinimumDeliveryCharge(string countryCode) { using (SpHandler sph = new SpHandler("getMinimumDeliveryCharge", new SqlParameter("@chargeName", MINIMUM_DELIVERY_CHARGE), new SqlParameter("@countryCode", countryCode))) { sph.ExecuteReader(); if (sph.DataReader.Read()) { string val = sph.DataReader["Price"] as string; if (!string.IsNullOrEmpty(val)) { return Convert.ToDecimal(val); } } } return 0; }
private decimal GetDeliveryChargeByWeight(string countryCode, decimal weight) { try { using (SpHandler sph = new SpHandler("getDeliveryChargeByWeight", new SqlParameter("@countrycode", countryCode), new SqlParameter("@weight", weight))) { object o = sph.ExecuteScalar(); if (o != null) { return Convert.ToDecimal(o); } } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } return 0; }
private decimal GetProductPriceChange(long productID) { try { using (SpHandler sph = new SpHandler("getProductPriceChange", new SqlParameter("@productID", productID))) { object o = sph.ExecuteScalar(); if (o != null) { return Convert.ToDecimal(o); } } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } return 0; }
public virtual int GetECommerceSectionId(int siteId) { int sectionId = 0; try { using (SpHandler sph = new SpHandler("getECommerceSectionId")) { sph.AddInParameter("siteId", DbType.Int32, 1, siteId); sph.ExecuteReader(); while (sph.DataReader.Read()) { sectionId = Convert.ToInt32(sph.DataReader["sectionID"]); } } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } return sectionId; }
private List<CategoryNode> GetProductCategories() { try { List<CategoryNode> categoryList = new List<CategoryNode>(); using (SpHandler sph = new SpHandler("getProductLines")) { sph.ExecuteReader(); while (sph.DataReader.Read()) { CategoryNode c = new CategoryNode(); c.NodeID = Convert.ToInt64(sph.DataReader["categoryID"]); c.Name = sph.DataReader["categoryName"] as string; categoryList.Add(c); } return categoryList; } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } return null; }
public Image GetImageById(long id) { Image image = new Image(); using (SpHandler sph = new SpHandler("Sp_GetImageByItemID", new SqlParameter("@ID", id))) { sph.ExecuteReader(); while (sph.DataReader.Read()) { image.Url = sph.DataReader["imageUrl"].ToString(); image.Width = Convert.ToInt16(sph.DataReader["width"]); image.Height = Convert.ToInt16(sph.DataReader["height"]); image.AltText = sph.DataReader["altText"].ToString(); } } return image; }
public Image GetImageByItemCode(int storeID, string cultureCode, string itemCode) { Image image = new Image(); using (SpHandler sph = new SpHandler("Sp_GetImageByItemCode", new SqlParameter("@itemCodeID", itemCode))) { sph.ExecuteReader(); while (sph.DataReader.Read()) { image.Url = sph.DataReader["imageUrl"].ToString(); image.Width = Convert.ToInt16(sph.DataReader["width"]); image.Height = Convert.ToInt16(sph.DataReader["height"]); image.AltText = sph.DataReader["altText"].ToString(); } } return image; }
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 List<IActiveProductAttribute> GetProductAttributes(IProduct ep) { List<IActiveProductAttribute> attributeList = new List<IActiveProductAttribute>(); IActiveProductAttribute active = null; int lastAttributeID = 0; //Replaced with a stored procedure to make it far, far quicker using (SpHandler sph = new SpHandler("getProductAttributes", new SqlParameter("@productID", ep.ProductID))) { sph.ExecuteReader(); while (sph.DataReader.Read()) { int attributeID = Convert.ToInt32(sph.DataReader["attributeID"]); //Create a new attribute as it is found. Relies on values returned grouped by attributeid if (attributeID != lastAttributeID) { active = new ActiveProductAttribute(); active.DataType = Convert.ToString(sph.DataReader["type"]); active.BaseUnit = Convert.ToString(sph.DataReader["baseUnit"]); active.Name = Convert.ToString(sph.DataReader["attributeDescription"]); lastAttributeID = attributeID; } if (active != null) { //Add options to the current attribute IAttributeOption option = new AttributeOption(); option.PickListValue = Convert.ToString(sph.DataReader["optionName"]); option.ShortCode = Convert.ToString(sph.DataReader["optionID"]); option.Url = Convert.ToString(sph.DataReader["optionData"]); option.Price = Convert.ToDecimal(sph.DataReader["optionPrice"]); active.AttributeOptionList.Add(option); } } } return attributeList; }
public int GetProductCount(int storeID, string cultureCode, long nodeID) { int count = 0; try { using (SpHandler sph = new SpHandler("getProductCount", new SqlParameter("@categoryID", nodeID))) { sph.ExecuteReader(); IDataReader record = sph.DataReader; while (record.Read()) { count = Convert.ToInt32(record["productCount"]); } } } catch (Exception ex) { LogManager.GetLogger(GetType()).Error(ex); } return count; }
public void SaveProductPriceChange(long productID, decimal price) { try { using (SpHandler sph = new SpHandler("saveProductPriceChange", new SqlParameter("@productID", productID), new SqlParameter("@newPrice", price))) { object o = sph.ExecuteScalar(); } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } }
private string GetProductLine(IProductSummary summary) { //This really isn't very efficient! try { using (SpHandler sph = new SpHandler("getProductLineForProduct", new SqlParameter("@productID", summary.ProductID))) { sph.ExecuteReader(); if (sph.DataReader.Read()) { return sph.DataReader["categoryname"].ToString(); } } } catch (Exception f) { LogManager.GetLogger(GetType()).Error(f); } return ""; }
//TODO public List<IPaymentProvider> GetEnabledPaymentProviders() { List<IPaymentProvider> providers = new List<IPaymentProvider>(); using (SpHandler sph = new SpHandler("getPaymentProviders")) { sph.ExecuteReader(); while (sph.DataReader.Read()) { int attributeID = Convert.ToInt32(sph.DataReader["attributeID"]); } } return providers; }
public static string GetProductAttributeValueByReference(long productID, string attributeReference) { try { using (SpHandler sph = new SpHandler("getProductAttributeValueByReference", new SqlParameter("@productID", productID), new SqlParameter("@attributeReference", GetCleanReference(attributeReference)))) { sph.ExecuteReader(); if (sph.DataReader.Read()) { return sph.DataReader["optionname"] as string; } } } catch (Exception e) { LogManager.GetLogger(typeof(Product)).Error(e); } return ""; }
public static void SetProductAttributeValueByReference(long productID, string attributeReference, string attributeValue) { try { using (SpHandler sph = new SpHandler("setProductAttributeValueByReference", new SqlParameter("@productID", productID), new SqlParameter("@attributeReference", GetCleanReference(attributeReference)), new SqlParameter("@attributeValue", attributeValue.Trim()))) { sph.ExecuteNonQuery(); } } catch (Exception e) { LogManager.GetLogger(typeof(Product)).Error(e); } }
public static string GetObjectPrefix(string dataSourceName, string ownerName) { using (SpHandler dbh = new SpHandler()) { dbh.ConnectionString = GetConnectionString(dataSourceName); if (dbh.ConnectionString.Length == 0) { dbh.ConnectionString = GetConnectionString(); } string databaseName = "[" + dbh.Command.Connection.Database + "]"; return databaseName + "." + ownerName + "."; } }