public virtual List <UnidentifiedItem> GetUnidentifiedItemList(DtoItem item) { string sql = "SELECT UNIDENTIFIEDNAME " + "FROM UNIDENTIFIEDNAMEMASTER " + $"WHERE TYPENUMBER = {item.TypeNumber} ORDER BY UNIDENTIFIEDNAME"; var itemList = new List <UnidentifiedItem>(); using (var cmd = new OdbcCommand(sql, con)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { var retItem = new UnidentifiedItem() { UnidentifiedName = reader[0].ToString(), TypeNumber = item.TypeNumber }; itemList.Add(retItem); } } } return(itemList); }
private void SetListBox(DataGridViewRow row) { if (row == null) { return; } var item = new DtoItem(); if (int.TryParse(comboBox1.SelectedValue.ToString(), out int typeNumber)) { item.TypeNumber = typeNumber; } if (int.TryParse(row.Cells[2].Value.ToString(), out int moneyToBuy)) { item.MoneyToBuy = moneyToBuy; } if (int.TryParse(row.Cells[3].Value.ToString(), out int moneyToSell)) { item.MoneyToSell = moneyToSell; } SetListBox(item); }
public DtoItem SearchItem(string itemName) { foreach (DtoItem item in ItemList) { if (item.ItemName == itemName) { DtoItem retItem = new DtoItem() { ItemName = item.ItemName, MoneyToBuy = item.MoneyToBuy, MoneyToSell = item.MoneyToSell, Note = item.Note }; return(retItem); } } return(null); }
private void SetListBox() { var item = new DtoItem() { TypeNumber = int.Parse(comboBox1.SelectedValue.ToString()) }; if (TxbMoneyToBuy.Text != "") { item.MoneyToBuy = int.Parse(TxbMoneyToBuy.Text); } if (TxbMoneyToSell.Text != "") { item.MoneyToSell = int.Parse(TxbMoneyToSell.Text); } SetListBox(item); }
private void SetListBox(DtoItem item) { LsbItem.Items.Clear(); int index = int.Parse(comboBox1.SelectedValue.ToString()); foreach (var retItem in ItemList[index]) { if (item.MoneyToBuy != null && item.MoneyToBuy != retItem.MoneyToBuy) { continue; } if (item.MoneyToSell != null && item.MoneyToSell != retItem.MoneyToSell) { continue; } LsbItem.Items.Add(retItem.ItemName); } }
public virtual List <DtoItem> GetItemList(DtoItem item) { object[,] strArr = { { nameof(item.ItemName), item.ItemName }, { nameof(item.TypeNumber), item.TypeNumber }, { nameof(item.MoneyToBuy), item.MoneyToBuy }, { nameof(item.MoneyToSell), item.MoneyToSell }, { nameof(item.Note), item.Note }, }; string sql = "SELECT ITEMNAME, TYPENUMBER, MONEYTOBUY, MONEYTOSELL, NOTE " + "FROM ITEMMASTER "; string strWhere = ""; for (int i = 0; i < strArr.GetUpperBound(0); i++) { if (strArr[i, 1] != null) { if (strWhere == "") { strWhere += "WHERE "; } else { strWhere += "AND "; } strWhere += $"{strArr[i, 0]} = {strArr[i, 1]} "; } } sql += strWhere; Console.WriteLine(sql); var itemList = new List <DtoItem>(); using (var cmd = new OdbcCommand(sql, con)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { var retItem = new DtoItem() { // ITEMNAME, TYPENUMBER, MONEYTOBUY, MONEYTOSELL, NOTE ItemName = reader[0].ToString(), TypeNumber = int.Parse(reader[1].ToString()), MoneyToBuy = int.Parse(reader[2].ToString()), MoneyToSell = int.Parse(reader[3].ToString()), Note = reader[4].ToString() }; itemList.Add(retItem); } } } return(itemList); }
public override List <DtoItem> GetItemList(DtoItem item) { var toru = new ItemsToruneko3(); return(toru.GetItemList(item.TypeNumber)); }