public async Task <IActionResult> PutPriceCategory(Guid id, PriceCategory priceCategory) { if (id != priceCategory.PriceCategoryId) { return(BadRequest()); } _context.Entry(priceCategory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PriceCategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// Создание нового кода /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void CreateMap_Click(object sender, EventArgs e) { string ShortNumber = SN_Code_Publish.SN.Text; PriceCategory pc = db.PriceCategory_by_SN(ShortNumber); string Code = SN_Code_Publish.Code.Text; // Предотвращение повторной публикации if (db.Maps.Count(t => t.idMe == map.Me.id && t.idPriceCategory == pc.id && t.code == Code) > 0) { MessageBox.Show("Серия уже опубликована с кодом " + Code + " на номер " + ShortNumber, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var map1 = new Map { idBasketCollection = (int)BasketCollectionEnum.main, Me = map.Me, idPriceCategory = pc.id, code = Code, idSellType = (int)SellTypeEnum.Серия_SMS, idSellSection = (int)chooseSellSection.SelectSellSectionId.SelectedValue, }; db.Maps.InsertOnSubmit(map1); MessageBox.Show("Опубликован с кодом " + Code + " на номер " + ShortNumber, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); db.SubmitChanges(); SaveChanges.Enabled = false; }
public CosmeticProduct(string productName, string brand, PriceCategory priceCategoryOfProduct, Color Color) { this.ProductName = productName; this.Brand = brand; this.PriceCategoryOfProduct = priceCategoryOfProduct; this.Color = Color; }
public PriceBaseSpec(Money start_price, PriceCategory category, GrfSpecFeature grf_feature, Price fallback_price) { this.start_price = start_price; this.category = category; this.grf_feature = grf_feature; this.fallback_price = fallback_price; }
public LipProduct(string ProductName, string Brand, PriceCategory PriceCategoryOfProduct, Color Color, string Aromatizer) : base(ProductName, Brand, PriceCategoryOfProduct, Color) { this.Aromatizer = Aromatizer; this.Color = Color; }
public Mascara(string productName, string brand, PriceCategory priceCategoryOfProduct, Color Color, bool IsWaterpoof, string Effect, MaterialOfBrush BrushMaterial, FormOfBrush BrushForm) : base(productName, brand, priceCategoryOfProduct, Color, IsWaterpoof) { this.IsWaterproof = IsWaterproof; this.BrushForm = BrushForm; this.BrushMaterial = BrushMaterial; }
public async Task <ActionResult <PriceCategory> > PostPriceCategory(PriceCategory priceCategory) { _context.PriceCategory.Add(priceCategory); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPriceCategory", new { id = priceCategory.Id }, priceCategory)); }
public ActionResult BookGroupTrip(GroupTripModel groupTripModel) { if (!SessionManager.userIsLoggedIn()) { return(new HttpStatusCodeResult(403)); } if (ModelState.IsValid) { Route route = BL.MainClass.Instance.getRoutes().Find(v => v.id == groupTripModel.routeId); TripType triptype = BL.MainClass.Instance.getTripTypes().Find(v => v.id == groupTripModel.tripTypeId); Ship ship = BL.MainClass.Instance.getShips().Find(v => v.id == groupTripModel.shipTypeId); // Select dummy price categories because of project finish time reasons PriceCategory children = MainClass.Instance.getPriceCategories().Find(v => v.name == "Children"); if (children == null) { BL.PersonCategory pc = new BL.PersonCategory("Children"); MainClass.Instance.addPersonCategory(pc); MainClass.Instance.addPriceCategory(new BL.PriceCategory("Children", triptype, pc, 4, route)); } PriceCategory adults = MainClass.Instance.getPriceCategories().Find(v => v.name == "Adults"); if (adults == null) { BL.PersonCategory pc = new BL.PersonCategory("Adults"); MainClass.Instance.addPersonCategory(pc); MainClass.Instance.addPriceCategory(new BL.PriceCategory("Adults", triptype, pc, 7, route)); } BL.GroupTrip groupTrip = new GroupTrip(route, groupTripModel.depatureTime, triptype, ship); groupTrip.setPersonsOnBoard(children, groupTripModel.children); groupTrip.setPersonsOnBoard(adults, groupTripModel.adults); if (MainClass.Instance.canOrderGroupTrip(groupTrip)) { groupTripModel.totalPrice = groupTrip.getTotalPrice(); groupTripModel.ship = ship; groupTripModel.tripType = triptype; groupTripModel.route = route; groupTripModel.finalGroupTrip = groupTrip; groupTripModel.routeName = route.getRouteString(); groupTripModel.adultPrice = adults.price; groupTripModel.childPrice = children.price; groupTripModel.driveTimeMinutes = (int)groupTrip.getTotalDriveTimeMinutes(); groupTripModel.returnTime = groupTrip.returnTime; System.Web.HttpContext.Current.Session["groupTrip"] = groupTripModel; return(RedirectToAction("OrderGroupTrip", "Trip")); } } ViewBag.Status = false; ViewBag.Message = "Group trip can not be ordered. Please make sure you enter the correct depature time " + "and number of persons not bigger than the capacity according to the price category."; return(initialGroupTripView()); }
private void pricecategorykryptonComboBox4_SelectedIndexChanged(object sender, EventArgs e) { priceCategorykryptonTextBox1.Text = ""; if (pricecategorykryptonComboBox4.SelectedItem != null) { PriceCategory p = (PriceCategory)pricecategorykryptonComboBox4.SelectedItem; priceCategorykryptonTextBox1.Text = p.NAME; } }
public Part(int makerId, string model, double price, string name, string description) { MakerId = makerId; Model = model; Price = price; Name = name; Description = description; PriceId = price < 10_000 ? PriceCategory.Low : price >= 10_000 && price < 30_000 ? PriceCategory.Average : PriceCategory.High; }
private void removeRecord(int id) { foreach (DataGridViewRow item in gridData.Rows) { PriceCategory dep = (PriceCategory)item.Tag; if (dep.ID == id) { gridData.Rows.Remove(item); break; } } gridData.ClearSelection(); }
private void updateRecord() { foreach (DataGridViewRow item in gridData.Rows) { PriceCategory dep = (PriceCategory)item.Tag; if (dep.ID == m_pricecat.ID) { gridData[0, item.Index].Value = m_pricecat.CODE; gridData[1, item.Index].Value = m_pricecat.NAME; break; } } }
public void X(string Автор, string Произведение) { IQueryable <Me> mes = db.Mes.Where(t => t.idMeType == (int)MeTypeEnum.Realtones && t.MePropValues.Count( r => r.sVal == Произведение && r.idProp == (int)MePropertyEnum.song) > 0 && t.MePropValues.Count(r => r.sVal == Автор) > 0); if (mes.Count() > 1) { throw new Exception("Больше одного совпадения МЭ!"); } if (mes.Count() < 1) { throw new Exception("МЭ не найден!"); } Debug.Assert(mes.Count() == 1); Me me = mes.First(); // PriceCategory PriceCategory pc = db.PriceCategory_Configurations_sns.Where(t => t.sn == (string)Короткий_номер.SelectedItem).First(). PriceCategory; if (pc == null) { throw new Exception("Не найдена ценовая категория!"); } IEnumerable <Map> maps = CSS.sellSection.Maps.Where(t => t.idMe == me.id && t.idPriceCategory == pc.id); if (maps.Count() == 0) { // Генерируем код Console.WriteLine("Генерируем код"); bool Занят; do { Занят = db.Maps.Count(t => t.idPriceCategory == pc.id && t.code == СтартовыйКод.Text) > 0; if (Занят) { Console.WriteLine("Код - " + СтартовыйКод.Text + " - занят"); code++; } } while (Занят); db.Опубликовать(Короткий_номер.Text, СтартовыйКод.Text, me, (SellSectionEnum)CSS.sellSection.id); } else { Console.WriteLine(Автор + "\t" + Произведение + "\t" + maps.First().code); } }
public void ClearForm() { try { textBoxCode.Text = ""; textBoxName.Text = ""; discountkryptonNumericUpDown1.Value = 0; m_pricecat = new PriceCategory(); errorProvider1.Clear(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void gridData_SelectionChanged(object sender, EventArgs e) { if (gridData.SelectedRows.Count == 0) { return; } ClearForm(); m_pricecat = (PriceCategory)gridData.SelectedRows[0].Tag; if (m_pricecat == null) { return; } loadData(); setEnableForm(false); setEditMode(EditMode.View); }
public void PriceCategoryDeleteNegativeTest() { var id = 1; PriceCategory priceCategory = null; var toDTOMapper = new MapperConfiguration(cfg => cfg.CreateMap <PriceCategory, PriceCategoryDTO>()).CreateMapper(); var priceCategoryDTO = toDTOMapper.Map <PriceCategory, PriceCategoryDTO>(priceCategory); PriceCategoryServiceMock.Setup(a => a.Get(id)).Returns(priceCategoryDTO); PriceCategoryController controller = new PriceCategoryController(PriceCategoryServiceMock.Object); var httpResponse = controller.Delete(httpRequest, id); var result = httpResponse.StatusCode; Assert.AreEqual(HttpStatusCode.NotFound, result); }
public void PriceCategoryGetNegativeTest() { int id = 10; PriceCategory priceCategory = null; PriceCategoryDTO priceCategoryDTO = null; EFWorkUnitMock.Setup(x => x.PriceCategories.Get(id)).Returns(priceCategory); PriceCategoryServiceMock.Setup(a => a.Get(id)).Returns(priceCategoryDTO); var priceCategoryService = new PriceCategoryService(EFWorkUnitMock.Object); PriceCategoryController controller = new PriceCategoryController(PriceCategoryServiceMock.Object); var httpResponse = controller.Get(httpRequest, id); var result = httpResponse.StatusCode; var expected = HttpStatusCode.NotFound; Assert.AreEqual(expected, result); }
/// <summary> /// Создание нового элемента с выбранным номером и кодом /// </summary> public void CreateNewSeries() { Assert.IsTrue(SN_Code.Code.Text.Length > 0); Assert.IsTrue(SN_Code.SN.Text.Length > 0); PriceCategory pc = db.PriceCategory_by_SN(SN_Code.SN.Text); var me = new Me { idMeRetrieveWay = (int)MeRetrieveWayEnum.Файлы_не_хранятся, idMeType = (int)MeTypeEnum.RandomText }; db.Mes.InsertOnSubmit(me); map = new Map { idBasketCollection = (int)BasketCollectionEnum.main, Me = me, idPriceCategory = pc.id, code = SN_Code.Code.Text }; db.Maps.InsertOnSubmit(map); }
/// <summary> /// Adds price information to the article. /// </summary> /// <param name="category">The category of the price (e.g. "RRP" or "Offer").</param> /// <param name="price">The actual price of the article specified in the smalles unit of the currency (e.g. Cent).</param> /// <param name="quantity">The quantity from which the price is valid.</param> /// <param name="basePrice">The base price of the article.</param> /// <param name="basePriceUnit">The base price is specified in (e.g. "100ml).</param> /// <param name="vat">The VAT of the article.</param> /// <param name="description">The description of the price information (e.g. name of a special offer).</param> void IDigitalShelfArticle.AddPriceInformation(PriceCategory category, decimal price, uint quantity, decimal basePrice, string basePriceUnit, string vat, string description) { if (this.PriceInformation == null) { this.PriceInformation = new List <PriceInformation>(); } var priceInformation = new PriceInformation() { Category = TextConverter.EscapeInvalidXmlChars(category.ToString()), Price = price.ToString(CultureInfo.InvariantCulture), Quantity = quantity.ToString(), BasePrice = basePrice.ToString(CultureInfo.InvariantCulture), BasePriceUnit = TextConverter.EscapeInvalidXmlChars(basePriceUnit), VAT = TextConverter.EscapeInvalidXmlChars(vat), Description = TextConverter.EscapeInvalidXmlChars(description) }; this.PriceInformation.Add(priceInformation); }
public async Task <ActionResult <PriceCategory> > PostPriceCategory(PriceCategory priceCategory) { _context.PriceCategory.Add(priceCategory); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (PriceCategoryExists(priceCategory.PriceCategoryId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetPriceCategory", new { id = priceCategory.PriceCategoryId }, priceCategory)); }
public PriceInformation(PriceCategory category, decimal price, String?description, String?basePriceUnit, int?basePrice, int?quantity, decimal?vat) { price.ThrowIfNotPositive(); basePrice?.ThrowIfNotPositive(); quantity?.ThrowIfNotPositive(); this.Category = category; this.Price = price; this.Description = description; this.BasePriceUnit = basePriceUnit; this.BasePrice = basePrice; this.Quantity = quantity; this.Vat = vat; }
public void Save(object sender, EventArgs e) { try { if (Valid()) { this.Cursor = Cursors.WaitCursor; UpdateEntity(); if (m_pricecat.ID == 0) { RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.PRICE_CATEGORY_REPOSITORY).Save(m_pricecat); PriceCategory bank = (PriceCategory)RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.PRICE_CATEGORY_REPOSITORY).GetByCode(m_pricecat); int r = gridData.Rows.Add(bank.CODE, bank.NAME); gridData.Rows[r].Tag = bank; } else { RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.PRICE_CATEGORY_REPOSITORY).Update(m_pricecat); updateRecord(); } KryptonMessageBox.Show("Record has been saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); gridData.ClearSelection(); ClearForm(); textBoxCode.Focus(); this.Cursor = Cursors.Default; } } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }
public Foundation(string ProductName, string Brand, PriceCategory PriceCategoryOfProduct, Color Color, SkinType TypeOfSkin, TypeOfFinish Finish, GradeOfCoverage Coverage, bool isSPF) : base(ProductName, Brand, PriceCategoryOfProduct, Color, TypeOfSkin, Finish) { this.isSPF = isSPF; this.Coverage = Coverage; }
public PriceCategoryDto(PriceCategory c) : base(c) { }
public Tint(string ProductName, string Brand, PriceCategory PriceCategoryOfProduct, Color Color, string Aromatizer, int Durability, string ApplicationOfProduct) : base(ProductName, Brand, PriceCategoryOfProduct, Color, Aromatizer) { this.Durability = Durability; this.ApplicationOfProduct = ApplicationOfProduct; }
public static string GetPriceCatString(this PriceCategory category) { int value = (int)category; return(new String('€', value + 1)); }
public NailPolish(string ProductName, string Brand, PriceCategory PriceCategoryOfProduct, Color Color, int Durability, TypesOfEffects SpecialEffect) : base(ProductName, Brand, PriceCategoryOfProduct, Color) { this.Durability = Durability; this.SpecialEffect = SpecialEffect; }
public Eyeshadow(string productName, string brand, PriceCategory priceCategoryOfProduct, Color Color, bool IsWaterpoof, string Effect, KindOfEyeshadow EyeshadowTexture, FormOfPackage PackageType) : base(productName, brand, priceCategoryOfProduct, Color, IsWaterpoof) { this.EyeshadowTexture = EyeshadowTexture; this.PackageType = PackageType; }
public EyesProduct(string productName, string brand, PriceCategory priceCategoryOfProduct, Color Color, bool isWaterpoof) : base(productName, brand, priceCategoryOfProduct, Color) { this.IsWaterproof = IsWaterproof; }
public Lipstick(string ProductName, string Brand, PriceCategory PriceCategoryOfProduct, Color Color, string Aromatizer, TypeOfPackage PackageType, TypeOfFinish Finish) : base(ProductName, Brand, PriceCategoryOfProduct, Color, Aromatizer) { this.PackageType = PackageType; this.Finish = Finish; }