public void DeleteNth(string text) { LItem tmp; bool found = false; for (tmp = first; tmp != null; tmp = tmp.next) { if (tmp.text.CompareTo(text) == 0) //Prueft ob das Wort in der Liste enthalten ist { found = true; break; } } if (found) { LItem nextToNth = first; while (nextToNth.next != tmp) { nextToNth = nextToNth.next; } nextToNth.next = nextToNth.next.next; } else { return; } }
public IEnumerator GetEnumerator() { for (LItem tmp = root; tmp != null; tmp = tmp.next) { yield return(tmp); } }
public void AddFirst(T data) { LItem newItem = new LItem(data); newItem.next = root; root = newItem; }
/// <summary> /// Returns the Show state of an item /// </summary> /// <param name="item">An item</param> /// <returns>True if it is shown</returns> public bool ShowItem(LItem item) { try { return(m_profile[item]); } catch { return(false); } }
/// <summary> /// Returns True for a Divider/Separator Break Type 2 /// </summary> /// <param name="item">An item</param> /// <returns>True if it a separator is needed</returns> public bool DivItem2(LItem item) { try { return(m_flowBreak[item] == GUI.BreakType.DivBreak2); } catch { return(false); } }
/// <summary> /// Returns the Items Display position /// </summary> /// <param name="item">An item</param> /// <returns>The display position 0..</returns> public int ItemPos(LItem item) { try { return(m_sequence[item]); } catch { return(999); } }
/// <summary> /// Returns the True for a FlowBreak /// </summary> /// <param name="item">An item</param> /// <returns>True if it breaks</returns> public bool BreakItem(LItem item) { try { return(m_flowBreak[item] == GUI.BreakType.FlowBreak); } catch { return(false); } }
// Function: Clear selected item(s) private void menuStripMenuItem_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 0) { foreach (ListViewItem LItem in listView1.SelectedItems) { LItem.Remove(); } } }
private LItem NthElem(string text) { LItem tmp = first; while (text.CompareTo(first.text) != 0) { tmp = tmp.next; } return(tmp); }
public void Print(int min = 1) { for (LItem tmp = first; tmp != null; tmp = tmp.next) { if (tmp.count >= min) { Console.WriteLine(tmp); } } }
public WordCount Filter(string pattern) { WordCount list = new WordCount(); for (LItem item = first; item != null; item = item.next) { if (item.text.Contains(pattern)) { list.SortedUpdate(item.text); } } return(list); }
private void AddFirst(string text, int count = 1) { LItem newItem = new LItem(text, count); if (first == null) //1. Fall: die Liste ist leer { first = last = newItem; } else { newItem.next = first; //2. Fall: die Liste hat min. 1 Element first = newItem; } }
public void DeleteFirst() { if (first == null) // 1.Fall: Liste ist leer { return; } if (first == last) // 2. Fall: Liste besteht nur aus einem Element { first = last = null; } else { first = first.next; // 3. Fall: Liste hat mehr als ein Element } }
public HttpResponseMessage GetItem() { var res = Request.CreateResponse(HttpStatusCode.OK); //通信成功 helper = new DatabaseConnectionHelper("SELECT DISTINCT 型番,部品名 FROM 型式;"); //製品一覧を引っ張ってくるSQL //データをリストに格納するためのやーつ string id; string name; List <Item> item = new List <Item>(); //データベースへ接続、結果を格納 SqlDataReader reader = helper.DatabaseConnect(); //データの取得に失敗した場合 if (reader == null) { res = Request.CreateResponse(HttpStatusCode.NotFound); jsonString = "error"; res.Content = new StringContent(jsonString, Encoding.UTF8, "application/json"); return(res); } //ExamControllerを参照のこと LItem wk = new LItem() { title = "製品一覧", item = null }; //データのセット while (reader.Read()) { id = (string)reader.GetValue(0); name = (string)reader.GetValue(1); item.Add(new Item(id, name)); } wk.item = item; reader.Close(); helper.closeDb(); jsonString = JsonConvert.SerializeObject(wk); Debug.WriteLine(jsonString); res.Content = new StringContent(jsonString, Encoding.UTF8, "application/json"); //Content-Typeを指定 return(res); }
private void bookReturnedToolStripMenuItem_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 0) { foreach (ListViewItem LItem in listView1.SelectedItems) { DialogResult dr = MessageBox.Show("Do You Want to Remove it from the list?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { LItem.Remove(); //UPDATE TABLE } } } }
public T GetMaxItem() { if (root == null) { throw new ArgumentNullException(); } T max = root.data; LItem current = root; while (current != null) { if (current.data.CompareTo(max) > 0) { max = current.data; } current = current.next; } return(max); }
public void SortedUpdate(string text) { bool found = false; //Prueft ob das Wort schon in der Liste enthalten ist for (LItem item = first; item != null; item = item.next) { if (text.CompareTo(item.text) == 0) { item.count++; found = true; } } if (!found) //Hier: Die Liste enthaelt das Wort nicht, es muss { //entsprechend hingefuegt werden // 1.Fall: Leere Liste oder neues Item nach dem letzten Item if (first == null || text.CompareTo(last.text) > 0) { AddLast(text); } // 2.Fall: Neues Item vor dem ersten Item else if (text.CompareTo(first.text) < 0) { AddFirst(text); } // 3.Fall: Neues Item soll in die "Mitte" else { LItem newItem = new LItem(text); LItem tmp = first; while (tmp.next.text.CompareTo(text) < 0) // tmp verweist auf das Element VOR der Einfügestelle { tmp = tmp.next; } newItem.next = tmp.next; tmp.next = newItem; } } }
public void DeleteLast() { if (first == null) // 1. Fall: Liste ist leer { throw new NullReferenceException("Die Liste ist leer"); } if (first == last) // 2. Fall: Liste besteht nur aus einem Element { first = last = null; } else // 3. Fall: Liste hat mehr als ein Element { LItem nextToLast = first; //das vorletzte Element while (nextToLast.next != last) { nextToLast = nextToLast.next; } nextToLast.next = null; last = nextToLast; } }
public void Reverse() { if (first == last) //1.Fall: die Liste ist Leer { return; } //2. Fall: Liste hat mehr als 1 Element LItem current = first; LItem newFirst = null; while (current != null) { LItem tmpNext = current.next; current.next = newFirst; newFirst = current; current = tmpNext; } last = first; //Neues Ende ist der alte Anfang first = newFirst; }
/// <summary> /// 推荐商品 /// </summary> /// <param name="title"></param> /// <returns></returns> private List <ViewModels.VMItem> TuiJian(string title) { var str = RemovePunctuation(title).Distinct().ToList(); var qv = from sf in str from ss in str select sf + ss.ToString(); List <Model.MCategory> list = LCategory.GetCatsList(); List <Model.MItem> iList = new List <Model.MItem>(); foreach (var item in qv) { var cats = (from i in list where i.CatName.Contains(item) select i).ToList(); foreach (var cat in cats) { iList = LItem.GetItemsByCatID(Convert.ToInt64(cat.CatID.ToString())).Take(3).ToList(); if (iList.Count >= 3 && title.Contains(item)) { break; } } if (iList.Count >= 3 && title.Contains(item)) { break; } } string numIIDs = string.Empty; foreach (var item in iList) { numIIDs += item.NumIID + ","; } List <Top.Api.Domain.NTbkItem> zklist = GetZKPice(numIIDs); List <ViewModels.VMItem> vIList = new List <ViewModels.VMItem>(); foreach (var item in iList) { ViewModels.VMItem i = new ViewModels.VMItem { ID = item.ID, Title = item.Title, CatID = item.CatID, PriceNow = item.PriceNow, ImgSmall = item.ImgSmall, ClickUrl = item.ClickUrl, TitleDescribe = item.TitleDescribe }; foreach (var zk in zklist) { if (item.NumIID == zk.NumIid) { i.Price = Convert.ToDecimal(zk.ZkFinalPrice).ToString("0.00"); break; } } vIList.Add(i); } return(vIList); }
/// <summary> /// The Key or Name of the CheckBox /// </summary> /// <param name="item">An Item</param> /// <returns>The Key/Name</returns> public static string Key(int pNum, LItem item) { return($"P{pNum}_{item}"); }
/// <summary> /// The Key or Name of the CheckBox /// </summary> /// <param name="item">An Item</param> /// <returns>The Key/Name</returns> private string Key(LItem item) { return(Key(m_pNumber, item)); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = (UnturnedPlayer)caller; if (command.Length != 1) { UnturnedChat.Say(caller, Syntax); return; } if (command[0].ToUpperInvariant() == "AUTO") { if (Loadout.Instance.Autos.Contains(player.CSteamID.m_SteamID)) { Loadout.Instance.Autos.Remove(player.CSteamID.m_SteamID); UnturnedChat.Say(player, "Auto loading toggled off."); return; } else { Loadout.Instance.Autos.Add(player.CSteamID.m_SteamID); UnturnedChat.Say(player, "Auto loading toggled on."); return; } } if (!Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories.ContainsKey(command[0])) { UnturnedChat.Say(player, Loadout.Instance.Translate("no_kit")); return; } #region clothing PlayerClothing clo = player.Player.clothing; LoadoutClothes clothes = Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories[command[0]].clothes; LoadoutClothing hat = clothes.hat; LoadoutClothing glasses = clothes.glasses; LoadoutClothing mask = clothes.mask; LoadoutClothing shirt = clothes.shirt; LoadoutClothing vest = clothes.vest; LoadoutClothing backpack = clothes.backpack; LoadoutClothing pants = clothes.pants; if (hat != null) { clo.askWearHat(hat.id, hat.quality, hat.state, true); } if (glasses != null) { clo.askWearGlasses(glasses.id, glasses.quality, glasses.state, true); } if (mask != null) { clo.askWearMask(mask.id, mask.quality, mask.state, true); } if (shirt != null) { clo.askWearShirt(shirt.id, shirt.quality, shirt.state, true); } if (vest != null) { clo.askWearVest(vest.id, vest.quality, vest.state, true); } if (backpack != null) { clo.askWearBackpack(backpack.id, backpack.quality, backpack.state, true); } if (pants != null) { clo.askWearPants(pants.id, pants.quality, pants.state, true); } #endregion clothing #region items for (int i = 0; i < Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories[command[0]].items.Count; i++) { LItem item = Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories[command[0]].items[i]; Item item2 = new Item(item.ID, true) { metadata = item.Meta }; player.Inventory.tryAddItem(item2, true); } #endregion items UnturnedChat.Say(caller, Loadout.Instance.Translate("loaded")); }
private void InsertarCliente() { var tag = String.Empty; var tags = new List <string>(); Console.Write("Digite la fecha de compra: (formato mm/dd/yyyy hh:mm:ss PM)"); Console.Write("\n"); var salesDate = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite el nombre del item: "); Console.Write("\n"); var name = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite el precio del item: "); Console.Write("\n"); var price = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite la cantidad del Item: "); Console.Write("\n"); var quantity = Console.ReadLine(); do { Console.Write("Digite un tag del Item (Presione x para salir)"); Console.Write("\n"); tag = Console.ReadLine(); Console.Write("\n"); tags.Add(tag); } while (tag.ToUpper() != "X"); Console.Write("Digite la ubicacion de la compra: "); var location = Console.ReadLine(); Console.Write("Digite el correo del cliente: "); Console.Write("\n"); var email = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite el telefono del cliente: "); Console.Write("\n"); var gender = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite la edad del cliente: "); Console.Write("\n"); var age = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite true o false si el cupon ya fue usado: "); Console.Write("\n"); var couponUsed = Console.ReadLine(); Console.Write("\n"); Console.Write("Digite el metodo de Compra "); Console.Write("\n"); var purchaseMethod = Console.ReadLine(); var venta = new Sales(); venta.SalesDate = ValidarFechasCore(salesDate); venta.Items = new List <LItem>(); var Item = new LItem(); Item.Name = name; Item.Price = Int32.Parse(price); Item.Quantity = Int32.Parse(quantity); Item.Tags = tags; venta.Items.Add(Item); venta.Location = location; venta.Customer = new Customer(); venta.Customer.Email = email; venta.Customer.Gender = gender; venta.Customer.Age = Int32.Parse(age); venta.CouponUse = bool.Parse(couponUsed); venta.PurchaseMethod = purchaseMethod; var client = new Ferreteria.AccesoADatos.Conexion(); client.InsertarVenta(venta); Console.WriteLine("\n"); Console.Write("-----Fin de la Operacion------ Presione cualquier tecla para salir"); Console.ReadKey(); }
// IWebElement protected override void InternalRender(HtmlTextWriter AWriter) { AWriter.AddAttribute(HtmlTextWriterAttribute.Class, "group"); AWriter.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3"); AWriter.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); string LHint = GetHint(); if (LHint != String.Empty) { AWriter.AddAttribute(HtmlTextWriterAttribute.Title, LHint, true); } AWriter.RenderBeginTag(HtmlTextWriterTag.Table); AWriter.RenderBeginTag(HtmlTextWriterTag.Caption); AWriter.Write(HttpUtility.HtmlEncode(Session.RemoveAccellerator(Title))); AWriter.RenderEndTag(); AWriter.RenderBeginTag(HtmlTextWriterTag.Tr); AWriter.RenderBeginTag(HtmlTextWriterTag.Td); if (FColumns > 1) { AWriter.AddAttribute(HtmlTextWriterAttribute.Border, "0"); AWriter.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); AWriter.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1"); AWriter.RenderBeginTag(HtmlTextWriterTag.Table); AWriter.RenderBeginTag(HtmlTextWriterTag.Tr); AWriter.RenderBeginTag(HtmlTextWriterTag.Td); } bool LHasValue; string LValue = GetFieldValue(out LHasValue); string[] LItems = FItems.Split(new char[] { ';', ',' }); string LItemName; string LItemValue; int LPos; string LItem; bool LFirst = true; int LCurrentColumn = 0; int LButtonsPerColumn = (LItems.Length / FColumns) + ((LItems.Length % FColumns) == 0 ? 0 : 1); for (int i = 0; i < LItems.Length; i++) { LItem = LItems[i]; LPos = LItem.IndexOf("="); if (LPos > 0) { // Start a new column if necessary if (LCurrentColumn != (i / LButtonsPerColumn)) { AWriter.RenderEndTag(); AWriter.RenderBeginTag(HtmlTextWriterTag.Td); LFirst = true; } LItemName = LItem.Substring(0, LPos).Trim(); LItemValue = LItem.Substring(LPos + 1).Trim(); if (LFirst) { LFirst = false; } else { AWriter.Write("<br>"); } AWriter.AddAttribute(HtmlTextWriterAttribute.Type, "radio"); AWriter.AddAttribute(HtmlTextWriterAttribute.Name, ID); AWriter.AddAttribute(HtmlTextWriterAttribute.Value, LItemValue, true); if (ReadOnly) { AWriter.AddAttribute(HtmlTextWriterAttribute.Disabled, null); } if (LHasValue && (LValue == LItemValue)) { AWriter.AddAttribute(HtmlTextWriterAttribute.Checked, null); } AWriter.RenderBeginTag(HtmlTextWriterTag.Input); Session.RenderDummyImage(AWriter, "4", "1"); AWriter.Write(HttpUtility.HtmlEncode(Session.RemoveAccellerator(LItemName))); Session.RenderDummyImage(AWriter, "6", "1"); AWriter.RenderEndTag(); } } if (FColumns > 1) { AWriter.RenderEndTag(); // TD AWriter.RenderEndTag(); // TR AWriter.RenderEndTag(); // TABLE } AWriter.RenderEndTag(); // TD AWriter.RenderEndTag(); // TR AWriter.RenderEndTag(); // TABLE }
public void OnRevive(UnturnedPlayer Player, Vector3 Place, byte idk) { if (Autos.Contains(Player.CSteamID.m_SteamID) && ((IRocketPlayer)Player).HasPermission("loadout.autoload")) { LoadoutList List = playerInvs[Player.CSteamID.m_SteamID]; if (List.inventories.ContainsKey("default")) { LoadoutInventory Inventory = List.inventories["default"]; #region clothing PlayerClothing clo = Player.Player.clothing; LoadoutClothes clothes = Inventory.clothes; LoadoutClothing hat = clothes.hat; LoadoutClothing glasses = clothes.glasses; LoadoutClothing mask = clothes.mask; LoadoutClothing shirt = clothes.shirt; LoadoutClothing vest = clothes.vest; LoadoutClothing backpack = clothes.backpack; LoadoutClothing pants = clothes.pants; if (hat != null) { clo.askWearHat(hat.id, hat.quality, hat.state, true); } if (glasses != null) { clo.askWearGlasses(glasses.id, glasses.quality, glasses.state, true); } if (mask != null) { clo.askWearMask(mask.id, mask.quality, mask.state, true); } if (shirt != null) { clo.askWearShirt(shirt.id, shirt.quality, shirt.state, true); } if (vest != null) { clo.askWearVest(vest.id, vest.quality, vest.state, true); } if (backpack != null) { clo.askWearBackpack(backpack.id, backpack.quality, backpack.state, true); } if (pants != null) { clo.askWearPants(pants.id, pants.quality, pants.state, true); } #endregion clothing #region items for (int i = 0; i < Inventory.items.Count; i++) { LItem item = Inventory.items[i]; Item item2 = new Item(item.ID, true) { metadata = item.Meta }; Player.Inventory.tryAddItem(item2, true); } #endregion items UnturnedChat.Say(Player, Instance.Translate("auto_loaded")); } else { UnturnedChat.Say(Player, Instance.Translate("no_default")); } } }
/// <summary> /// The Key or Name of the CheckBox /// NOTE: MUST be the same as in CProfile (could be done better but for now it is OK...) /// </summary> /// <param name="item">An Item</param> /// <returns>The Key/Name</returns> private string Key(LItem item) { return(CProfile.Key(m_pNumber, item)); }