protected override void addimage(location state, Brand brand, RotateFlipType rotate) { Bitmap bitmap; // �p�G�O�i�����P�N�]�w��ܵP���ϫ��A�_�h�N��ܪ��ߪ��P Resources.upbarnd if (brand.IsCanSee || state == location.South || ShowAll) bitmap = new Bitmap(brand.image); else bitmap = new Bitmap(Resources.upbarnd); // �]�w�P BrandBox tempBrandbox = new BrandBox(brand); // �]�w�۰��Y�� tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize; // �]�w��Z tempBrandbox.Margin = new Padding(0); tempBrandbox.Padding = new Padding(padding); // �n����� bitmap.RotateFlip(rotate); // ���� if (ShowAll && ShowBrandInfo) tempBrandbox.Click += new EventHandler(debug_Click); // �ƹ��ƥ� if ( state == location.South && brand.getClass() != Settings.Default.Flower && brand.Team < 1 ) { tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove); tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave); tempBrandbox.Click += new EventHandler(brandBox_MouseClick); // �@���ƥ� //if (ShowAll && ShowBrandInfo) // tempBrandbox.MouseHover += new EventHandler(debug_Click); //else // tempBrandbox.MouseHover -= new EventHandler(debug_Click); } else if (cheat && state != location.South) { tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick); } else { tempBrandbox.Click -= new EventHandler(brandBox_MouseClick); tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick); } bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage); // �]�w�Ϥ� tempBrandbox.Image = bitmap; // �s�W�ܱ�� add_flowLayoutBrands(state, tempBrandbox); }
/// <summary> /// 新增 /// </summary> /// <param name="brandEditVM"></param> /// <returns></returns> public ErrorCode Create(BrandEditVM brandEditVM) { try { if (BrandDal.GetExisted(o => o.CommodityTypeId == brandEditVM.CommodityTypeId && o.Name == brandEditVM.Name)) { return ErrorCode.BrandExisted; } var brand = new Brand { Name = brandEditVM.Name, CommodityTypeId = brandEditVM.CommodityTypeId, Description = brandEditVM.Description, CommodityId = brandEditVM.CommodityId }; BrandDal.Create(brand); return ErrorCode.NoError; } catch (Exception) { return ErrorCode.ServerError; } }
private void SetUpData() { Domain.Dependencies.Register(); //Repository registration DIContainer.Instance.RegisterType<IRepository, OnlineRepository>(OnlineRepository.InstanceName); DIContainer.Instance.RegisterType<ReferenceDataRepository>(new ContainerControlledLifetimeManager()); DIContainer.Instance.RegisterType<IComponentSettingsClient, ComponentSettingsClientTest>(); var workStation = DIContainer.Instance.Resolve<Workstation>(); workStation.ConfigurationServiceBaseAddress = "http://Localhost/"; workStation.Ship = new Ship { ShipId = "1", BrandId = "3", Code = "3" }; workStation.ConnectionMode = ConnectionMode.Online; var intCollection = new Collection<int>(); intCollection.Add(1); intCollection.Add(2); intCollection.Add(3); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); workStation.Brand = brand; workStation.Voyage = new Voyage { IsActive = true, VoyageId = "31", Number = "dd0", ShipId = "1" }; var voyages = new List<Voyage>(); voyages.Add(new Voyage { IsActive = true, VoyageId = "31", Number = "dd0", ShipId = "1" }); workStation.AssignVoyageList(voyages); this.targetRepository = new ConfigurationServiceRepository(); }
public void status() { Brand objbrand = new Brand(); string type = Request.QueryString["dl"]; string brandid = Request.QueryString["id"]; objbrand.UpdatebyID(int.Parse(brandid), int.Parse(type)); }
private bool chackBrandNumber(Brand b1,Brand b2) { if (b1.getNumber() == b2.getNumber()) return true; else return false; }
public ActionResult SalvarBrand(Brand brand) { ViewBag.Message = "Marcas de Coche"; SaveEntity(brand); return base.View("Nuevo", brand); }
public static List<Brand> getBrands() { try { SQLHelper dbhelper = new SQLHelper(); List<MySqlParameter> lstParameter = new List<MySqlParameter>(); var resultSet = dbhelper.executeSP<DataSet>(lstParameter, "SelectAllBrand"); List<Brand> brands = new List<Brand>(); foreach (DataRow drow in resultSet.Tables[0].Rows) { Brand brand = new Brand(); brand.BrandID = Convert.ToInt32(drow["brandId"].ToString()); brand.Brandname = drow["brandname"].ToString(); brand.Description = drow["description"].ToString(); brands.Add(brand); } return brands; } catch (Exception e) { throw e; } }
public void InsertManufacturer() { var manufacturer = new Manufacturer(); manufacturer.Name = "Manufacturer1"; ManufacturerDAO.Instance.Save(manufacturer); var brand = new Brand {Name = "Brand1", Manufacturer = manufacturer}; BrandDAO.Instance.Save(brand); }
public ActionResult Edit(Brand brand) { if (ModelState.IsValid) { _daoFactory.BrandDao().SaveOrUpdate(brand); return Redirect("index"); } return View(brand); }
/// <summary> /// �P�����A�ˬd �Y �I �b �J /// </summary> /// <param name="otherbrand">�i�Ӫ��P</param> /// <param name="player">���ߪ����a�զX</param> public CheckBrands(Brand otherbrand, BrandPlayer player) { for (int i = 0; i < player.getCount(); i++) if (player.getBrand(i).getClass() != Mahjong.Properties.Settings.Default.Flower) x.add(player.getBrand(i)); brand = otherbrand; for (int i = 0; i < chow_player.Length; i++) chow_player[i] = new BrandPlayer(); }
private bool chackBrandClass(Brand b1, Brand b2) { if (b1.getClass() == b2.getClass()) return true; else { return false; } }
public CheckUser(bool chow,bool pong,bool kong,bool darkkong,bool win,bool pass,Brand brand) { Chow = chow; Pong = pong; Kong = kong; DarkKong = darkkong; Win = win; Pass = pass; Brand = brand; }
public Brand UpdateBrand(Brand updatedBrand) { var brandToUpdate = _brandRepository.FindOne(b => b.Id == updatedBrand.Id); SetOwner(brandToUpdate, updatedBrand.CompanyId); brandToUpdate.BrandName = updatedBrand.BrandName; brandToUpdate.LastUpdated = DateTime.Now; _brandRepository.Persist(); Log.Debug("Brand {0} with Id {1} updated", brandToUpdate.BrandName, brandToUpdate.Id); return brandToUpdate; }
public void listingtblbody() { Brand objbrand = new Brand(); string page = Request.QueryString["Page"]; if (page == null) page = "1"; int HOWMANYPAGES = 0; List<Brand> objbrandlisting = objbrand.getBrandall(true,9 ,page.ToString(), "20", out HOWMANYPAGES); Table tblbrand = new Table(); tblbrand.Width = Unit.Percentage(100); tblbrand.CellPadding = 0; tblbrand.CellSpacing = 0; tblbrand.BorderWidth = 0; TableRow tblrow = new TableRow(); TableCell tblcell = new TableCell(); int sum = 0; for (int i = 0; i < objbrandlisting.Count; i++) { tblrow.HorizontalAlign = HorizontalAlign.Center; tblcell = new TableCell(); tblcell.Style.Add("background", "white"); string Brandid = objbrandlisting[i].BrandID; string logo = objbrandlisting[i].Logo; Image imag = new Image(); imag.Width = 190; imag.Height = 190; imag.ImageUrl = "~/images/" + objbrandlisting[i].Logo; imag.Attributes.Add("onclick", "javascript:window.open('Branddetail.aspx?id=" + Brandid + "');"); tblcell.Controls.Add(imag); tblrow.Cells.Add(tblcell); sum = sum + 1; if (sum == 5) { tblbrand.Controls.Add(tblrow); tblrow = new TableRow(); sum = 0; } else { tblbrand.Controls.Add(tblrow); } } phbrand.Controls.Add(tblbrand); string firstPageUrl = "http://localhost/f**k/Brand/Brandlisting.aspx?"; //SHARIF Page={0} shoule be like this string pagerFormat = "http://localhost/f**k/Brand/Brandlisting.aspx?Page={0}"; bottomPager.Show(int.Parse(page), HOWMANYPAGES, firstPageUrl, pagerFormat, true); }
/// <summary> /// ��P /// </summary> /// <returns></returns> public Brand getReadyBrand() { ans = player.getBrand(0); for (int i = 1; i < player.getCount(); i++) { if (player.getBrand(i).Source < ans.Source && player.getBrand(i).getClass() != Mahjong.Properties.Settings.Default.Flower) ans = player.getBrand(i); } //print(); return ans; }
public ActionResult CreateBrand(Brand brandToCreate, FormCollection collection) { try { _brandApplicationService.CreateBrand(brandToCreate); return RedirectToAction("BrandIndex"); } catch { return View(); } }
public ActionResult EditBrand(Brand updatedBrand, FormCollection collection) { try { _brandApplicationService.UpdateBrand(updatedBrand); return RedirectToAction("BrandIndex"); } catch { return View(); } }
public bool Delete(Brand brand) { try { _brandCustomFieldRepository.DeleteBatch(o => o.BrandId == brand.Id); _brandRepository.Delete(brand); return true; } catch { return false; } }
/// <summary> /// ���P /// </summary> /// <param name="brand">�dzƭn�����P</param> internal virtual bool pushToTable(Brand brand) { // ��P�q�{�b�����a��W���� all.NowPlayer.remove(brand); // ���ୱ�W all.PushToTable(brand); // �ƧDz{�b�����a all.sortNowPlayer(); // ��s�{�b���a�M�ୱ updatePlayer_Table(); // �ݬO�_���H�n �J �b �I �Y return check_chow_pong_kong_win(brand); }
public static Product BuildProduct(Brand brand, Country country) { return new Product() { ProductName = "Mer brik hallon blåbär m sugrör", Brand = brand, GlobalTradeItemNumber = gtin++.ToString(), Quantity = 20, QuantityUnit = "cl", OriginCountry = country, LastUpdated = DateTime.Now }; }
/// <summary> /// �O�_���H�n �J �b �I �Y /// </summary> /// <param name="brand">���X��ୱ���P</param> /// <returns>�O�_�ॴ��ୱ�W</returns> internal bool check_chow_pong_kong_win(Brand brand) { // �O�_���H�n �J if (check_win(brand)) return false; // �O�_���H�n �I �b if (check_pong_kong(brand)) return false; // �O�_���H�n �Y if (check_chow(brand)) return false; // ���\����ୱ�W return true; }
/// <summary> /// �ϥΪ�/AI��X�@�i�P /// </summary> /// <param name="brand">�P</param> internal virtual void makeBrand(Brand brand) { // ��P����ୱ�W�ݬO�_���H�n �J �b �I �Y // �Y���ߴN��ܨS���H�n�A�����ߴN��ܳQ�H���� if (pushToTable(brand)) { // ���U�@�ӤH all.next(); // ��s��T�� setInforamtion(); } // �p�ɾ����s�Ұ� roundTimer.Start(); }
public bool DeleteBrand(Brand b) { try { this.ObjectContext.DeleteObject(b); this.ObjectContext.SaveChanges(); return true; } catch { } return false; }
public bool AddBrand(Brand b) { try { this.ObjectContext.EntitySet.AddObject(b); this.ObjectContext.SaveChanges(); return true; } catch { } return false; }
public bool Save(Brand brand) { if (brand.Id > 0) { bool exists = _brandRepository.Query(o => o.Id == brand.Id).Any(); if (exists) return Update(brand); else return Create(brand); } else { return Create(brand); } }
public Brand CreateBrand(Brand brandToCreate) { var existingBrand = FindBrand(brandToCreate.BrandName, false); if (existingBrand != null) { Log.Debug("Tried to create a brand that already exists: {0} with Id {1}", existingBrand.BrandName, existingBrand.Id); throw new ArgumentException("Can't create two brands with the same name"); } brandToCreate.LastUpdated = DateTime.Now; SetOwner(brandToCreate, brandToCreate.CompanyId); _brandRepository.Add(brandToCreate); _brandRepository.Persist(); Log.Debug("Brand {0} created with Id {1}", brandToCreate.BrandName, brandToCreate.Id); return brandToCreate; }
public int AddBrand(string brandName) { try { Brand brand=new Brand(); brand.BrandName = brandName; context.AddToBrand(brand); context.SaveChanges(); return 1; } catch (Exception) { return 0; } }
public void UpdateBrand(Brand brand) { var updateStmt = @"UPDATE Products.Brands SET BrandName = @BrandName, BrandCode = @BrandCode, BrandDescription = @BrandDescription, BrandDisplayName = @BrandDisplayName, InCommBrandIdentifier = @InCommBrandIdentifier, BrandImageUrl = @BrandImageUrl, IsActive = @IsActive, CreatedOn = @CreatedOn, CreatedBy = @CreatedBy, ModifiedOn = @ModifiedOn, ModifiedBy = @ModifiedBy WHERE BrandId = @BrandId"; using (var conn = new SqlConnection(_connectionString)) { conn.Open(); conn.Execute(updateStmt, brand); conn.Close(); } }
public int AddBrand(Brand brand) { var insertStmt = @"INSERT Products.Brands (BrandName, BrandCode, BrandDescription, BrandDisplayName, InCommBrandIdentifier, BrandImageUrl, IsActive, CreatedOn, CreatedBy, ModifiedOn, ModifiedBy) VALUES (@BrandName, @BrandCode, @BrandDescription, @BrandDisplayName, @InCommBrandIdentifier, @BrandImageUrl, @IsActive, @CreatedOn, @CreatedBy, @ModifiedOn, @ModifiedBy); SELECT scope_identity();"; object id = null; using (var conn = new SqlConnection(_connectionString)) { conn.Open(); id = conn.ExecuteScalar(insertStmt, brand); conn.Close(); } return id != null ? Convert.ToInt32(id) : 0; }
/// <summary> /// retrieves brand detail /// </summary> /// <param name="brand">brand attribute</param> /// <returns>Brand entity</returns> private static Brand MapAsync(Entities.Brand brand) { var brandData = new Brand(); if (brand != null) { brandData.BrandId = brand.BrandId; brandData.Name = brand.Name; var mediaItem = brand.MediaItems.FirstOrDefault(); if (mediaItem != null) { brandData.MediaItemAddress = mediaItem.MediaItemAddress; } } return brandData; }
public IResult Delete(Brand brand) { _brandDal.Delete(brand); return(new SuccessResult(Messages.BrandDeleted)); }
public void Update(Brand brand) { _brandDal.Update(brand); }
void ConfigureGrid() { storeManager.Entities.Location location = ListType as storeManager.Entities.Location; Brand brand = ListType as Brand; Category category = ListType as Category; Tax tax = ListType as Tax; Measurement measurement = ListType as Measurement; if (location != null) { dgvList.Columns["Name"].Width = 300; dgvList.Columns["Comment"].Width = 350; dgvList.Columns["id"].IsVisible = false; dgvList.Columns["IsDefault"].IsVisible = false; dgvList.Columns["ProductLocations"].IsVisible = false; return; } if (brand != null) { dgvList.Columns["BrandName"].HeaderText = "Brand Name"; dgvList.Columns["BrandName"].Width = 300; dgvList.Columns["Description"].Width = 350; dgvList.Columns["BrandID"].IsVisible = false; dgvList.Columns["ID"].IsVisible = false; dgvList.Columns["DisplayName"].IsVisible = false; dgvList.Columns["Products"].IsVisible = false; return; } if (category != null) { dgvList.Columns["Name"].Width = 300; dgvList.Columns["Comment"].Width = 350; dgvList.Columns["CategoryID"].IsVisible = false; dgvList.Columns["ID"].IsVisible = false; dgvList.Columns["DisplayName"].IsVisible = false; dgvList.Columns["Products"].IsVisible = false; return; } if (tax != null) { dgvList.Columns["TaxName"].HeaderText = "Tax Name"; dgvList.Columns["TaxRate"].HeaderText = "Tax Rate"; dgvList.Columns["TaxNumber"].HeaderText = "Tax Number"; dgvList.Columns["TaxName"].Width = 300; dgvList.Columns["TaxRate"].Width = 120; dgvList.Columns["TaxNumber"].Width = 120; dgvList.Columns["TaxID"].IsVisible = false; dgvList.Columns["ID"].IsVisible = false; dgvList.Columns["DisplayName"].IsVisible = false; return; } if (measurement != null) { dgvList.Columns["Name"].Width = 300; dgvList.Columns["Description"].Width = 350; dgvList.Columns["id"].IsVisible = false; dgvList.Columns["Products"].IsVisible = false; return; } }
public void Create(Brand entity) { _brandRepository.Create(entity); }
public void Delete(Brand entity) { _brandRepository.Delete(entity); }
private void DoImport() { try { List <Brand> emptyStore = new List <Brand>(); List <Brand> stores = new List <Brand>(); List <Brand> repeatItems = new List <Brand>(); DataTable dt = NPOIHelper.FormatToDatatable(path, 0); for (int i = 1; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; int index = 0; Brand store = new Brand(); try { if (!CommonGlobalUtil.ImportValidate(row, 2)) { store.AutoID = (i + 2); store.Name = CommonGlobalUtil.ConvertToString(row[index++]); store.OrderNo = CommonGlobalUtil.ConvertToInt32(row[index++]); if (String.IsNullOrEmpty(store.Name)) { //必填项为空 emptyStore.Add(store); continue; } else { //判断是否重复款号/颜色 if (stores.Find(t => t.Name == store.Name) != null) { repeatItems.Add(store); continue; } stores.Add(store); } } } catch (Exception ex) { } } if (emptyStore.Count > 0) { String str = string.Empty; foreach (var item in emptyStore) { str += "第" + item.AutoID + "行\r\n"; } ShowError("必填项没有填写,请补充完整!\r\n" + str); return; } if (repeatItems.Count > 0) { String str = string.Empty; foreach (var item in repeatItems) { str += "第" + item.AutoID + "行" + "\r\n"; } ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str); // return; } if (stores != null && stores.Count > 0) { } else { ShowMessage("没有数据可以导入,请检查列表信息!"); return; } path = null; //檢查結果 InteractResult result = GlobalCache.ServerProxy.ImportBrand(stores); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: RefreshPage(); ShowMessage("导入成功!"); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
public SellItContext() { if (this.Database.CreateIfNotExists()) { Brand peugeot = new Brand(); peugeot.Name = "Peugeot"; peugeot.Description = "la marque de voiture française Peugeot"; this.dbBrand.Add(peugeot); this.SaveChanges(); Brand citroen = new Brand(); citroen.Name = "Citroën"; citroen.Description = "la marque de voiture française Citroën"; this.dbBrand.Add(citroen); this.SaveChanges(); Brand renault = new Brand(); renault.Name = "Renault"; renault.Description = "la marque de voiture française Renault"; this.dbBrand.Add(renault); this.SaveChanges(); Brand volkswagen = new Brand(); volkswagen.Name = "Volkswagen"; volkswagen.Description = "la marque de voiture allemande Volkswagen"; this.dbBrand.Add(volkswagen); this.SaveChanges(); Category citPeugeot = new Category(); citPeugeot.Name = "Citadine"; citPeugeot.Description = "Petite voiture"; citPeugeot.Tva = 0.2F; citPeugeot.Price = 2000F; citPeugeot.Brand = this.dbBrand.Find(peugeot.BrandId); this.dbCategory.Add(citPeugeot); this.SaveChanges(); Category citRenault = new Category(); citRenault.Name = "Citadine"; citRenault.Description = "Petite voiture"; citRenault.Tva = 0.2F; citRenault.Price = 2000F; citRenault.Brand = this.dbBrand.Find(renault.BrandId); this.dbCategory.Add(citRenault); this.SaveChanges(); Category citCitroen = new Category(); citCitroen.Name = "Citadine"; citCitroen.Description = "Petite voiture"; citCitroen.Tva = 0.2F; citCitroen.Price = 2000F; citCitroen.Brand = this.dbBrand.Find(citroen.BrandId); this.dbCategory.Add(citCitroen); this.SaveChanges(); Category citVolkswagen = new Category(); citVolkswagen.Name = "Citadine"; citVolkswagen.Description = "Petite voiture"; citVolkswagen.Tva = 0.2F; citVolkswagen.Price = 2000F; citVolkswagen.Brand = this.dbBrand.Find(volkswagen.BrandId); this.dbCategory.Add(citVolkswagen); this.SaveChanges(); Category berPeugeot = new Category(); berPeugeot.Name = "Berline"; berPeugeot.Description = "Une berline classique"; berPeugeot.Tva = 0.2F; berPeugeot.Price = 2000F; berPeugeot.Brand = this.dbBrand.Find(peugeot.BrandId); this.dbCategory.Add(berPeugeot); this.SaveChanges(); Category monPeugeot = new Category(); monPeugeot.Name = "Monospace"; monPeugeot.Description = "Un monospace classique"; monPeugeot.Tva = 0.2F; monPeugeot.Price = 3500F; monPeugeot.Brand = this.dbBrand.Find(peugeot.BrandId); this.dbCategory.Add(monPeugeot); this.SaveChanges(); Category berRenault = new Category(); berRenault.Name = "Berline"; berRenault.Description = "Une berline classique"; berRenault.Tva = 0.2F; berRenault.Price = 2000F; berRenault.Brand = this.dbBrand.Find(renault.BrandId); this.dbCategory.Add(berRenault); this.SaveChanges(); Category berCitroen = new Category(); berCitroen.Name = "Berline"; berCitroen.Description = "Une berline classique"; berCitroen.Tva = 0.2F; berCitroen.Price = 2000F; berCitroen.Brand = this.dbBrand.Find(citroen.BrandId); this.dbCategory.Add(berCitroen); this.SaveChanges(); Category berVolkswagen = new Category(); berVolkswagen.Name = "Berline"; berVolkswagen.Description = "Une berline classique"; berVolkswagen.Tva = 0.2F; berVolkswagen.Price = 2000F; berVolkswagen.Brand = this.dbBrand.Find(volkswagen.BrandId); this.dbCategory.Add(berVolkswagen); this.SaveChanges(); Category breVolkswagen = new Category(); breVolkswagen.Name = "Break"; breVolkswagen.Description = "un break"; breVolkswagen.Tva = 0.2F; breVolkswagen.Price = 2000F; breVolkswagen.Brand = this.dbBrand.Find(volkswagen.BrandId); this.dbCategory.Add(breVolkswagen); this.SaveChanges(); Category monVolkswagen = new Category(); monVolkswagen.Name = "Break"; monVolkswagen.Description = "un break"; monVolkswagen.Tva = 0.2F; monVolkswagen.Price = 2000F; monVolkswagen.Brand = this.dbBrand.Find(volkswagen.BrandId); this.dbCategory.Add(monVolkswagen); this.SaveChanges(); Category breRenault = new Category(); breRenault.Name = "Break"; breRenault.Description = "un break"; breRenault.Tva = 0.2F; breRenault.Price = 2000F; breRenault.Brand = this.dbBrand.Find(renault.BrandId); this.dbCategory.Add(breRenault); this.SaveChanges(); Category monRenault = new Category(); monRenault.Name = "Monospace"; monRenault.Description = "Un monospace"; monRenault.Tva = 0.2F; monRenault.Price = 2000F; monRenault.Brand = this.dbBrand.Find(renault.BrandId); this.dbCategory.Add(monRenault); this.SaveChanges(); Car voiture = new Car(); voiture.Name = "Peugeot 306"; voiture.Year = 2000; voiture.TimeAssurancy = 2; voiture.Avalaible = true; voiture.DelayExchange = 1; voiture.Color = "Rouge"; voiture.Category = this.dbCategory.Find(citPeugeot.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Peugeot 406"; voiture.Year = 2002; voiture.TimeAssurancy = 2; voiture.Avalaible = true; voiture.DelayExchange = 1; voiture.Color = "Bleue"; voiture.Category = this.dbCategory.Find(berPeugeot.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Peugeot 407"; voiture.Year = 2003; voiture.TimeAssurancy = 2; voiture.Avalaible = true; voiture.DelayExchange = 1; voiture.Color = "Verte"; voiture.Category = this.dbCategory.Find(berPeugeot.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Citroën DS"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Rouge"; voiture.Category = this.dbCategory.Find(citCitroen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Xantia"; voiture.Year = 2011; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Bleue"; voiture.Category = this.dbCategory.Find(berCitroen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "C5"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Rouge"; voiture.Category = this.dbCategory.Find(berCitroen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "C3"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Verte"; voiture.Category = this.dbCategory.Find(citCitroen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "C2"; voiture.Year = 2011; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Blanche"; voiture.Category = this.dbCategory.Find(citCitroen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Espace"; voiture.Year = 2015; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Noire"; voiture.Category = this.dbCategory.Find(monRenault.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Laguna"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Blanche"; voiture.Category = this.dbCategory.Find(berRenault.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Laguna"; voiture.Year = 2011; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Noire"; voiture.Category = this.dbCategory.Find(berRenault.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "4L"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Rouge"; voiture.Category = this.dbCategory.Find(citRenault.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Polo"; voiture.Year = 2011; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Verte"; voiture.Category = this.dbCategory.Find(citVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Polo"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = true; voiture.DelayExchange = 2; voiture.Color = "Noire"; voiture.Category = this.dbCategory.Find(citVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Passat"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Blanche"; voiture.Category = this.dbCategory.Find(berVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Passat"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Bleue"; voiture.Category = this.dbCategory.Find(breVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Golf"; voiture.Year = 2015; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Noire"; voiture.Category = this.dbCategory.Find(citVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "806"; voiture.Year = 2012; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Rouge et noire"; voiture.Category = this.dbCategory.Find(monPeugeot.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Touran"; voiture.Year = 2016; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Grise"; voiture.Category = this.dbCategory.Find(monVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); voiture = new Car(); voiture.Name = "Touran"; voiture.Year = 2013; voiture.TimeAssurancy = 3; voiture.Avalaible = false; voiture.DelayExchange = 2; voiture.Color = "Noire"; voiture.Category = this.dbCategory.Find(monVolkswagen.CategoryId); this.dbCar.Add(voiture); this.SaveChanges(); } #endregion }
public void Delete(Brand brand) { _brandDal.Delete(brand); }
public IResult Delete(Brand brand) { _brandDal.Delete(brand); return(new SuccessResult()); }
public IResult Add(Brand brand) { _brandDal.Add(brand); return(new SuccessResult()); }
public IList <string> GetBrands() { return(string.IsNullOrWhiteSpace(Brand) ? new List <string>() : Brand.Split(new[] { "--" }, StringSplitOptions.RemoveEmptyEntries).ToList()); }
public IResult Update(Brand brand) { _brandDal.Update(brand); return(new SuccessResult()); }
public override string ToString() { return(Brand.ToString()); }
public void Delete(Brand brand) { brand.IsDeleted = true; Update(brand); }
public async Task UpdateAsync(Brand brand) { _context.Entry(brand).State = EntityState.Modified; await _context.SaveChangesAsync(); }
public void UpdateBrand(Brand brand) { Brand = brand ?? throw new ArgumentNullException(nameof(brand), "A valid brand must be provided."); }
public void Update(Brand brand) { _context.Entry(brand).State = EntityState.Modified; _context.SaveChanges(); }
public void Post([FromBody] Brand value) { dc.Brand.Add(value); dc.SaveChanges(); }
public async Task CreateAsync(Brand brand) { await _context.Brands.AddAsync(brand); await _context.SaveChangesAsync(); }
public MobilePhone(int ID, decimal price, bool isAvailable, Brand brand, int Memory, string CPU, int RAM, string Model, Battery battery, string connectivity, bool ExpandableMemory, double ScreenSize, string GPU, string OperatingSystem) : base(ID, price, isAvailable, brand, Memory, CPU, RAM, Model, battery, connectivity, ExpandableMemory, ScreenSize) { this.GPU = GPU; this.OperatingSystem = OperatingSystem; }
public void Update(Brand entity) { _brandRepository.Update(entity); }
public Product GetProduct(string gtin) { var gepirProductService = WebServiceFactory.CreateProductServiceProxy(); var mappedProduct = new Product { GlobalTradeItemNumber = gtin, LastUpdated = DateTime.Now }; try { var paddedGtin = gtin.PadLeft(14, '0'); var getItemByGtin = new GetItemByGTIN { requestedGtin = paddedGtin, versionSpecified = false }; var itemByGtin = gepirProductService.GetItemByGTIN(getItemByGtin); // If request ok (return code 0) and product found if (gepirProductService.gepirResponseHeaderValue.returnCode == 0 && itemByGtin != null && itemByGtin.itemDataLine != null && itemByGtin.itemDataLine.Length > 0) { var gepirProduct = itemByGtin.itemDataLine[0]; //TODO Sometimes leads to NotSupportedException - Adding/Attaching an item that is not new //UpdateDomain(gepirProductService, gtin, gepirProduct); //mappedProduct = _productDomainService.FindProductByGtin(gtin, true); mappedProduct = _gepirProductMapper.Map(gepirProduct); } // If the product couldn't be found we can still get the GTIN owner else { var getPartyByGtin = new GetPartyByGTIN() { requestedGtin = new[] { paddedGtin }, versionSpecified = false }; var partyByGtin = gepirProductService.GetPartyByGTIN(getPartyByGtin); var brand = new Brand { LastUpdated = DateTime.Now }; if (gepirProductService.gepirResponseHeaderValue.returnCode == 0 && partyByGtin != null && partyByGtin.partyDataLine != null && partyByGtin.partyDataLine.Length > 0) { //using (var companyRepository = _repositoryFactory.Build<IRepository<Company>, Company>()) //{ var gepirCompany = partyByGtin.partyDataLine[0]; Company company = null; var matchingCompanies = _companyRepository.Find(x => x.CompanyName == gepirCompany.partyName); if (!matchingCompanies.Any()) { company = _gepirCompanyMapper.Map(gepirCompany); _companyRepository.Add(company); _companyRepository.Persist(); } else if (matchingCompanies.Count() == 1) { company = matchingCompanies.First(); } brand.Owner = company; mappedProduct.Brand = brand; //} } } } catch (Exception exception) { Log.Error("Gepir router threw an exception.", exception); if (gepirProductService.gepirResponseHeaderValue != null) { Log.Error("Gepir returnCode:", gepirProductService.gepirResponseHeaderValue.returnCode); } return(null); } return(mappedProduct); }
public void Create(Brand brand) { _context.Brands.Add(brand); _context.SaveChanges(); }
private void UpdateDomain(router router, string gtin, itemDataLineType gepirProduct) { if (string.IsNullOrEmpty(gepirProduct.brandName)) { return; } using (var brandRepository = _repositoryFactory.Build <IBrandRepository, Brand>()) { Brand brand = null; var matchingBrands = brandRepository.Find(x => x.BrandName == gepirProduct.brandName); // If a brand with the given name doesn't exist yet, we create it. if (!matchingBrands.Any()) { brand = new Brand { BrandName = gepirProduct.brandName, LastUpdated = DateTime.Now }; brandRepository.Add(brand); } // Else if there exists exactly one brand with the given name we use that brand else if (matchingBrands.Count() == 1) { brand = matchingBrands.First(); // If the brand we retrieved doesn't have an owner we can add it as well if (brand.Owner == null) { var manufacturerGln = gepirProduct.manufacturerGln ?? gepirProduct.informationProviderGln; var getPartyByGln = new GetPartyByGLN { requestedGln = new[] { manufacturerGln }, versionSpecified = false }; var partyByGln = router.GetPartyByGLN(getPartyByGln); if (partyByGln != null && partyByGln.partyDataLine != null && partyByGln.partyDataLine.Length > 0) { using (var companyRepository = _repositoryFactory.Build <IRepository <Company>, Company>()) { var manufacturer = partyByGln.partyDataLine[0]; Company company = null; var matchingCompanies = companyRepository.Find(x => x.CompanyName == manufacturer.partyName); if (!matchingCompanies.Any()) { company = _gepirCompanyMapper.Map(manufacturer); companyRepository.Add(company); companyRepository.Persist(); } else if (matchingCompanies.Count() == 1) { company = matchingCompanies.First(); } // If we added or found the correct company if (company != null) { //Todo: This should actually be done within the repository var brandOwner = brandRepository.FindDomainObject(company); brand.Owner = brandOwner; } brandRepository.Persist(); using (var productRepository = _repositoryFactory.Build <IProductRepository, Product>()) { // If product doesn't exist in database yet - add it. if (!productRepository.Find(x => x.GlobalTradeItemNumber == gtin).Any()) { gepirProduct.gtin = gtin; var newProduct = _gepirProductMapper.Map(gepirProduct); productRepository.Add(newProduct); productRepository.Persist(); } } } } } } if (brand != null && brand.Owner == null) { } } }
public MerchantDetail_BrandDTO(Brand Brand) { this.Id = Brand.Id; this.Name = Brand.Name; this.CategoryId = Brand.CategoryId; }
public async Task DeleteAsync(Brand brand) { brand.IsDeleted = true; await UpdateAsync(brand); }
public void Add(Brand brand) { _brandDal.Add(brand); }
public IResult Add(Brand brand) { _brandDal.Add(brand); return(new SuccessResult(Messages.BrandAdded)); }
public IResult Update(Brand brand) { _brandDal.Update(brand); return(new SuccessResult(Messages.BrandUpdated)); }
public void ReturnPropperData_WhenValidParametersAreParsed() { //Arrange var sessionMock = new Mock <IUserSession>(); var serviceMock = new Mock <ICarService>(); var brand = new Brand() { Name = "brand" }; var body = new BodyType() { Name = "body", NumberOfDoors = 1 }; var colorType = new ColorType() { Name = "type" }; var color = new Color() { Name = "color", ColorType = colorType, ColorTypeId = 1 }; var fuel = new FuelType() { Name = "fuel" }; var gearType = new GearType() { Name = "auto" }; var gear = new Gearbox() { GearType = gearType, NumberOfGears = 1 }; var car = new Car() { Model = "model", HorsePower = 100, EngineCapacity = 1000, IsSold = false, Price = 1000, ProductionDate = DateTime.Parse("12.12.2012"), BrandId = 1, Brand = brand, BodyTypeId = 1, BodyType = body, Color = color, ColorId = 1, FuelType = fuel, FuelTypeId = 1, GearBox = gear, GearBoxId = 1 }; var carId = 0; var cars = new List <Car>() { car }; serviceMock.Setup(s => s.GetCars("asc")).Returns(cars); var sut = new ListCommand(sessionMock.Object, serviceMock.Object); var args = new string[2] { "all", "asc" }; //Act var expected = $"Id:{carId} {brand.Name} {car.Model}, Engine: {car.EngineCapacity}cc {car.FuelType.Name} {car.HorsePower}hp, Body type {body.NumberOfDoors} door {body.Name}, Prod.: {car.ProductionDate.ToShortDateString()}, Price: {car.Price}, Color: {color.Name} {colorType.Name} Transmission: {gear.NumberOfGears} step {gear.GearType.Name} \r\nExtras: {string.Join(", ", car.CarsExtras)}\r\n"; var actual = sut.Execute(args); // Assert Assert.AreEqual(expected, actual); }