Exemplo n.º 1
0
        private void btnNewShipment_Click(object sender, EventArgs e)
        {
            using (NewShipmentForm newShipment = new NewShipmentForm())
            {
                if (newShipment.ShowDialog(this) == DialogResult.OK)
                {
                    Shipment shipment = newShipment.NewShipment;

                    if (!Global.Database.InsertInto <Shipment>("shipment", shipment))
                    {
                        Error("Hiba a szállítmány létrehozása közben!", "Hiba");
                        return;
                    }

                    ShipmentSummary newSummary = ComplexQueries.GetShipmentSummary(shipment);

                    if (newSummary == null)
                    {
                        Error("Hiba a szállítmány létrehozása közben!", "Hiba");
                        return;
                    }

                    switch (ComplexQueries.DoShipment(newSummary))
                    {
                    case ComplexQueries.ShipmentStatus.DatabaseError:
                        Error("Adatbázis hiba!", "Hiba");
                        break;

                    case ComplexQueries.ShipmentStatus.InvalidItemCount:
                        Error("Nincs elég a szállított tárgyból a raktárban!", "Hiba");
                        break;

                    case ComplexQueries.ShipmentStatus.OK:
                        DataGridManager.AddDataGridEntry <ShipmentSummary>(gridShipment, newSummary);

                        LoadStockTab();
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void LoadShipmentTab()
        {
            ShipmentSummary selectedEntry = null;

            if (gridShipment.SelectedRows.Count > 0)
            {
                selectedEntry = ((ShipmentSummary)gridShipment.SelectedRows[0].Tag);
            }

            DataGridManager.AddDataGridEntries <ShipmentSummary>(gridShipment, ComplexQueries.GetShipmentSummary(), true, new Action <DataGridViewRow>(
                                                                     (DataGridViewRow row) =>
            {
                ShipmentSummary sum = (ShipmentSummary)row.Tag;

                if (selectedEntry != null && sum.ItemID == selectedEntry.ItemID && sum.WarehouseFrom == selectedEntry.WarehouseFrom && sum.WarehouseTo == selectedEntry.WarehouseTo && sum.Date == selectedEntry.Date)
                {
                    row.Selected = true;
                }
            }
                                                                     ));

            gridShipment.Sort(gridShipment.Columns["colDate"], ListSortDirection.Ascending);
        }