public bool init_product(String header, String value, ref Additionally0 additionally0) { if (!init_product(header, value)) { if (value != "" & value != null) { switch (header) { case "SHIPPINGTYPE": { additionally0.shipping_type = value; return(true); } case "Templates": { Template temp = new Template(); temp.name = value; using (var db = new ProductDBEntitie()) { try { db.Template.Add(temp); db.SaveChanges(); } catch { temp = (from c in db.Template where c.name.Equals(value) select c).First(); } } additionally0.id_template = temp.id; return(true); } case "Core": { additionally0.core = Convert.ToDouble(value.Replace(".", ",")); return(true); } case "Valid": { additionally0.valid = Convert.ToBoolean(value); return(true); } case "DATA SOURCE": { additionally0.data_source = value; return(true); } } } } return(false); }
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); }