Ejemplo n.º 1
0
        private void cbItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbFrom.SelectedIndex = -1;
            cbTo.SelectedIndex   = -1;

            cbFrom.Items.Clear();
            cbTo.Items.Clear();

            if (cbItem.SelectedIndex > -1)
            {
                List <WarehouseStock> stock = ComplexQueries.GetItemStock(((Item)cbItem.Items[cbItem.SelectedIndex]).ID);
                int[] ids = stock.Select(x => x.WarehouseID).ToArray();

                List <Warehouse> emptyWarehouse = _allWarehouse.Where(x => !ids.Contains(x.ID)).ToList();

                if (stock != null && stock.Count > 0)
                {
                    stock = stock.OrderBy(s => s.WarehouseName).ToList();

                    foreach (WarehouseStock s in stock)
                    {
                        if (s.ItemCount <= 0)
                        {
                            continue;
                        }

                        cbFrom.Items.Add(s);
                        cbTo.Items.Add(s);
                    }
                }
                if (emptyWarehouse != null && emptyWarehouse.Count > 0)
                {
                    emptyWarehouse = emptyWarehouse.OrderBy(s => s.Name).ToList();

                    foreach (Warehouse s in emptyWarehouse)
                    {
                        cbFrom.Items.Add(new EmptyWarehouseStock()
                        {
                            WarehouseID   = s.ID,
                            WarehouseName = s.Name
                        });

                        cbTo.Items.Add(new EmptyWarehouseStock()
                        {
                            WarehouseID   = s.ID,
                            WarehouseName = s.Name
                        });
                    }
                }

                cbFrom.Enabled = cbTo.Enabled = (cbFrom.Items.Count > 0);
            }
            else
            {
                cbFrom.Enabled = cbTo.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        private void StockManagerForm_Load(object sender, System.EventArgs e)
        {
            SuspendLayout();
            {
                //Fejléc
                Item item = Global.Database.SelectOne <Item>("item", new Dictionary <string, object>()
                {
                    { "ID", _stockItemID }
                });
                if (item != null)
                {
                    this.Text = "Készlet - \"" + item.Name + "\"";
                }

                //Adat
                DataGridManager.AddDataGridEntries <WarehouseStock>(gridStock, ComplexQueries.GetItemStock(_stockItemID));

                gridStock.Focus();
            }
            ResumeLayout();
        }