Exemplo n.º 1
0
        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);
        }
        public void SetItem(UnidentifiedItem argItem)
        {
            foreach (var unidentifiedItem in UnidentifiedList)
            {
                if (argItem.UnidentifiedName == unidentifiedItem.UnidentifiedName)
                {
                    unidentifiedItem.Item        = argItem.Item;
                    unidentifiedItem.MoneyToBuy  = argItem.MoneyToBuy;
                    unidentifiedItem.MoneyToSell = argItem.MoneyToSell;

                    SetDataTable();
                    return;
                }
            }
        }
Exemplo n.º 3
0
        private void ExecuteDecide()
        {
            if (LsbItem.SelectedItem == null)
            {
                return;
            }

            int index = int.Parse(comboBox1.SelectedValue.ToString());

            foreach (var item in ItemList[index])
            {
                if (item.ItemName == LsbItem.SelectedItem.ToString())
                {
                    int             rowIndex = DgvMain.CurrentRow.Index;
                    DataGridViewRow row      = DgvMain.CurrentRow;

                    string unidentifiedName = DgvMain.CurrentRow.Cells[0].Value.ToString();

                    //すでに値が入ってる場合
                    string itemName = row.Cells[1].Value.ToString();
                    ResetItemName(index, row.Index, itemName);

                    UnidentifiedItem unItem = new UnidentifiedItem();
                    unItem.UnidentifiedName = unidentifiedName;
                    unItem.Item             = item;

                    if (row.Cells[2].Value != null && int.TryParse(row.Cells[2].Value.ToString(), out int resultBuy))
                    {
                        unItem.MoneyToBuy = resultBuy;
                    }

                    if (row.Cells[3].Value != null && int.TryParse(row.Cells[3].Value.ToString(), out int resultSell))
                    {
                        unItem.MoneyToSell = resultSell;
                    }

                    TableMakerList[index].SetItem(unItem);
                    ItemList[index].Remove(item);

                    SetListBox();

                    DgvMain.CurrentCell = DgvMain.Rows[rowIndex].Cells[0];
                    Console.Write("XXX" + DgvMain.Rows[rowIndex]);
                    return;
                }
            }
        }
Exemplo n.º 4
0
        private void ExecuteSet()
        {
            int index = int.Parse(comboBox1.SelectedValue.ToString());

            int             rowIndex = DgvMain.CurrentRow.Index;
            DataGridViewRow row      = DgvMain.CurrentRow;

            string unidentifiedName = row.Cells[0].Value.ToString();

            //すでに値が入ってる場合
            string itemName = row.Cells[1].Value.ToString();

            ResetItemName(index, rowIndex, itemName);

            var item = new UnidentifiedItem()
            {
                UnidentifiedName = unidentifiedName
            };

            if (TxbMoneyToBuy.Text != "")
            {
                item.MoneyToBuy = int.Parse(TxbMoneyToBuy.Text);
            }

            if (TxbMoneyToSell.Text != "")
            {
                item.MoneyToSell = int.Parse(TxbMoneyToSell.Text);
            }

            TableMakerList[index].SetItem(item);

            DgvMain.CurrentCell = DgvMain.Rows[rowIndex].Cells[1];

            //TxbMoneyToBuy.Text = "";
            //TxbMoneyToSell.Text = "";

            SetListBox(DgvMain.Rows[rowIndex]);
        }