public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (ItemName.Length != 0) { hash ^= ItemName.GetHashCode(); } if (ItemLV != 0) { hash ^= ItemLV.GetHashCode(); } if (UseMinLV != 0) { hash ^= UseMinLV.GetHashCode(); } if (ItemMinLvl != 0) { hash ^= ItemMinLvl.GetHashCode(); } if (ItemMaxLvl != 0) { hash ^= ItemMaxLvl.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void AddItemButton_Click(object sender, EventArgs e) { try { itemPrice = Convert.ToDouble(itemPrice_Str); // try convert to double ListViewItem searchItem = null; int index = 0; bool itemExist = false; do { if (index < ItemLV.Items.Count) { searchItem = ItemLV.FindItemWithText(itemName, false, index, false); if (searchItem != null) { itemExist = true; index = searchItem.Index + 1; break; } } else { searchItem = null; } } while (searchItem != null); if (itemName != "" && itemName != null && itemPrice >= 0 && itemPrice_Str != null && !itemExist && (itemType != "Food" || itemType != "Beverage")) { itemList.Add(new Item() { item_Name = itemName, item_Type = itemType, item_Price = itemPrice }); // add to list itemTableAdapter.InsertItem(System.Convert.ToInt32(itemTableAdapter.GetCount()) + 1, itemName, System.Convert.ToDecimal(itemPrice), itemType); itemNameDelete.Items.Add(new { Text = itemName }); // add to delete box ListViewItem listViewItem = new ListViewItem(new string[] { itemName, itemType, itemPrice.ToString("F") }); ItemLV.Items.AddRange(new ListViewItem[] { listViewItem }); // add to list view } else if (itemExist) { MessageBox.Show("Item Name already exists", "Warning"); } else { MessageBox.Show("A fill area is missing or incorrect", "Warning"); } } catch (FormatException) // popup error, havent implement yet { MessageBox.Show("Item Price is not a decimal", "Warning"); } }
private void DeleteItemButton_Click(object sender, EventArgs e) { string itemName = itemNameDelete.Text; if (itemName != null) // error proof { var itemToRemove = itemList.FirstOrDefault(r => r.item_Name == itemName); if (itemToRemove != null) { itemList.Remove(itemToRemove); // remove from list itemTableAdapter.DeleteItem(System.Convert.ToString(itemName)); itemNameDelete.Items.Remove(itemNameDelete.SelectedItem); // remove from delete box // search view list box and delete ListViewItem searchItem = null; int index = 0; do { if (index < ItemLV.Items.Count) { searchItem = ItemLV.FindItemWithText(itemName, false, index, false); if (searchItem != null) { ItemLV.Items.Remove(searchItem); index = searchItem.Index + 1; } } else { searchItem = null; } } while (searchItem != null); } else { MessageBox.Show("Item name is not in the list", "Warning"); } } else { MessageBox.Show("A fill is missing or incorrect", "Warning"); } itemNameDelete.Text = ""; }
private void UpdateItem(ItemLV ilv) { ilv.Item.ImageIndex = 2; ilv.Item.SubItems[(int)Utils.E_SUBITEMS.TAMANHO].Text = ilv.Dados.Tamanho.ToString("F2", _ci).Trim(); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.CONTRATOS].Text = GetDadoBody(ilv.Dados, Utils.CONTRATOS); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.PARCELAS].Text = GetDadoBody(ilv.Dados, Utils.PARCELAS); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.CONTRATOSREC].Text = GetDadoBody(ilv.Dados, Utils.CONTRATOSREC); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.PARCELASREC].Text = GetDadoBody(ilv.Dados, Utils.PARCELASREC); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.RESERVAS].Text = GetDadoBody(ilv.Dados, Utils.RESERVAS); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.RESERVASREC].Text = GetDadoBody(ilv.Dados, Utils.RESERVASREC); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.VALPARCELAS].Text = GetDadoBody(ilv.Dados, Utils.VALPARCELAS); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.VALPARCELASREC].Text = GetDadoBody(ilv.Dados, Utils.VALPARCELASREC); ilv.Item.SubItems[(int)Utils.E_SUBITEMS.CODERRO].Text = GetDadoBody(ilv.Dados, Utils.CODERROS); }
private void RunWorkerCompleted(ItemLV ilv) { if (ilv != null & ilv.Dados != null && ilv.Item != null) { UpdateItem(ilv); ilv.Item.ForeColor = (ilv.XML.XmlOK) ? Color.Red : Color.Green; SetResumoStripBar(); //caso esse item esteja selecionado if (_logger != null) _logger.Info(String.Format("Dados do arquivo {0} preenchidos", Path.GetFileName(ilv.NomeArquivo))); } //lock (_itemQueue) { _itemQueue.Remove(ilv.Item); //Console.WriteLine("RunWorkerCompleted on {0}", Path.GetFileName(ilv.InfoArquivo.NomeArquivo)); //continue se ainda tem item para tratar if (_itemQueue.Count > 0) { _picWait.Enabled = true; _picWait.Visible = true; } else { _btnValida.Enabled = true; _btnCancelValid.Enabled = false; _picWait.Enabled = false; _picWait.Visible = false; } } }
private ListViewItem ListAddItem(String filename) { FileInfo fi = new FileInfo(filename); ListViewItem item = null; if (fi.Exists) { item = _lstXML.Items.Add(fi.Name, 1); //_lstXML.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent); item.SubItems[0].Tag = Utils.HDR_NOMARQ; ListAddSubItem(item, "0", Utils.TAMANHO); ListAddSubItem(item, "0", Utils.CONTRATOS); ListAddSubItem(item, "0", Utils.PARCELAS); ListAddSubItem(item, "0", Utils.CONTRATOSREC); ListAddSubItem(item, "0", Utils.PARCELASREC); ListAddSubItem(item, "0", Utils.RESERVAS); ListAddSubItem(item, "0", Utils.RESERVASREC); ListAddSubItem(item, "0,0", Utils.VALPARCELAS); ListAddSubItem(item, "0,0", Utils.VALPARCELASREC); ListAddSubItem(item, "0", Utils.CODERROS); ItemLV ilv = new ItemLV(item); ilv.Dados.Filename = filename; item.Tag = ilv; } return item; }