当前位置: 首页>>代码示例>>C#>>正文


C# DataBase.GetItem方法代码示例

本文整理汇总了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);
 }
开发者ID:trippleflux,项目名称:jezatools,代码行数:28,代码来源:ManageItems.aspx.cs

示例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();
 }
开发者ID:trippleflux,项目名称:jezatools,代码行数:41,代码来源:ManageShopItems.aspx.cs


注:本文中的DataBase.GetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。