本文整理汇总了C#中DataBase.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.GetItem方法的具体用法?C# DataBase.GetItem怎么用?C# DataBase.GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.GetItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LinkButtonItemsSelect_Click
protected void LinkButtonItemsSelect_Click(object sender, EventArgs e)
{
Log.Debug("Select");
string selectedValue = dropDownListManageItemsBodyItemsSelect.SelectedValue;
Log.DebugFormat("Selected value is '{0}'", selectedValue);
DataBase dataBase = new DataBase();
Item item = dataBase.GetItem(selectedValue);
if (item == null)
{
Log.WarnFormat("Selected item '{0}' not found in DB", selectedValue);
return;
}
PopulateItemTypes();
textBoxManageItemsBodyItemsSubmitItemId.Text = item.Id;
textBoxManageItemsBodyItemsSubmitItemName.Text = item.Name;
textBoxManageItemsBodyItemsSubmitNote.Text = item.Notes;
dropDownListManageItemsBodyItemsSubmitItemType.SelectedValue = item.ItemType.ToString();
EnableUpdate();
HttpCookie cookie = Request.Cookies[CookieItemuniqueid];
if (cookie == null)
{
cookie = new HttpCookie(CookieItemuniqueid);
}
cookie["Name"] = item.UniqueId.ToString();
cookie.Expires = DateTime.Now.AddMinutes(15);
Log.InfoFormat("Adding new cookie '{0}'", cookie["Name"]);
Response.Cookies.Add(cookie);
}
示例2: LinkButtonAddItemToShopClick
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();
}