public bool CreateNewBrand(string Brand) { tbl_Brand obj = new tbl_Brand(); obj.Brand = Brand; return(BrandName.CreateNewBrand(obj)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (BrandName != null) { hashCode = hashCode * 59 + BrandName.GetHashCode(); } if (ModelName != null) { hashCode = hashCode * 59 + ModelName.GetHashCode(); } if (FrameType != null) { hashCode = hashCode * 59 + FrameType.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } return(hashCode); } }
void ReleaseDesignerOutlets() { if (BrandName != null) { BrandName.Dispose(); BrandName = null; } if (CountryField != null) { CountryField.Dispose(); CountryField = null; } if (AddButton != null) { AddButton.Dispose(); AddButton = null; } if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } }
/// <summary> /// Returns true if DetailedGear instances are equal /// </summary> /// <param name="other">Instance of DetailedGear to be compared</param> /// <returns>Boolean</returns> public bool Equals(DetailedGear other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BrandName == other.BrandName || BrandName != null && BrandName.Equals(other.BrandName) ) && ( ModelName == other.ModelName || ModelName != null && ModelName.Equals(other.ModelName) ) && ( FrameType == other.FrameType || FrameType != null && FrameType.Equals(other.FrameType) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) )); }
//Comparing by Name public int CompareTo(BrandModel other) { int output = 5; output = BrandName.CompareTo(other.BrandName); return(output); }
public void GetBrandById_should_return_expected_item() { // When var result = brandsDataService.GetBrandById(1); // Then result !.BrandName.Should().BeEquivalentTo("IT Skills Pathway"); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ProductId != null) { hashCode = hashCode * 59 + ProductId.GetHashCode(); } if (EffectiveFrom != null) { hashCode = hashCode * 59 + EffectiveFrom.GetHashCode(); } if (EffectiveTo != null) { hashCode = hashCode * 59 + EffectiveTo.GetHashCode(); } if (LastUpdated != null) { hashCode = hashCode * 59 + LastUpdated.GetHashCode(); } if (ProductCategory != null) { hashCode = hashCode * 59 + ProductCategory.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (Brand != null) { hashCode = hashCode * 59 + Brand.GetHashCode(); } if (BrandName != null) { hashCode = hashCode * 59 + BrandName.GetHashCode(); } if (ApplicationUri != null) { hashCode = hashCode * 59 + ApplicationUri.GetHashCode(); } if (IsTailored != null) { hashCode = hashCode * 59 + IsTailored.GetHashCode(); } if (AdditionalInformation != null) { hashCode = hashCode * 59 + AdditionalInformation.GetHashCode(); } return(hashCode); } }
public BrandName GetBrandNameById(int id) { BrandName brandname = databasePlaceholder.Get(id); if (brandname == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(brandname); }
public override string ToString() { var ToReturn = BrandName.Trim(); if (!string.IsNullOrWhiteSpace(Strength)) { ToReturn += " " + Strength.Trim(); } if (!string.IsNullOrWhiteSpace(Form)) { ToReturn += " " + Form.Trim(); } return(ToReturn); }
public override int GetHashCode() { unchecked { int hash = 17; hash = (hash * 23) + Id.GetHashCode(); hash = (hash * 23) + BrandName.GetHashCode(); hash = (hash * 23) + Model.GetHashCode(); hash = (hash * 23) + Horsepower.GetHashCode(); hash = (hash * 23) + Generation.GetHashCode(); hash = (hash * 23) + ProdutionDate.GetHashCode(); hash = (hash * 23) + BrandId.GetHashCode(); return(hash); } }
public IActionResult Create(AddSneakerViewModel vm) { Brand br = new Brand { Name = vm.Brand }; context.Brands.Add(br); BrandName bName = new BrandName { Name = vm.BrandName, Brand = br }; context.BrandNames.Add(bName); Style stl = new Style { Name = vm.Style, BrandName = bName }; context.Styles.Add(stl); ColorWay cWay = new ColorWay { Name = vm.Colorway, Style = stl }; context.Colorways.Add(cWay); return(View()); }
private void DataTable_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { TextBox t = e.EditingElement as TextBox; String value = t.Text.ToString(); String header = e.Column.Header.ToString(); var sku = (e.Row.DataContext as Product).sku; /// additionally additionally0 /// if (sku != null) { using (var db = new ProductDBEntitie()) { var product = (from c in db.Product where c.sku == sku select c).FirstOrDefault(); if (product != null) { var additionally = (from c in db.Additionally where c.id == product.id_additionally select c).FirstOrDefault(); var additionally0 = (from c in db.Additionally0 where c.id == product.id_additionally0 select c).FirstOrDefault(); if (additionally == null) { additionally = new Additionally(); db.Additionally.Add(additionally); db.SaveChanges(); product.id_additionally = additionally.id; db.SaveChanges(); } Resource res = (from c in db.Resource where c.id == additionally.id_resource select c).FirstOrDefault(); if (header.Equals("IMG_1")) { res.img1 = value; } if (header.Equals("IMG_2")) { res.img2 = value; } if (header.Equals("IMG_3")) { res.img3 = value; } if (header.Equals("IMG_4")) { res.img4 = value; } if (header.Equals("PDF_1")) { res.pdf = value; } if (header.Equals("Icon")) { res.pdf = value; } db.Resource.Add(res); db.SaveChanges(); additionally.Resource = res; additionally.id_resource = res.id; db.SaveChanges(); if (additionally0 == null) { additionally0 = new Additionally0(); db.Additionally0.Add(additionally0); db.SaveChanges(); product.id_additionally0 = additionally0.id; db.SaveChanges(); } var forName = (from c in db.ForName where c.id == additionally0.id_forname select c).FirstOrDefault(); if (header == "FORNAME1") { forName.forname1 = value; try { db.ForName.Add(forName); db.SaveChanges(); } catch { string str = value; forName = (from c in db.ForName where c.forname2.Equals(str) select c).FirstOrDefault(); } additionally0.id_forname = forName.id; additionally0.ForName = (ForName)forName; db.SaveChanges(); return; } if (header == "FORNAME2") { forName.forname2 = value; try { db.ForName.Add(forName); db.SaveChanges(); } catch { string str = value; forName = (from c in db.ForName where c.forname2.Equals(str) select c).FirstOrDefault(); } additionally0.id_forname = forName.id; additionally0.ForName = (ForName)forName; db.SaveChanges(); return; } try { if (!product.init_product(header, t.Text.ToString(), ref additionally0)) { product.init_product(header, value, ref additionally); } } catch (Exception ee) { MessageBox.Show(ee.Message); } BrandName b = product.BrandName; product.BrandName = null; db.SaveChanges(); product.BrandName = b; } } } else { SetSKU setSKU = new SetSKU(products); setSKU.ShowDialog(); } }
private void init_fitment() { fitment = new Fitment(); Make make = new Make(); string[] values = lines[i].Split('|'); for (int j = 0; j < values.Count(); j++) { if (headers[j] == "Make") { make.make1 = values[j]; } else if (headers[j] == "Model") { make.model = values[j]; } else if (headers[j] == "ourMake") { make.our_make = values[j]; } else if (headers[j] == "ourMake") { make.our_make = values[j]; } else if (headers[j] == "ourModel") { make.our_model = values[j]; } else if (headers[j] == "_BodyTypeName_") { make.body_type_name = values[j]; } else if (headers[j] == "_MfrBodyCodeName_") { make.mf_body_code_name = values[j]; } else if (headers[j] == "ourBodyTypeName") { make.our_body_type_name = values[j]; } else { try { fitment.init_fitment(headers[j], values[j]); } catch { } } } using (var db = new ProductDBEntitie()) { try { var make_ = (from c in db.Make where c.make1 == make.make1 && c.model == make.model && c.our_make == make.our_make && c.body_type_name == make.body_type_name select c).ToList(); if (make_.Count() == 0) { db.Make.Add(make); db.SaveChanges(); fitment.id_make = make.id; fitment.Make = make; } else { fitment.id_make = make_.First().id; fitment.Make = make_.First(); } } catch { } fitment.Product = (from c in db.Product where c.sku == fitment.sku select c).FirstOrDefault(); try { BrandName brand = fitment.BrandName; fitment.BrandName = null; Make m = fitment.Make; fitment.Make = null; db.Fitment.Add(fitment); db.SaveChanges(); fitment.Make = m; fitment.BrandName = brand; } catch (Exception e) { } } }
/// <summary> /// Returns true if BankingProduct instances are equal /// </summary> /// <param name="other">Instance of BankingProduct to be compared</param> /// <returns>Boolean</returns> public bool Equals(BankingProduct other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ProductId == other.ProductId || ProductId != null && ProductId.Equals(other.ProductId) ) && ( EffectiveFrom == other.EffectiveFrom || EffectiveFrom != null && EffectiveFrom.Equals(other.EffectiveFrom) ) && ( EffectiveTo == other.EffectiveTo || EffectiveTo != null && EffectiveTo.Equals(other.EffectiveTo) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) ) && ( ProductCategory == other.ProductCategory || ProductCategory != null && ProductCategory.Equals(other.ProductCategory) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) ) && ( Brand == other.Brand || Brand != null && Brand.Equals(other.Brand) ) && ( BrandName == other.BrandName || BrandName != null && BrandName.Equals(other.BrandName) ) && ( ApplicationUri == other.ApplicationUri || ApplicationUri != null && ApplicationUri.Equals(other.ApplicationUri) ) && ( IsTailored == other.IsTailored || IsTailored != null && IsTailored.Equals(other.IsTailored) ) && ( AdditionalInformation == other.AdditionalInformation || AdditionalInformation != null && AdditionalInformation.Equals(other.AdditionalInformation) )); }
public IActionResult GetFilter( int page_index, int page_size, [FromQuery(Name = "BrandId")] int[] BrandId, [FromQuery(Name = "ProductColor")] string[] ProductColor, [FromQuery(Name = "_TypeId")] int[] _TypeId, [FromQuery(Name = "CollectionId")] int[] CollectionId, [FromQuery(Name = "CategoryId")] int[] CategoryId ) { IQueryable <Complete_Product> res = null; var result = _context.Products.Select(m => m); List <dynamic> FiltersList = new List <dynamic>(); foreach (string item in ProductColor) { var LProductColor = (from p in _context.Products where p.ProductColor == item group p by p.ProductColor into Color select new { Productcolor = Color.First().ProductColor }); FiltersList.Add(LProductColor); } foreach (int item in BrandId) { var LBrandName = from b in _context.Brands where b.Id == item group b by b.BrandName into BrandName select new { Brandname = BrandName.First().BrandName }; FiltersList.Add(LBrandName); } foreach (int item in _TypeId) { var LTypeName = from t in _context.Types where t.Id == item group t by t._TypeName into TypeName select new { Typename = TypeName.First()._TypeName }; FiltersList.Add(LTypeName); } foreach (int item in CategoryId) { var LCategoryName = from cat in _context.Categories where cat.Id == item group cat by cat.CategoryName into CategoryName select new { Categoryname = CategoryName.First().CategoryName }; FiltersList.Add(LCategoryName); } foreach (int item in CollectionId) { var LCollectionName = from c in _context.Collections where c.Id == item group c by c.CollectionName into CollectionName select new { Collectionname = CollectionName.First().CollectionName }; FiltersList.Add(LCollectionName); } if (BrandId.Length != 0) { result = result.Where(m => BrandId.Contains(m.BrandId)); res = from p in result let image = (from i in _context.ProductImages where p.Id == i.ProductId select i.ImageURL).ToArray() let type = (from t in _context.Types where p._TypeId == t.Id select t._TypeName) let category = (from cat in _context.Categories where p.CategoryId == cat.Id select cat.CategoryName) let collection = (from c in _context.Collections where p.CollectionId == c.Id select c.CollectionName) let brand = (from b in _context.Brands where p.BrandId == b.Id select b.BrandName) let stock = (from s in _context.Stock where p.StockId == s.Id select s.ProductQuantity) select new Complete_Product() { Product = p, Images = image, Type = type, Category = category, Collection = collection, Brand = brand, Stock = stock }; } if (ProductColor.Length != 0) { result = result.Where(m => ProductColor.Contains(m.ProductColor)); res = from p in result let image = (from i in _context.ProductImages where p.Id == i.ProductId select i.ImageURL).ToArray() let type = (from t in _context.Types where p._TypeId == t.Id select t._TypeName) let category = (from cat in _context.Categories where p.CategoryId == cat.Id select cat.CategoryName) let collection = (from c in _context.Collections where p.CollectionId == c.Id select c.CollectionName) let brand = (from b in _context.Brands where p.BrandId == b.Id select b.BrandName) let stock = (from s in _context.Stock where p.StockId == s.Id select s.ProductQuantity) select new Complete_Product() { Product = p, Images = image, Type = type, Category = category, Collection = collection, Brand = brand, Stock = stock }; } if (_TypeId.Length != 0) { result = result.Where(m => _TypeId.Contains(m._TypeId)); res = from p in result let image = (from i in _context.ProductImages where p.Id == i.ProductId select i.ImageURL).ToArray() let type = (from t in _context.Types where p._TypeId == t.Id select t._TypeName) let category = (from cat in _context.Categories where p.CategoryId == cat.Id select cat.CategoryName) let collection = (from c in _context.Collections where p.CollectionId == c.Id select c.CollectionName) let brand = (from b in _context.Brands where p.BrandId == b.Id select b.BrandName) let stock = (from s in _context.Stock where p.StockId == s.Id select s.ProductQuantity) select new Complete_Product() { Product = p, Images = image, Type = type, Category = category, Collection = collection, Brand = brand, Stock = stock }; } if (CategoryId.Length != 0) { result = result.Where(m => CategoryId.Contains(m.CategoryId)); res = from p in result let image = (from i in _context.ProductImages where p.Id == i.ProductId select i.ImageURL).ToArray() let type = (from t in _context.Types where p._TypeId == t.Id select t._TypeName) let category = (from cat in _context.Categories where p.CategoryId == cat.Id select cat.CategoryName) let collection = (from c in _context.Collections where p.CollectionId == c.Id select c.CollectionName) let brand = (from b in _context.Brands where p.BrandId == b.Id select b.BrandName) let stock = (from s in _context.Stock where p.StockId == s.Id select s.ProductQuantity) select new Complete_Product() { Product = p, Images = image, Type = type, Category = category, Collection = collection, Brand = brand, Stock = stock }; } if (CollectionId.Length != 0) { result = result.Where(m => CollectionId.Contains(m.CollectionId)); res = from p in result let image = (from i in _context.ProductImages where p.Id == i.ProductId select i.ImageURL).ToArray() let type = (from t in _context.Types where p._TypeId == t.Id select t._TypeName) let category = (from cat in _context.Categories where p.CategoryId == cat.Id select cat.CategoryName) let collection = (from c in _context.Collections where p.CollectionId == c.Id select c.CollectionName) let brand = (from b in _context.Brands where p.BrandId == b.Id select b.BrandName) let stock = (from s in _context.Stock where p.StockId == s.Id select s.ProductQuantity) select new Complete_Product() { Product = p, Images = image, Type = type, Category = category, Collection = collection, Brand = brand, Stock = stock }; } int totalitems = res.Count(); int totalpages = totalitems / page_size; //totalpages+1 because the first page is 1 and not 0 totalpages = totalpages + 1; // string Error = "No product that fullfill these filters"; // if (res.Count() < 1 | page_index < 1) return Ok(Error); //page_index-1 so the first page is 1 and not 0 page_index = page_index - 1; int skip = page_index * page_size; res = res.Skip(skip).Take(page_size); PaginationPage page = new PaginationPage { totalpages = totalpages, totalitems = totalitems, products = res.ToArray() }; FiltersPage filterpage = new FiltersPage { FiltersList = FiltersList, page = page }; return(Ok(filterpage)); }
public Mobile(BrandName brandname, Type type) { this.BrandName = brandname; this.Type = type; }
public Mobile(BrandName brandName, Type type, int cost = 0) { this.BrandName = brandName; this.Type = type; this.Cost = cost; }
private void init_product() { product = new Product(); Additionally0 additionally0 = new Additionally0(); Additionally additionally = new Additionally(); ForName forName = new ForName(); string[] values = lines[i].Split('|'); for (int j = 0; j < values.Count(); j++) { if (headers[j].Equals("IMG_1")) { Resource res = new Resource(); res.img1 = values[j++]; try { if (headers[j].Equals("IMG_2")) { res.img2 = values[j++]; } if (headers[j].Equals("IMG_3")) { res.img3 = values[j++]; } if (headers[j].Equals("IMG_4")) { res.img4 = values[j++]; } if (headers[j].Equals("PDF_1")) { res.pdf = values[j++]; } if (headers[j].Equals("Icon")) { res.pdf = values[j++]; } } catch (IndexOutOfRangeException e) { } using (var db = new ProductDBEntitie()) { db.Resource.Add(res); db.SaveChanges(); additionally.Resource = res; additionally.id_resource = res.id; } continue; } if (headers[j] == "forname1") { forName.forname1 = values[j]; forName.forname2 = values[j + 1]; using (var db = new ProductDBEntitie()) { try { db.ForName.Add(forName); db.SaveChanges(); } catch { string str = values[j + 1]; forName = (from c in db.ForName where c.forname2.Equals(str) select c).FirstOrDefault(); } additionally0.id_forname = forName.id; additionally0.ForName = (ForName)forName; } j++; } if (headers[j] == "forname2") { j++; } try { if (!product.init_product(headers[j], values[j], ref additionally0)) { product.init_product(headers[j], values[j], ref additionally); } } catch { } } using (var db = new ProductDBEntitie()) { using (var transaction = db.Database.BeginTransaction()) { try { if (additionally0.ForName != null) { additionally0.ForName = null; db.Additionally0.Add(additionally0); db.SaveChanges(); product.id_additionally0 = additionally0.id; product.Additionally0 = additionally0; } } catch { } try { if (additionally.Resource != null) { Resource res = additionally.Resource; additionally.Resource = null; db.Additionally.Add(additionally); db.SaveChanges(); additionally.Resource = res; product.id_additionally = additionally.id; product.Additionally = additionally; } } catch { } try { BrandName drand = product.BrandName; product.BrandName = null; product.Additionally = null; product.Additionally0 = null; db.Product.Add(product); db.SaveChanges(); product.BrandName = drand; additionally0.ForName = forName; product.Additionally0 = additionally0; product.Additionally = additionally; transaction.Commit(); } catch (Exception e) { product = null; transaction.Rollback(); } } } }
public static BrandName CreateBrandName(int brandNameID, string name) { BrandName brandName = new BrandName(); brandName.BrandNameID = brandNameID; brandName.Name = name; return brandName; }
public void AddToBrandNames(BrandName brandName) { base.AddObject("BrandNames", brandName); }
public Mobile(BrandName brandname, Type type, int value) { this.BrandName = brandname; this.Value = value; }