Esempio n. 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (this.listBox1.Items.Count >= 1)
            {
                try
                {
                    currentPallet = Warehouse.Logic.Warehouse.GetPallet(listBox1.SelectedItem.ToString());

                    var editPallet   = new Pallet("exists", orderID, currentPallet.kod_palety, currentPallet.kod_miejsca_w_mag, currentPallet.Id.ToString());
                    var modifyResult = editPallet.ShowDialog();
                    if (modifyResult == DialogResult.OK)
                    {
                        this.listBox1.Items.Clear();
                        this.listBox2.Items.Clear();
                        var palletslist = Warehouse.Logic.Warehouse.GetAllPallets(orderID);

                        foreach (PalletResult pallet in palletslist)
                        {
                            listBox1.Items.Add(pallet.kod_palety);
                        }
                        ;

                        listBox1.SelectedIndex = 0;
                        var palletProducts = Warehouse.Logic.Warehouse.GetAllProducts(this.listBox1.SelectedItem.ToString());
                        foreach (ProductResult product in palletProducts)
                        {
                            this.listBox2.Items.Add(product.nazwa);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Najpierw utwórz i zaznacz paletę!");
                    }
                }
                catch (System.Security.SecurityException se)
                {
                    MessageBox.Show("Permission denied " + se.Message);
                }
                catch (Exception se)
                {
                    MessageBox.Show(se.Message);
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.Equals(this.textBox1.Text, "") && !string.Equals(this.textBox2.Text, "") && switchi == "new")
            {
                try
                {
                    var newPallet    = new Pallet("new", orderID);
                    var palletResult = newPallet.ShowDialog();
                    Warehouse.Logic.Warehouse.AddOrder(this.textBox1.Text, this.textBox2.Text, this.dateTimePicker1.Value, this.dateTimePicker2.Value, this.comboBox1.SelectedItem.ToString());
                    if (palletResult == DialogResult.OK)
                    {
                        this.listBox1.Items.Clear();
                        this.listBox2.Items.Clear();
                        var palletslist = Warehouse.Logic.Warehouse.GetAllPallets(orderID);

                        foreach (PalletResult pallet in palletslist)
                        {
                            listBox1.Items.Add(pallet.kod_palety);
                        }
                        ;

                        listBox1.SelectedIndex = 0;
                        var palletProducts = Warehouse.Logic.Warehouse.GetAllProducts(this.listBox1.SelectedItem.ToString());
                        foreach (ProductResult product in palletProducts)
                        {
                            this.listBox2.Items.Add(product.nazwa);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Najpierw uzupełnij dane zamówienia!");
                    }
                    newPallet.Dispose();
                }
                catch (System.Security.SecurityException se)
                {
                    MessageBox.Show("Permission denied " + se.Message);
                }
                catch (Exception se)
                {
                    MessageBox.Show(se.Message);
                }
            }
        }