public override string ToString() { var sb = new StringBuilder("Item("); int tmp1 = 0; if (__isset.uid) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("Uid: "); Uid.ToString(sb); } if (__isset.itemId) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("ItemId: "); ItemId.ToString(sb); } if (__isset.count) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("Count: "); Count.ToString(sb); } sb.Append(')'); return(sb.ToString()); }
public override void WriteXml(XmlWriter writer) { writer.WriteAttributeString("ActionType", ActionType.ToString()); writer.WriteAttributeString("ItemTarget", ItemTarget.ToString()); writer.WriteAttributeString("ItemQuality", ItemQuality.ToString()); writer.WriteAttributeString("ItemId", ItemId.ToString()); }
private string GetUrl(string baseUrl, string queryString) { string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container; baseUrl = baseUrl.TrimEnd('/'); var itemIdString = ItemId.ToString("N"); if (MediaType == DlnaProfileType.Audio) { if (StringHelper.EqualsIgnoreCase(SubProtocol, "hls")) { return(string.Format("{0}/audio/{1}/master.m3u8?{2}", baseUrl, itemIdString, queryString)); } return(string.Format("{0}/audio/{1}/stream{2}?{3}", baseUrl, itemIdString, extension, queryString)); } if (StringHelper.EqualsIgnoreCase(SubProtocol, "hls")) { return(string.Format("{0}/videos/{1}/master.m3u8?{2}", baseUrl, itemIdString, queryString)); } return(string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, itemIdString, extension, queryString)); }
public static bool CheckIDExistance(ItemId id) { int taskid; bool answer = false; SqlCeCommand selectcmd = new SqlCeCommand(); selectcmd.Connection = con; selectcmd.CommandType = CommandType.Text; selectcmd.CommandText = "Select * from Tasks;"; adpt.SelectCommand = selectcmd; adpt.Fill(ds, "tasks"); string s = id.ToString(); foreach (DataRow dr in ds.Tables["tasks"].Rows) { taskid = Int32.Parse(dr["Task_ID"].ToString()); string ts = taskid.ToString(); if (ts.Equals(s)) { answer = true; } else { answer = false; } } con.Close(); return(answer); }
public static bool DeleteTaskFromDb(ItemId i) { SqlCeCommand insertCmd = new SqlCeCommand(); bool answer; // see if record deletion is successful or not try { con.ConnectionString = @"Data Source=Program Files\GPSReminder\TasksAndPlaces.sdf; password=''"; con.Open(); insertCmd.Connection = con; insertCmd.CommandType = CommandType.Text; int i1 = 0; // count deleted rows insertCmd.CommandText = "DELETE FROM Tasks where Task_ID=" + i.ToString(); i1 = insertCmd.ExecuteNonQuery(); con.Close(); if (i1 > 0) { answer = true; } else { answer = false; } } catch (Exception) { answer = false; } return(answer); }
public void Initialize(ItemId itemId, ItemParams itemParams, bool shop = false) { Icon.sprite = ImageCollection.Instance.GetIcon(itemId); Name.text = SplitName(itemId.ToString()); Description.text = $"Here will be {itemId} description soon..."; if (itemParams.Tags.Contains(ItemTag.NotForSale)) { Price.text = null; } else if (shop) { Price.text = $"Buy price: {itemParams.Price}G{Environment.NewLine}Sell price: {itemParams.Price / Shop.SellRatio}G"; } else { Price.text = $"Sell price: {itemParams.Price / Shop.SellRatio}G"; } var description = new List <string> { $"Type: {itemParams.Type}" }; if (itemParams.Tags.Any()) { description[description.Count - 1] += $" <color=grey>[{string.Join(", ", itemParams.Tags.Select(i => $"{i}").ToArray())}]</color>"; } foreach (var attribute in itemParams.Properties) { description.Add($"{SplitName(attribute.Id.ToString())}: {attribute.Value}"); } Description.text = string.Join(Environment.NewLine, description.ToArray()); }
protected override IDictionary <string, object> GetUriPathParameters() { var uriParams = base.GetUriPathParameters(); uriParams.Add("username", Username); var isTypeSetAndValid = Type != null && Type != TraktSyncItemType.Unspecified; if (isTypeSetAndValid) { uriParams.Add("type", Type.UriName); } if (ItemId.HasValue && ItemId.Value > 0) { uriParams.Add("item_id", ItemId.ToString()); } if (StartAt.HasValue) { var startAt = StartAt.Value.ToUniversalTime(); uriParams.Add("start_at", startAt.ToTraktLongDateTimeString()); } if (EndAt.HasValue) { var endAt = EndAt.Value.ToUniversalTime(); uriParams.Add("end_at", endAt.ToTraktLongDateTimeString()); } return(uriParams); }
/// <summary> /// Handles the textChanged event of the txtEditDescription control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void txtEditDescription_textChanged(object sender, EventArgs e) { int ItemId, itemType; decimal itemPrice; if (HItemName.Value != "") { String[] itemCodes = HItemName.Value.Split(';'); { ItemId = Convert.ToInt32(itemCodes[0]); itemType = Convert.ToInt32(itemCodes[1]); itemPrice = Convert.ToDecimal(itemCodes[2]); GridViewRow row = (GridViewRow)((TextBox)sender).NamingContainer; Label lblNewUnitPrice = (Label)row.FindControl("lblEditUnitPrice"); // Label lblNewAmountPrice = (Label)row.FindControl("lblEditAmount"); // TextBox txtNewQuantity = (TextBox)row.FindControl("txtEditQuantity"); lblNewUnitPrice.Text = itemPrice.ToString(); // lblNewAmountPrice.Text =( itemPrice * int.Parse(txtNewQuantity.Text)).ToString(); HItemID.Value = ItemId.ToString(); HItemName.Value = itemType.ToString(); HItemTypeID.Value = itemType.ToString(); } } else { ((TextBox)sender).Text = ""; HItemName.Value = ""; } }
public static string GetReward(this QuestRewardType type, int pokemonId, int amount, ItemId item, bool isDitto = false, bool isShiny = false) { switch (type) { case QuestRewardType.AvatarClothing: return("Avatar Clothing"); case QuestRewardType.Candy: return($"{amount.ToString("N0")} Rare Candy"); case QuestRewardType.Experience: return($"{amount.ToString("N0")} XP"); case QuestRewardType.Item: return($"{amount.ToString("N0")} {item.ToString().Replace("_", " ")}"); case QuestRewardType.PokemonEncounter: return((isShiny ? $"**SHINY** " : "") + Database.Instance.Pokemon[isDitto ? 132 : pokemonId].Name); case QuestRewardType.Quest: return("Quest"); case QuestRewardType.Stardust: return($"{amount.ToString("N0")} Stardust"); } return("Unknown"); }
protected void chkSelect_CheckedChanged(object sender, EventArgs e) { int ItemId, qty; string ItemCode, IssOff; conn = obje.NewConnection(); for (int i = 0; i < dtgReturnItems.Rows.Count; i++) { GridViewRow row = dtgReturnItems.Rows[i]; CheckBox ch = (CheckBox)dtgReturnItems.Rows[i].FindControl("chkSelect"); if (ch.Checked == true) { ItemId = int.Parse(dtgReturnItems.DataKeys[i].Values[0].ToString()); cmbItemName.SelectedValue = ItemId.ToString(); ItemCode = dtgReturnItems.Rows[row.RowIndex].Cells[3].Text.ToString(); txtItemCode.Text = ItemCode.ToString(); qty = int.Parse(dtgReturnItems.Rows[row.RowIndex].Cells[5].Text.ToString()); txtQty.Text = qty.ToString(); IssOff = dtgReturnItems.Rows[row.RowIndex].Cells[4].Text.ToString(); OdbcCommand Sel = new OdbcCommand("SELECT store_id FROM m_sub_store WHERE storename='" + IssOff.ToString() + "' and rowstatus<>'2'", conn); OdbcDataReader Selr = Sel.ExecuteReader(); if (Selr.Read()) { StId = Convert.ToInt32(Selr[0].ToString()); } cmbReceivingStore.SelectedItem.Text = IssOff.ToString(); cmbReceivingStore.SelectedValue = StId.ToString(); } else { } } conn.Close(); }
public void UpdateAvailableItems() { //am I looking for children or items if (!_allowSearch) { if (_flatView && _allowSearch) { //get all item types //this._itemTypeId lstItems.DataSource = Item.GetItems(_itemTypeId, PortalId); lstItems.DataTextField = "listName"; lstItems.DataValueField = "itemId"; DataBind(); ListItem li = lstItems.Items.FindByValue(ItemId.ToString(CultureInfo.InvariantCulture)); lstItems.Items.Remove(li); } else { lstItems.Items.Clear(); var ir = new ItemRelationship { ParentItemId = _parentItemId, ItemTypeId = _itemTypeId, RelationshipTypeId = _listRelationshipTypeId }; ir.DisplayChildren(lstItems, PortalId, ExcludeCircularRelationships ? VersionInfoObject.ItemId : (int?)null); } } //look for children }
protected override XmlElement ExecuteMove(ItemUri itemUri, ItemId newParentId) { Debug.ArgumentNotNull(itemUri, nameof(itemUri)); Debug.ArgumentNotNull(newParentId, nameof(newParentId)); return(DataService.MoveTo(itemUri.ItemId.ToString(), newParentId.ToString(), itemUri.DatabaseName.Name, GetCredentials())); }
/* Update the Audit Table */ public void PushUpdatesToAuditTable(String action, ItemId itemId) { SqlConnection connection = DBConnection(); using (connection) { SqlCommand cmd = new SqlCommand("INSERT INTO CONTACTLOG(ContactID, DisplayName, Alias, AssistantName, BusinessHomePage, CompanyName, " + "CompleteName, Department, DirectoryId, FileAs, Generation, GivenName, " + "JobTitle, Manager, Mileage, NickName, Notes, OfficeLocation, PhoneticFirstName, " + "PhoneticFullName, PhoneticLastName, Profession, SpouseName, Surname) (SELECT ContactID, DisplayName, Alias, AssistantName, BusinessHomePage, CompanyName, " + "CompleteName, Department, DirectoryId, FileAs, Generation, GivenName, " + "JobTitle, Manager, Mileage, NickName, Notes, OfficeLocation, PhoneticFirstName, " + "PhoneticFullName, PhoneticLastName, Profession, SpouseName, Surname FROM CONTACTS WHERE ContactID = @ID)"); cmd.CommandType = CommandType.Text; cmd.Connection = connection; cmd.Parameters.AddWithValue("@ID", itemId.ToString()); cmd.ExecuteNonQuery(); SqlCommand cmd2 = new SqlCommand("UPDATE CONTACTLOG SET Action = @Action, ActionDate = @ActionDate WHERE Action IS NULL"); cmd2.CommandType = CommandType.Text; cmd2.Connection = connection; cmd2.Parameters.AddWithValue("@Action", action); cmd2.Parameters.AddWithValue("@ActionDate", DateTime.Now); cmd2.ExecuteNonQuery(); } }
public static void Load() { ResetData(); sSelectedCharacter = (SelectedCharacter)PlayerPrefs.GetInt("PlayerCharacter", (int)sSelectedCharacter); sNumBankedHearts = PlayerPrefs.GetInt("NumBankedHearts", sNumBankedHearts); sNumHearts = PlayerPrefs.GetInt("NumHearts", sNumHearts); sCurrentFloor = PlayerPrefs.GetInt("CurrentFloor", sCurrentFloor); sNumAmmo = PlayerPrefs.GetInt("NumAmmo", sNumAmmo); sMaxAmmo = PlayerPrefs.GetInt("MaxAmmo", sMaxAmmo); for (int i = 0, n = (int)ItemId.NumItems; i < n; ++i) { ItemId itemId = (ItemId)i; if (PlayerPrefs.GetInt(string.Format("Item_{0}", itemId.ToString()), 0) > 0) { sCollectedItems.Add(itemId); } } for (int i = 0, n = (int)BossId.NumBosses; i < n; ++i) { BossId bossId = (BossId)i; if (PlayerPrefs.GetInt(string.Format("Boss_{0}", bossId.ToString()), 0) > 0) { sBossesDefeated.Add(bossId); } } sActiveBoss = (BossId)PlayerPrefs.GetInt("ActiveBoss", (int)sActiveBoss); sGameLoaded = true; }
/// <summary> /// Handles the textChanged event of the txtNewDescription control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void txtNewDescription_textChanged(object sender, EventArgs e) { // IQCareUtils theUtils = new IQCareUtils(); // DataView theAutoDV; // DataView theExistsDV; // DataTable theDT = (DataTable)Session["billingInformation"]; int ItemId, itemType; decimal itemPrice; if (HItemName.Value != "") { try { String[] itemCodes = HItemName.Value.Split(';'); if (itemCodes.Length == 3) { ItemId = Convert.ToInt32(itemCodes[0]); itemType = Convert.ToInt32(itemCodes[1]); //////IBilling bMgr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling,BusinessProcess.SCM");//Marked by Jayant for SCM Price changes //////itemPrice = bMgr.GetItemPrice(ItemId, itemType, DateTime.Parse(this.SelectedDate.ToString("dd-MMM-yyyy"))); // Bug ID 158..... //if (itemPrice == 0.00M) //{ // ((TextBox)sender).Text = ""; // HItemName.Value = ""; //} itemPrice = Convert.ToDecimal(itemCodes[2]); GridViewRow row = (GridViewRow)((TextBox)sender).NamingContainer; Label lblNewUnitPrice = (Label)row.FindControl("lblNewUnitPrice"); Label lblNewAmountPrice = (Label)row.FindControl("lblNewAmountPrice"); TextBox txtNewQuantity = (TextBox)row.FindControl("txtNewQuantity"); // TextBox txtnewItemId = (TextBox)row.FindControl("txtNewitemId"); // TextBox txtNewItemType = (TextBox)row.FindControl("txtNewItemType"); //txtnewItemId.Text = ItemId.ToString(); //txtNewItemType.Text = itemType.ToString(); lblNewUnitPrice.Text = itemPrice.ToString(); // lblNewAmountPrice.Text =( itemPrice * int.Parse(txtNewQuantity.Text)).ToString(); HItemID.Value = ItemId.ToString(); HItemName.Value = itemType.ToString(); HItemTypeID.Value = itemType.ToString(); } } catch (Exception ex) { showErrorMessage(ref ex); ((TextBox)sender).Text = ""; HItemName.Value = ""; } } else { ((TextBox)sender).Text = ""; HItemName.Value = ""; } }
public override void WriteXml(XmlWriter writer) { writer.WriteAttributeString("Entry", Entry.ToString()); writer.WriteAttributeString("Repeat", Repeat.ToString()); writer.WriteAttributeString("RepeatType", RepeatType.ToString()); writer.WriteAttributeString("CastOnItem", CastOnItem.ToString()); writer.WriteAttributeString("ItemId", ItemId.ToString()); writer.WriteAttributeString("ItemType", ItemType.ToString()); }
public static async Task Execute(Session session, ItemId itemId, int count) { var response = await session.Client.Inventory.RecycleItem(itemId, count); if (response.Result == RecycleInventoryItemResponse.Types.Result.Success) { Logger.Write( $"Recycled {count}x {itemId.ToString().Substring(4)}", LogLevel.Recycling); } else { Logger.Write( $"Unable to recycle {count}x {itemId.ToString().Substring(4)}", LogLevel.Error); } DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); }
protected override void ExecuteCopyToAsync(ItemUri itemUri, ItemId newParentId, string newName, EventHandler <NewWebService.CopyToCompletedEventArgs> callback) { Debug.ArgumentNotNull(itemUri, nameof(itemUri)); Debug.ArgumentNotNull(newParentId, nameof(newParentId)); Debug.ArgumentNotNull(newName, nameof(newName)); Debug.ArgumentNotNull(callback, nameof(callback)); DataService.CopyToAsync(itemUri.ItemId.ToString(), newParentId.ToString(), newName, itemUri.DatabaseName.Name, GetCredentials(), callback); }
public void ShouldReloadListItemOnRequest() { var webId = Guid.NewGuid(); var listId = Guid.NewGuid(); const int ItemId = 1; var siteMock = new ShimSPSite(); var listItemMock = new ShimSPListItem { IDGet = () => ItemId }; var listItemMockNew = new ShimSPListItem { IDGet = () => ItemId }; var listItemCollection = new ShimSPListItemCollection { GetEnumerator = () => Enumerable.Repeat <SPListItem>(listItemMock, 1).GetEnumerator() }; var listMock = new ShimSPList { GetItemsSPQuery = _ => listItemCollection, IDGet = () => listId, GetItemByIdInt32 = _ => listItemMockNew }; var listCollection = new ShimSPListCollection { ItemGetGuid = _ => listMock }; const string TestUrl = "test/url"; var webMock = new ShimSPWeb { ServerRelativeUrlGet = () => TestUrl, ListsGet = () => listCollection }; siteMock.OpenWebGuid = guid => webMock; using (var cache = SaveDataJobExecuteCache.InitializeCache(siteMock)) { string preloadErrors; var preloadHasErrors = cache.PreloadListItems(new[] { new SaveDataJobExecuteCache.ListItemInfo { WebId = webId.ToString(), ListId = listId.ToString(), ListItemId = ItemId.ToString() } }, out preloadErrors); preloadHasErrors.ShouldBe(false); preloadErrors.ShouldBe(string.Empty); var listItem = SaveDataJobExecuteCache.Cache.GetListItem(TestUrl, listId, ItemId, refresh: true); listItem.ShouldBe(listItemMockNew); listItem = SaveDataJobExecuteCache.Cache.GetListItem(TestUrl, listId, ItemId); listItem.ShouldBe(listItemMockNew); } }
public void ShouldReturnListItemFromPropertiesIfListIsNotInCache() { var webId = Guid.NewGuid(); var listId = Guid.NewGuid(); var list2Id = Guid.NewGuid(); const int ItemId = 1; var siteMock = new ShimSPSite(); var listMock = new ShimSPList { GetItemsSPQuery = _ => new ShimSPListItemCollection { GetEnumerator = () => Enumerable.Empty <SPListItem>().GetEnumerator() }, IDGet = () => listId }; var listCollection = new ShimSPListCollection { ItemGetGuid = _ => listMock }; const string TestUrl = "test/url"; var webMock = new ShimSPWeb { ServerRelativeUrlGet = () => TestUrl, ListsGet = () => listCollection }; siteMock.OpenWebGuid = guid => webMock; using (var cache = SaveDataJobExecuteCache.InitializeCache(siteMock)) { string preloadErrors; var preloadHasErrors = cache.PreloadListItems(new[] { new SaveDataJobExecuteCache.ListItemInfo { WebId = webId.ToString(), ListId = listId.ToString(), ListItemId = ItemId.ToString() } }, out preloadErrors); preloadHasErrors.ShouldBe(false); preloadErrors.ShouldBe(string.Empty); var listItemMock = new ShimSPListItem(); var properties = new ShimSPItemEventProperties { RelativeWebUrlGet = () => TestUrl, ListIdGet = () => list2Id, ListItemIdGet = () => ItemId, ListItemGet = () => listItemMock }; var listItem = SaveDataJobExecuteCache.GetListItem(properties); listItem.ShouldBe(listItemMock); } }
public override void Execute(object parameter) { var context = parameter as IItemSelectionContext; if (context == null) { return; } var item = context.Items.FirstOrDefault() as ITemplatedItem; if (item == null) { return; } var parentUri = item.ItemUri; var templateUri = new ItemUri(item.ItemUri.DatabaseUri, IdManager.GetItemId("/sitecore/templates/System/Templates/Template")); var parameterTemplateUri = parentUri.Site.DataService.AddFromTemplate(parentUri, templateUri, item.Name + @"-Parameters"); if (parameterTemplateUri == ItemUri.Empty) { return; } AppHost.Server.UpdateItem(parameterTemplateUri, BaseTemplateFieldId, ControlBaseItemId.ToString()); var parameterTemplateFieldId = new FieldId(new Guid("{7D24E54F-5C16-4314-90C9-6051AA1A7DA1}")); var fields = new List <Tuple <FieldId, string> > { new Tuple <FieldId, string>(parameterTemplateFieldId, parameterTemplateUri.ItemId.ToString()), new Tuple <FieldId, string>(DataSourceLocation, "PageSettings"), new Tuple <FieldId, string>(DataSourceTemplate, parameterTemplateUri.ItemId.ToString()) }; AppHost.Server.UpdateItem(parentUri, fields); AppHost.Windows.OpenTemplateDesigner(parameterTemplateUri); Notifications.RaiseItemAdded(this, new ItemVersionUri(parameterTemplateUri, LanguageManager.CurrentLanguage, Data.Version.Latest), parentUri); var activeContentTree = ActiveContext.ActiveContentTree; if (item is ItemTreeViewItem && activeContentTree != null) { var treeViewItem = activeContentTree.ContentTreeView.ExpandTo(parameterTemplateUri); if (treeViewItem != null) { treeViewItem.IsSelected = true; } } }
public override string ToString() { var sb = new StringBuilder("CqlPreparedResult("); sb.Append(", ItemId: "); ItemId.ToString(sb); sb.Append(", Count: "); Count.ToString(sb); sb.Append(')'); return(sb.ToString()); }
public static string getItemName(ItemId itemID) { switch (itemID) { case ItemId.ItemPotion: return(th.TS("Potion")); case ItemId.ItemSuperPotion: return(th.TS("Super Potion")); case ItemId.ItemHyperPotion: return(th.TS("Hyper Potion")); case ItemId.ItemMaxPotion: return(th.TS("Max Potion")); case ItemId.ItemRevive: return(th.TS("Revive")); case ItemId.ItemMaxRevive: return(th.TS("Max Revive")); case ItemId.ItemIncenseOrdinary: return(th.TS("Incense")); case ItemId.ItemPokeBall: return(th.TS("Poke Ball")); case ItemId.ItemGreatBall: return(th.TS("Great Ball")); case ItemId.ItemUltraBall: return(th.TS("Ultra Ball")); case ItemId.ItemRazzBerry: return(th.TS("Razz Berry")); case ItemId.ItemNanabBerry: return(th.TS("Nanab Berry")); case ItemId.ItemPinapBerry: return(th.TS("Pinap Berry")); case ItemId.ItemIncubatorBasic: return(th.TS("Egg Incubator")); case ItemId.ItemIncubatorBasicUnlimited: return(th.TS("Unlimited Egg Incubator")); default: return(itemID.ToString().Replace("Item", "")); } }
public override string ToString() { Dictionary <SoortItem, string> uitvoerder = new Dictionary <SoortItem, string>() { { SoortItem.Boek, "Auteur" }, { SoortItem.Strip, "Auteur" }, { SoortItem.DVD, "Regisseur" }, { SoortItem.CD, "Uitvoerder" } }; return($"{ItemId.ToString().PadLeft(4)}\t{SoortItem.ToString().PadRight(5)} {Titel.PadRight(40)} {Jaartal.ToString()} {(uitvoerder[this.SoortItem] + ": " + Auteur).PadRight(35)} Uitgel: {(Uitgeleend ? "j" : "n")} Afg: {(Afgevoerd ? "j" : "n")} R: {Reservatienaam}"); }
protected override void ProcessRecord() { if (!ID.IsNullOrEmpty(ItemId)) { var archivalId = Archive.GetArchivalId(ItemId); if (!ShouldProcess(ItemId.ToString(), "Restore items by Item Id")) { return; } WriteVerbose($"Restoring item {ItemId} from the archive {Archive.Name}"); Archive.RestoreItem(archivalId); } else if (Identity != null) { var user = User.FromName(Identity.Name, false); if (user == null) { return; } if (!ShouldProcess(Identity.ToString(), "Restore items by User")) { return; } var entryCount = Archive.GetEntryCountForUser(user); var entries = Archive.GetEntriesForUser(user, 0, entryCount); foreach (var entry in entries) { WriteVerbose($"Restoring item {entry.ItemId} from the archive {entry.ArchiveName} in database {entry.Database.Name}"); Archive.RestoreItem(entry.ArchivalId); } } else if (ArchiveItem != null) { foreach (var entry in ArchiveItem) { var archivalId = entry.ArchivalId; if (!ShouldProcess(entry.ItemId.ToString(), "Restore items by ArchiveItem")) { return; } var archive = ArchiveManager.GetArchive(entry.ArchiveName, entry.Database); if (archive == null) { return; } WriteVerbose($"Restoring item {entry.ItemId} from the archive {entry.ArchiveName} in database {entry.Database.Name}"); archive.RestoreItem(archivalId); } } }
protected void ButtonPrevious_Click(object sender, EventArgs e) { TxtSearchItem.Text = ""; DataList1.DataSource = null; DataList1.DataBind(); int ItemId; ItemId = int.Parse(Session["ProductId"].ToString()); ItemId = ItemId - 1; Session["ProductId"] = ItemId.ToString(); BindSelectItemNext(); }
private void DisplayComment() { //get cache string cacheKey = Utility.CacheKeyPublishArticleComments + ItemId.ToString(CultureInfo.InvariantCulture); var comments = DataCache.GetCache(cacheKey) as List <UserFeedback.Comment>; if (comments == null) { comments = Comment.GetCommentsByItemId(ArticleId, ApprovalStatus.Approved.GetId()); if (comments != null) { DataCache.SetCache(cacheKey, comments, DateTime.Now.AddMinutes(CacheTime)); Utility.AddCacheKey(cacheKey, PortalId); } } if (comments != null && comments.Count > 0) { lblNoComments.Visible = false; divPager.Visible = CommentDisplayOption == CommentDisplayOption.Paging; if (DisplayRandomComment) { dlCommentText.DataSource = Utility.GetRandomItem(comments); btnPrevious.Visible = false; } else //if (CommentDisplayOption == CommentDisplayOptions.Paging) { // PagedDataSource pagedComments = new PagedDataSource(); // pagedComments.DataSource = comments; // pagedComments.PageSize = CommentsPerPage; // dlCommentText.DataSource = pagedComments; //} //else //{ dlCommentText.DataSource = comments; divPager.Visible = false; } dlCommentText.DataBind(); if (dlCommentText.Items.Count < 1) { divPager.Visible = false; } } else { divPager.Visible = false; lblNoComments.Visible = true; } }
public void DeleteContact(ItemId id) { Console.WriteLine(id); SqlConnection connection = DBConnection(); using (connection) { SqlCommand cmd = new SqlCommand("DELETE FROM Contacts WHERE CONTACTID = @ID"); cmd.CommandType = CommandType.Text; cmd.Connection = connection; cmd.Parameters.AddWithValue("@ID", id.ToString()); cmd.ExecuteNonQuery(); } }
public ClothingItem BuildClothingItem(ItemId itemId) { ClothingItem result; ClothingItem prototype; if (mItemIdsToClothingItems.TryGetValue(itemId, out prototype)) { result = new ClothingItem(prototype); } else { throw new Exception("Unexpected ClothingItem itemId: " + itemId.ToString()); } return(result); }
protected override XmlElement ExecuteCopyTo(ItemUri itemUri, ItemId newParentId, string newName) { Debug.ArgumentNotNull(itemUri, nameof(itemUri)); Debug.ArgumentNotNull(newParentId, nameof(newParentId)); Debug.ArgumentNotNull(newName, nameof(newName)); var service = DataService; if (service == null) { return(null); } return(service.CopyTo(itemUri.ItemId.ToString(), newParentId.ToString(), newName, itemUri.DatabaseName.Name, GetCredentials())); }
public void ItemIdConstructors() { // ItemId uses ContentType() of the relevant type Guid id1 = Guid.NewGuid(); Type extType = CompositeTypeManager.Instance.ExtendedTypes[typeof(TestData)]; var ii1 = new ItemId(extType, id1); Assert.AreEqual(typeof(TestData), ii1.Type); // Serialize/Deserialize var ii2 = new ItemId(ii1.ToString()); Assert.AreEqual(ii2.Type, ii1.Type); Assert.AreEqual(ii2.Id, ii1.Id); Assert.AreEqual(ii2, ii1); // Construct from basic type TestData td = Collator.Instance.GetNew<TestData>(new Address(typeof(TestData), "a")); td.Id = 5; var ii3 = new ItemId(td); Assert.AreEqual(ii3.Id, td.Id); // Construct from container Guid id = Guid.NewGuid(); Guid ident = Guid.NewGuid(); ContentItem ci = new ContentItem { Id = id, Identity = ident, DataType = typeof(RestaurantContent).FullName }; var ii4 = new ItemId(ci); Assert.AreEqual(ii4.Id, ident); Assert.AreEqual(ii4.Type, typeof(RestaurantContent)); // Construct from data item RestaurantContent rc = Collator.Instance.GetNew<RestaurantContent>(new Address(typeof(RestaurantContent), "x")); var ii5 = new ItemId(rc); Assert.AreEqual(ii5.Id, rc.Identity); // Construct from summary RestaurantSummary rs = Collator.Instance.GetSummary<RestaurantSummary>(rc); var ii6 = new ItemId(rs); Assert.AreEqual(ii6.Id, rs.Id); Assert.AreEqual(ii6.Type, rs.Type); }
public async Task<RecycleInventoryItemResponse> RecycleItem(ItemId itemId, int amount) { var customRequest = new RecycleInventoryItem { ItemId = (ItemId)Enum.Parse(typeof(ItemId), itemId.ToString()), Count = amount }; var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude, new Request.Types.Requests { Type = (int)RequestType.RECYCLE_INVENTORY_ITEM, Message = customRequest.ToByteString() }); return await _httpClient.PostProtoPayload<Request, RecycleInventoryItemResponse>($"https://{_apiUrl}/rpc", releasePokemonRequest); }