public static string CreateTitleBarText(DialogLevel dialogLevel, BrandType brandType, string sDialogNameWithinTitleBarText) { string sTitleBarText; switch (dialogLevel) { case DialogLevel.Primary: if (!string.IsNullOrEmpty(sDialogNameWithinTitleBarText)) { sDialogNameWithinTitleBarText = string.Concat(" - ", sDialogNameWithinTitleBarText); } sTitleBarText = string.Format("{0}{1}", GetBrandTypeAsString(brandType), sDialogNameWithinTitleBarText); break; case DialogLevel.Secondary: sTitleBarText = GetBrandTypeAsString(brandType); break; case DialogLevel.Tertiary: sTitleBarText = sDialogNameWithinTitleBarText; break; default: sTitleBarText = string.Empty; break; } return sTitleBarText; }
public static string ToLegacyBrand(this BrandType?brand) { string str; BrandType?nullable = brand; if (nullable.HasValue) { BrandType valueOrDefault = nullable.GetValueOrDefault(); if (valueOrDefault == BrandType.MatureLivingChoices) { str = "MLC"; return(str); } else { if (valueOrDefault != BrandType.SeniorLivingChoices) { str = "MLC"; return(str); } str = "SLC"; return(str); } } str = "MLC"; return(str); }
/// <summary> /// Nieuw Brand /// </summary> /// <param name="databaseConnection"></param> /// <param name="type"></param> /// <param name="name"></param> /// <param name="description"></param> public Brand(BrandType type, string name, string description) : base(new Vendjuuren.SQL.Table(TableName)) { Type = type; Name = name; Description = description; }
public List <Publication> GetPublications(BrandType brand) { GetPublicationsCommand getPublicationsCommand = new GetPublicationsCommand(brand.Id); getPublicationsCommand.Execute(); return(getPublicationsCommand.CommandResult); }
public async Task <IActionResult> Edit(int id, [Bind("BrandTypeId,Name")] BrandType brandType) { if (id != brandType.BrandTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(brandType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandTypeExists(brandType.BrandTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(brandType)); }
public ActionResult DeleteConfirmed(int id) { BrandType brandType = db.BrandTypes.Find(id); db.BrandTypes.Remove(brandType); db.SaveChanges(); return(RedirectToAction("Index")); }
private async Task <ListProductsResponse> FilterProducts(IQueryable <Product> products, ProductFilter productFilter) { //price if (productFilter.MinPrice.HasValue) { products = products .Where(p => p.Price >= productFilter.MinPrice.Value); } if (productFilter.MaxPrice.HasValue) { products = products .Where(p => p.Price <= productFilter.MaxPrice.Value); } //size if (!string.IsNullOrWhiteSpace(productFilter.Sizes)) { var sizeTypeIds = SizeType.ParseIds(productFilter.Sizes); products = products .Where(p => sizeTypeIds.Any(fs => p.Sizes.Any(s => s.Id == fs))); } //brand if (!string.IsNullOrWhiteSpace(productFilter.Brands)) { var brandTypeIds = BrandType.ParseIds(productFilter.Brands); products = products .Where(p => brandTypeIds.Any(b => p.BrandTypeId == b)); } //category if (productFilter.CategoryUid.HasValue) { products = products .Where(p => p.Categories.Any(c => c.Uid == productFilter.CategoryUid.Value)); } var totalRecords = await products.CountAsync(); //paging if (productFilter.PageSize.HasValue && productFilter.PageIndex.HasValue) { var pageSize = productFilter.PageSize.Value; var pageIndex = productFilter.PageIndex.Value; products = products .OrderBy(p => p.Id) .Skip(pageIndex * pageSize) .Take((pageIndex + 1) * pageSize); } return(new ListProductsResponse(products, totalRecords)); }
public ActionResult Edit([Bind(Include = "BrandTypeId,BrandName")] BrandType brandType) { if (ModelState.IsValid) { db.Entry(brandType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(brandType)); }
public async Task <IActionResult> Create([Bind("BrandTypeId,Name")] BrandType brandType) { if (ModelState.IsValid) { _context.Add(brandType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(brandType)); }
public ActionResult Create([Bind(Include = "BrandTypeId,BrandName")] BrandType brandType) { if (ModelState.IsValid) { db.BrandTypes.Add(brandType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(brandType)); }
public static IMobile CreateMobile(BrandType brandType) { switch (brandType) { case BrandType.Apple: return(new Apple()); case BrandType.OnePlus: return(new OnePlus()); default: throw new Exception("Invalid Brand Type..."); } }
// GET: Admin/BrandTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BrandType brandType = db.BrandTypes.Find(id); if (brandType == null) { return(HttpNotFound()); } return(View(brandType)); }
public static IMobile CreateMobile(BrandType brandType) { switch (brandType) { case BrandType.Samsung: return(new Samsung()); case BrandType.Xiaomi: return(new Xiaomi()); default: throw new Exception("Invalid brand type..."); } }
public static AbstractFactory CreateFactory(BrandType brandType) { switch (brandType) { case BrandType.Lexus: return(new LexusFactory()); case BrandType.Toyota: return(new ToyotaFactory()); default: throw new Exception("Invalid Brand Type"); } }
private static string GetBrandTypeAsString(BrandType brandType) { string sProductFeature = string.Empty; switch (brandType) { case BrandType.Protect: sProductFeature = "Workshare Protect"; break; case BrandType.Compare: sProductFeature = "Workshare Compare"; break; case BrandType.Default: default: sProductFeature = "Workshare"; break; } return sProductFeature; }
public async Task <int> AddBrandAsync(BrandBindingModel model) { var checkForDuplicate = this.DbContext .Brands .FirstOrDefault(x => x.BrandName == model.BrandName); if (checkForDuplicate != null) { return(ErrorId); } var brand = this.Mapper.Map <Brand>(model); var brandType = this.DbContext .BrandTypes .FirstOrDefault(x => x.TypeName == model.BrandTypeStr); if (brandType == null) { brandType = new BrandType() { TypeName = model.BrandTypeStr }; await this.DbContext.BrandTypes.AddAsync(brandType); await this.DbContext.SaveChangesAsync(); } brand.BrandTypeId = brandType.Id; brand.BrandType = brandType; await this.DbContext.Brands.AddAsync(brand); await this.DbContext.SaveChangesAsync(); return(brand.Id); }
public override IPaymentFactory SetBrandType(BrandType brandType) { request.ACCOUNT.Brand = brandType; return(this); }
protected override void Seed(ShopyContext dbContext) { //define products var products = GetProducts(); //define categories var tShirts = new Category("T-shirts"); var jackets = new Category("Jackets"); var footwear = new Category("Footwear"); var shoes = new Category("Shoes"); var clothes = new Category("Clothes"); //define brands var active = BrandType.From(BrandTypeId.Active); var addidas = BrandType.From(BrandTypeId.Addidas); var rebook = BrandType.From(BrandTypeId.Rebook); var nike = BrandType.From(BrandTypeId.Nike); var puma = BrandType.From(BrandTypeId.Puma); //define sizes var xs = SizeType.From(SizeTypeId.XS); var s = SizeType.From(SizeTypeId.S); var m = SizeType.From(SizeTypeId.M); var l = SizeType.From(SizeTypeId.L); var xl = SizeType.From(SizeTypeId.XL); //products categories products[0].AddCategory(footwear); products[0].AddCategory(shoes); products[1].AddCategory(jackets); products[1].AddCategory(clothes); products[2].AddCategory(jackets); products[2].AddCategory(clothes); products[3].AddCategory(jackets); products[3].AddCategory(clothes); products[4].AddCategory(jackets); products[4].AddCategory(clothes); products[5].AddCategory(footwear); products[5].AddCategory(shoes); products[6].AddCategory(jackets); products[6].AddCategory(tShirts); products[7].AddCategory(clothes); products[7].AddCategory(tShirts); products[8].AddCategory(clothes); products[8].AddCategory(tShirts); products[9].AddCategory(clothes); products[9].AddCategory(tShirts); products[10].AddCategory(clothes); products[10].AddCategory(jackets); products[11].AddCategory(footwear); products[11].AddCategory(shoes); products[12].AddCategory(footwear); products[12].AddCategory(shoes); products[13].AddCategory(clothes); products[13].AddCategory(tShirts); //products sizes products[0].AddSize(xs); products[0].AddSize(s); products[0].AddSize(m); products[1].AddSize(m); products[1].AddSize(l); products[1].AddSize(xl); products[2].AddSize(s); products[2].AddSize(m); products[3].AddSize(xs); products[3].AddSize(l); products[3].AddSize(xl); products[4].AddSize(l); products[4].AddSize(xl); products[5].AddSize(s); products[5].AddSize(l); products[5].AddSize(xs); products[6].AddSize(s); products[6].AddSize(m); products[6].AddSize(xl); products[7].AddSize(xl); products[7].AddSize(s); products[8].AddSize(s); products[8].AddSize(l); products[9].AddSize(s); products[9].AddSize(l); products[9].AddSize(m); products[10].AddSize(s); products[10].AddSize(l); products[10].AddSize(xl); products[11].AddSize(m); products[11].AddSize(l); products[12].AddSize(l); products[12].AddSize(xl); products[13].AddSize(s); products[13].AddSize(xl); products[13].AddSize(m); //products brands products[0].SetBrand(active); products[1].SetBrand(nike); products[2].SetBrand(rebook); products[3].SetBrand(addidas); products[4].SetBrand(active); products[5].SetBrand(nike); products[6].SetBrand(rebook); products[7].SetBrand(addidas); products[8].SetBrand(active); products[9].SetBrand(puma); products[10].SetBrand(rebook); products[11].SetBrand(addidas); products[12].SetBrand(puma); products[13].SetBrand(nike); //add products dbContext.Products.AddRange(products); //save dbContext.SaveChanges(); }
public Car(int id, BrandType brandType, EngineType engine) { this.Id = id; this.Brand = brandType; this.Engine = engine; }
public override Car GetCar(BrandType brand, EngineType engine) { id++; return(new Automobile(id, brand, engine)); }
public abstract Car GetCar(BrandType brand, EngineType engine);
public override Car GetCar(BrandType brand, EngineType engine) { id++; return(new Truck(id, brand, engine)); }
public Truck(int id, BrandType brand, EngineType engine) : base(id, brand, engine) { }
public List <Publication> GetPublications(string brandType) { BrandType brandType1 = this._publicationDac.GetBrands().FirstOrDefault <BrandType>((BrandType b) => b.Description == brandType); return(this._publicationDac.GetPublications(brandType1)); }
public List <Publication> GetPublications(BrandType brandType) { return(this._publicationDac.GetPublications(brandType)); }
public Automobile(int id, BrandType brand, EngineType engine) : base(id, brand, engine) { }
/// <summary> /// Card Brand Type /// Optional /// </summary> /// <param name="brandType"></param> /// <returns></returns> public abstract IPaymentFactory SetBrandType(BrandType brandType);