protected void LinkButtonAddItemToShopClick(object sender, EventArgs e) { Log.Debug("Add Item To Shop"); DataBase dataBase = new DataBase(); string selectedItem = dropDownListManageShopItemsBodyInputItems.SelectedValue; Item item = dataBase.GetItem(new Guid(selectedItem)); if (item == null) { return; } string selectedShop = dropDownListManageShopItemsBodyInputShops.SelectedValue; Shop shop = dataBase.GetShop(selectedShop); if (shop == null) { return; } string gross = textBoxManageShopItemsBodyInputPriceGross.Text.Trim(); string net = textBoxManageShopItemsBodyInputPriceNet.Text.Trim(); if (gross.Length < 1 || net.Length < 1) { Log.WarnFormat("Price not in correct format! Gross='{0}', Net='{1}'", gross, net); return; } Double priceGross = Double.Parse(gross); Double priceNet = Double.Parse(net); int numberOfItems = Misc.String2Number(textBoxManageShopItemsBodyInputNumberOfItems.Text.Trim()); Price price = new Price(priceGross, priceNet) {ItemId = item.UniqueId, ShopId = shop.Id}; if (!dataBase.InsertPrice(price)) { return; } ShopItem shopItem = new ShopItem { ItemId = item.UniqueId, ShopId = shop.Id, PriceId = price.Id, DateTime = new DateTime(DateTime.Now.Ticks), }.SetNumberOfItems(numberOfItems); dataBase.InsertShopItem(shopItem); Populate(); }