Beispiel #1
0
        private void btnNewPShipment_Click(object sender, EventArgs e)
        {
            using (NewPartnerShipmentForm newPartnerShipment = new NewPartnerShipmentForm())
            {
                if (newPartnerShipment.ShowDialog(this) == DialogResult.OK)
                {
                    PartnerShipment pshipment = newPartnerShipment.NewShipment;

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

                    PartnerShipmentSummary newSummary = ComplexQueries.GetPartnerShipmentSummary(pshipment);

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

                    switch (ComplexQueries.DoPartnerShipment(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 <PartnerShipmentSummary>(gridPartnerShipment, newSummary);

                        LoadStockTab();
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        private void LoadPartnerShipmentTab()
        {
            PartnerShipmentSummary selectedEntry = null;

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

            DataGridManager.AddDataGridEntries <PartnerShipmentSummary>(gridPartnerShipment, ComplexQueries.GetPartnerShipmentSummary(), true, new Action <DataGridViewRow>(
                                                                            (DataGridViewRow row) =>
            {
                PartnerShipmentSummary sum = (PartnerShipmentSummary)row.Tag;

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

            gridPartnerShipment.Sort(gridPartnerShipment.Columns["colPartnerDate"], ListSortDirection.Ascending);
        }