private void Delete(object param) { commandBuffer.Add(new Helpers.CategoryCommand <InvoiceVatRate> { CommandType = Helpers.CommandEnum.Remove, Item = SelectedItem }); ItemsCollection.Remove(SelectedItem); }
protected override void InitializeControls(GenericContainer container) { String autoCompleteJS = string.Empty; base.InitializeControls(container); Regex rgx = new Regex(@"[^a-zA-Z0-9\s()-]"); this.TextBoxControl.Attributes.Add("data-id", this.UniqueIdentifier + this.TextBoxControl.ClientID); Connector sfConnector = new Connector(); if (String.IsNullOrEmpty(AutoCompleteSource) == false && AutoCompleteSource.ToLower() == "account") { // Using an Ajax call to get the data so it doesn't show up in the page source. autoCompleteJS = GetAutoCompletJS(this.UniqueIdentifier, this.TextBoxControl.ClientID, "autocomplete_a"); } if (String.IsNullOrEmpty(AutoCompleteSource) == false && AutoCompleteSource.ToLower() == "state") { autoCompleteJS = GetAutoCompletJS(this.UniqueIdentifier, this.TextBoxControl.ClientID, "autocomplete_s"); } if (String.IsNullOrEmpty(AutoCompleteSource) == false && AutoCompleteSource.ToLower() == "countrycodes") { ItemsCollection = "["; foreach (var r in new List <object>()) { //TODO: create REST method to get country codes ItemsCollection += "\"" + rgx.Replace("r.Name", "").ToUpper() + "\","; } ItemsCollection = ItemsCollection.Remove(ItemsCollection.Length - 1); ItemsCollection += "]"; autoCompleteJS = "<script type=\"text/javascript\"> " + "$(\"[data-id*='" + this.UniqueIdentifier + this.TextBoxControl.ClientID + "']\")" + ".autocomplete({ " + "source: function(request, response) { " + "var results = $.ui.autocomplete.filter(" + ItemsCollection + ", request.term); " + "response(results.slice(0, 1)); }" + "}); " + "</script>"; } AutoCompleteText = autoCompleteJS; }
public static void Import(this ItemsCollection items, string filename, bool replace = false) { var bps = LoadFromFile <List <BlueprintItem> >(filename); if (bps != null) { if (replace) { var doomed = items.Items.Where <ItemEntity>(x => x.HoldingSlot == null).ToTempList <ItemEntity>(); foreach (var toDie in doomed) { items.Remove(toDie); } } foreach (var bp in bps) { items.Add(bp); } } }
private void SetCurrent(SalesOrder current) { if (current == null) { if (CurrentItem == null) { return; } ItemsCollection.Remove(CurrentItem); return; } var index = ItemsCollection.IndexOf(current); if (index >= 0) { ItemsCollection[index] = current; } else { ItemsCollection.Add(current); } ChangeCurrentItem(current); }
public static void Postfix(bool __state, ItemEntity __instance, ref bool __result, UnitDescriptor user) { if (__state) { BlueprintItemEquipment blueprintItemEquipment = __instance.Blueprint as BlueprintItemEquipment; if (!blueprintItemEquipment || !blueprintItemEquipment.GainAbility) { __result = false; return; } if (!__instance.IsSpendCharges) { __result = true; return; } bool hasNoCharges = false; if (__instance.Charges > 0) { ItemEntityUsable itemEntityUsable = new ItemEntityUsable((BlueprintItemEquipmentUsable)__instance.Blueprint); if (user.State.Features.HandOfMagusDan && itemEntityUsable.Blueprint.Type == UsableItemType.Scroll) { RuleRollDice ruleRollDice = new RuleRollDice(user.Unit, new DiceFormula(1, DiceType.D100)); Rulebook.Trigger(ruleRollDice); if (ruleRollDice.Result <= 25) { __result = true; return; } } if (user.IsPlayerFaction) { __result = true; return; } --__instance.Charges; } else { hasNoCharges = true; } if (__instance.Charges >= 1 || blueprintItemEquipment.RestoreChargesOnRest) { __result = !hasNoCharges; return; } if (__instance.Count > 1) { __instance.DecrementCount(1); __instance.Charges = 1; } else { ItemsCollection collection = __instance.Collection; collection?.Remove(__instance); } __result = !hasNoCharges; } }
private void RemoveObjects() { try { string loggedUser = Session["username"] as string; #if DEBUG if (loggedUser == "DEVELOPER") { return; } #endif UsuarioLogic usuariologic = new UsuarioLogic(); List <COCASJOL.DATAACCESS.privilegio> privs = usuariologic.GetPrivilegiosDeUsuario(loggedUser); XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings.Get("privilegesXML"))); XmlNodeList nodes = doc.SelectNodes("privilegios/privilege"); DesktopShortcuts listDS = this.MyDesktop.Shortcuts; DesktopModulesCollection listDM = this.MyDesktop.Modules; ItemsCollection <Component> listIC = this.MyDesktop.StartMenu.Items; if (privs.Count == 0) { listDS.Clear(); listDM.Clear(); listIC.Clear(); } else { foreach (XmlNode node in nodes) { XmlNode keyNode = node.SelectSingleNode("key"); XmlNode moduleNode = node.SelectSingleNode("module"); XmlNode shortcutNode = node.SelectSingleNode("shortcut"); XmlNode menuitemNode = node.SelectSingleNode("menuitem"); string key = keyNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string module = moduleNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string shortcut = shortcutNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string menuitem = menuitemNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); var query = from p in privs.AsParallel() where p.PRIV_LLAVE == key select p; if (query.Count() == 0) { for (int x = 0; x < listDS.Count; x++) { DesktopShortcut ds = listDS.ElementAt(x); if (ds.ShortcutID == shortcut) { listDS.Remove(ds); } } for (int x = 0; x < listDM.Count; x++) { DesktopModule dm = listDM.ElementAt(x); if (dm.ModuleID == module) { listDM.Remove(dm); } } for (int x = 0; x < listIC.Count; x++) { Component item = listIC.ElementAt(x); if (item is Ext.Net.MenuItem) { Ext.Net.MenuItem menuItem = (Ext.Net.MenuItem)item; if (menuItem.Menu.Count > 0) { MenuCollection menu = menuItem.Menu; for (int y = 0; y < menu.Primary.Items.Count; y++) { Component itm = menu.Primary.Items.ElementAt(y); if (itm.ID == menuitem) { menu.Primary.Items.Remove(itm); } } } if (menuItem.Menu.Primary.Items.Count == 0) { listIC.Remove(menuItem); } } } } } } } catch (Exception ex) { log.Fatal("Error fatal al remover objetos sin acceso.", ex); throw; } }
public void AddNewItemTask(string itemName, string serialNumber, string itemType) { //string var = new InputBox("text").ShowDialog(); using (var db = new DataContext()) { if (SelectedItem == null) { var selectedItem = db.ItemTypes.FirstOrDefault(x => x.ItemCode == itemType).ItemTypeID; Item item = new Item(); item.ItemName = itemName; item.SerialNumber = serialNumber; item.ItemTypeID = selectedItem; item.CreationDate = DateTime.Now; if (Client != null) { item.ClientID = Client.ClientID; SelectOccupiedDateBox inputBox = new SelectOccupiedDateBox(); inputBox.ShowDialog(); Console.WriteLine(inputBox.SelectedOccupiedDate); } db.Items.Add(item); db.SaveChanges(); updateForm(); InitializeItemCollection(item.ItemID); MessageBox.Show("Dodano nowy produkt magazynowy."); } else { var selectedItem = db.ItemTypes.FirstOrDefault(x => x.ItemCode == itemType).ItemTypeID; var item = db.Items.Where(x => x.ItemID == SelectedItem.ItemID).FirstOrDefault(); item.ItemName = itemName; item.SerialNumber = serialNumber; item.ItemTypeID = selectedItem; if (Client != null) { item.ClientID = Client.ClientID; SelectOccupiedDateBox inputBox = new SelectOccupiedDateBox(); inputBox.ShowDialog(); var x = inputBox.SelectedOccupiedDate; Console.WriteLine(x); } else { item.ClientID = null; Nullable<DateTime> dt = null; item.OccupiedDate = dt; } db.SaveChanges(); ItemModel itemModel = new ItemModel(); itemModel.ItemID = item.ItemID; itemModel.ItemName = item.ItemName; itemModel.ItemType = item.ItemType.ItemCode; itemModel.SerialNumber = item.SerialNumber; itemModel.CreationDate = item.CreationDate; if(item.Client != null) itemModel.ClientName = item.Client.FullName; var index = ItemsCollection.IndexOf(SelectedItem); ItemsCollection.Remove(SelectedItem); ItemsCollection.Insert(index, itemModel); SelectedItem = null; updateForm(); MessageBox.Show($"Pomyslnie edytowano artykuł:\nID: {itemModel.ItemID}\nNazwa artykułu: {itemModel.ItemName}"); } } }
/// <summary> /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1" />. /// </summary> /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1" />.</param> /// <returns> /// true if <paramref name="item" /> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, false. This method also returns false if <paramref name="item" /> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1" />. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public bool Remove(TEntity item) { return(ItemsCollection.Remove(GetIndex(item))); }
public void UnSelectItem(object selectedObj) { var selectedItem = (PropertySetProperty)selectedObj; ItemsCollection.Remove(selectedItem); }
public bool mod_SpendCharges(UnitDescriptor user) { if (!KingmakerPatchSettings.Cheats.InfiniteItemUse) { return(this.source_SpendCharges(user)); } var blueprintItemEquipment = this.Blueprint as BlueprintItemEquipment; if (!blueprintItemEquipment || !blueprintItemEquipment.GainAbility) { UberDebug.LogError(this.Blueprint, $"Item {this.Blueprint} doesn't gain ability"); return(false); } if (!this.IsSpendCharges) { return(true); } var hasCharges = false; if (this.Charges > 0) { var itemEntityUsable = new ItemEntityUsable((BlueprintItemEquipmentUsable)this.Blueprint); if (user.State.Features.HandOfMagusDan && itemEntityUsable.Blueprint.Type == UsableItemType.Scroll) { var ruleRollDice = new RuleRollDice(user.Unit, new DiceFormula(1, DiceType.D100)); Rulebook.Trigger(ruleRollDice); if (ruleRollDice.Result <= 25) { return(true); } } if (user.IsPlayerFaction) { return(true); } --this.Charges; } else { hasCharges = true; UberDebug.LogError("Has no charges"); } if (this.Charges >= 1 || blueprintItemEquipment.RestoreChargesOnRest) { return(!hasCharges); } if (this.Count > 1) { this.DecrementCount(1); this.Charges = 1; } else { ItemsCollection collection = this.Collection; collection?.Remove(this); } return(!hasCharges); }
/// <summary> /// Removes a Match from the collection /// </summary> /// <param name="item">Match to delete</param> public override void Remove(Match item) { ItemsCollection.Remove(item); }