internal void init_fitment(string header, string value) { if (value != "" & value != null) { switch (header.ToUpper().Replace(" ", "")) { case "SKU": { sku = value; break; } case "YEAR": { year = Convert.ToInt16(value); break; } case "SUBMODEL": { submodel = value; break; } case "_BODYNUMDOORS_": { body_num_doors = Convert.ToInt16(value); break; } case "BRAND": { BrandName brand = new BrandName(); brand.name = value; using (var db = new ProductDBEntitie()) { try { db.BrandName.Add(brand); db.SaveChanges(); } catch { brand = (from c in db.BrandName where c.name.Equals(value) select c).First(); } } id_brand_name = brand.id; BrandName = brand; break; } case "AVAILABLE": { available = value; break; } case "AVAILABLE1": { available1 = value; break; } case "AVAILABLE2": { available2 = value; break; } case "FITMENTNOTE": { fitment_note = value; break; } case "OURREALMODEL": { our_real_model = value; break; } case "PROCESSING": { processing = Convert.ToBoolean(value); break; } case "NUMDOOR": { num_door = value; break; } case "LENGTH_B": { length = value; break; } case "MMY": { mmy = value; break; } } } }
public bool init_product(String header, String value) { if (value != "" & value != null) { switch (header.ToUpper().Replace(" ", "")) { case "SKU": { sku = value; return(true); } case "COREDEPOSIT": { core_deposit = value; return(true); } case "CFSHIPPING": { cf_shipping = value; return(true); } case "SBOX": { sbox = value; return(true); } case "AVAILABLE": { available = value; return(true); } case "BRANDNAME": { BrandName brand = new BrandName(); brand.name = value; using (var db = new ProductDBEntitie()) { try { db.BrandName.Add(brand); db.SaveChanges(); } catch { brand.id = (from c in db.BrandName where c.name.Equals(value) select c.id).SingleOrDefault(); } } id_brand_name = brand.id; BrandName = brand; return(true); } case "PACKAGE": { package = value; return(true); } case "PRICE": { price = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "HEIGHT": { height = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "LENGTH": { length = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "WIDTH": { width = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "WEIGHT": { weight = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "UPC": { upc = Convert.ToInt64(value); return(true); } case "INSTOCK": { in_stock = value; return(true); } case "MAINPRODUCT": { main_product = value; return(true); } case "VENDORID": { vendor_id = Convert.ToInt32(value); return(true); } } } return(false); }