private void LoadData() { // Option for brand cbbBrand.DataSource = BrandBLL.FindAll(); cbbBrand.DisplayMember = "Name"; cbbBrand.ValueMember = "Name"; //cbbBrand.Hide(); // Option for purpose cbbPurpose.DataSource = PurposeBLL.FindAll(); cbbPurpose.DisplayMember = "Name"; cbbPurpose.ValueMember = "Name"; // Option for Price cbbPrice.DataSource = PriceBLL.FindAll(); cbbPrice.DisplayMember = "Name"; cbbPrice.ValueMember = "Name"; //cbbPrice.Hide(); // Option for color cbbColor.DataSource = ColorBLL.FindAll(); cbbColor.DisplayMember = "Name"; cbbColor.ValueMember = "Name"; //cbbColor.Hide(); // Option for gender cbbGender.DataSource = GenderBLL.FindAll(); cbbGender.DisplayMember = "Name"; cbbGender.ValueMember = "Name"; // Option for Object using cbbObjectUsing.DataSource = ObjectUsingBLL.FindAll(); cbbObjectUsing.DisplayMember = "Name"; cbbObjectUsing.ValueMember = "Name"; }
public IHttpActionResult CalcPrice([FromUri] int num, [FromUri] string city, [FromUri] string street, [FromUri] int numWeek) { try { double price = PriceBLL.CalcPrice(num, city, street, numWeek); return(Ok(price)); } catch (Exception e) { return(BadRequest()); } }
private void LoadEvent() { StringBuilder gd = new StringBuilder(""); GenderBLL.FindAll().ForEach(x => { gd.Append(x.ToString()); }); StringBuilder ou = new StringBuilder(); ObjectUsingBLL.FindAll().ForEach(x => { ou.Append(x.ToString()); }); StringBuilder pp = new StringBuilder(); PurposeBLL.FindAll().ForEach(x => { pp.Append(x.ToString()); }); StringBuilder pr = new StringBuilder(); PriceBLL.FindAll().ForEach(x => { pr.Append(x.ToString()); }); StringBuilder br = new StringBuilder(); BrandBLL.FindAll().ForEach(x => { br.Append(x.ToString()); }); StringBuilder cl = new StringBuilder(); ColorBLL.FindAll().ForEach(x => { cl.Append(x.ToString()); }); lbGD.Text = gd.ToString(); lbOU.Text = ou.ToString(); lbBR.Text = br.ToString(); lbCL.Text = cl.ToString(); lbPP.Text = pp.ToString(); lbPR.Text = pr.ToString(); }
public List <PricesDTO> GetAllPrices() { return(PriceBLL.GetAllPrices()); }
public async Task <IActionResult> Create(ItemCreateEditViewModel vm, IEnumerable <IFormFile> images) { vm.AppUserId = User.UserGuidId(); if (ModelState.IsValid) { var bllEntity = _mapper.Map(vm); _bll.Items.Add(bllEntity); await _bll.SaveChangesAsync(); vm.Id = bllEntity.Id; // Add item ownership var itemOwnershipBLL = new ItemOwnershipBLL(); itemOwnershipBLL.AppUserId = User.UserGuidId(); itemOwnershipBLL.CompanyId = vm.CompanyId == Guid.Empty ? null : vm.CompanyId; itemOwnershipBLL.ItemId = bllEntity.Id; _bll.ItemOwnerships.Add(itemOwnershipBLL); await _bll.SaveChangesAsync(); if (images != null) { foreach (var file in images) { using (var ms = new MemoryStream()) { //image.Save(ms, new PngEncoder()); var imageBLL = new ImageBLL(); imageBLL.AppUserId = User.UserGuidId(); await file.CopyToAsync(ms); imageBLL.Picture = ms.ToArray(); imageBLL.ItemId = bllEntity.Id; _bll.Images.Add(imageBLL); } } await _bll.SaveChangesAsync(); } // Add category to item var itemCategoryBLL = new ItemCategoryBLL(); itemCategoryBLL.AppUserId = User.UserGuidId(); itemCategoryBLL.CategoryId = vm.CategoryId; itemCategoryBLL.ItemId = bllEntity.Id; _bll.ItemCategories.Add(itemCategoryBLL); await _bll.SaveChangesAsync(); // Add prices var priceDayBLL = new PriceBLL(); priceDayBLL.AppUserId = User.UserGuidId(); priceDayBLL.ItemPrice = vm.ItemDayPrice; priceDayBLL.ItemId = bllEntity.Id; priceDayBLL.RentalPeriodId = _bll.RentalPeriods.GetRentalPeriodId("Päev"); _bll.Prices.Add(priceDayBLL); var priceWeekBLL = new PriceBLL(); priceWeekBLL.AppUserId = User.UserGuidId(); priceWeekBLL.ItemPrice = vm.ItemWeekPrice; priceWeekBLL.ItemId = bllEntity.Id; priceWeekBLL.RentalPeriodId = _bll.RentalPeriods.GetRentalPeriodId("Nädal"); _bll.Prices.Add(priceWeekBLL); var priceMonthBLL = new PriceBLL(); priceMonthBLL.AppUserId = User.UserGuidId(); priceMonthBLL.ItemPrice = vm.ItemMonthPrice; priceMonthBLL.ItemId = bllEntity.Id; priceMonthBLL.RentalPeriodId = _bll.RentalPeriods.GetRentalPeriodId("Kuu"); _bll.Prices.Add(priceMonthBLL); await _bll.SaveChangesAsync(); // Add item descriptions if (vm.ItemDescription != null || vm.ItemDescription !.Length != 0) { var itemDescriptionBLL = new ItemDescriptionBLL() { AppUserId = User.UserGuidId(), Description = vm.ItemDescription, ProductDescriptionId = vm.ProductDescriptionId, ItemId = bllEntity.Id }; _bll.ItemDescriptions.Add(itemDescriptionBLL); } if (vm.Descriptions != null && vm.Descriptions !.Count != 0) { for (int i = 0; i < vm.Descriptions.Count; i++) { if (vm.Descriptions[i].Length != 0) { var itemDescriptionBLL = new ItemDescriptionBLL() { AppUserId = User.UserGuidId(), Description = vm.Descriptions[i], ProductDescriptionId = vm.ProductDescriptionIds ![i],