Exemple #1
0
        private void btnNewItem_Click(object sender, System.EventArgs e)
        {
            using (ItemEditForm edit = new ItemEditForm())
            {
                if (edit.ShowDialog(this) == DialogResult.OK)
                {
                    ItemWithCategory newItem = edit.EditedItem;

                    if (Global.Database.InsertInto <Item>("item", newItem))
                    {
                        DataGridManager.AddDataGridEntry <ItemWithCategory>(gridItems, newItem);
                    }
                    else
                    {
                        Error("Hiba a(z) \"" + edit.EditedItem.Name + "\" hozzáadása közben!", "Hiba!");
                    }
                }
            }
        }
Exemple #2
0
        private void btnNewPartner_Click(object sender, System.EventArgs e)
        {
            using (PartnerEditForm edit = new PartnerEditForm())
            {
                if (edit.ShowDialog(this) == DialogResult.OK)
                {
                    Partner newPartner = edit.EditPartner;

                    if (Global.Database.InsertInto <Partner>("partner", newPartner))
                    {
                        DataGridManager.AddDataGridEntry <Partner>(gridPartners, newPartner);
                    }
                    else
                    {
                        Error("Hiba a(z) \"" + edit.EditPartner.Name + "\" hozzáadása közben!", "Hiba!");
                    }
                }
            }
        }
Exemple #3
0
        private void btnNewWarehouse_Click(object sender, System.EventArgs e)
        {
            using (WarehouseEditForm whEdit = new WarehouseEditForm())
            {
                if (whEdit.ShowDialog(this) == DialogResult.OK)
                {
                    Warehouse newWarehouse = whEdit.EditedWarehouse;

                    if (Global.Database.InsertInto <Warehouse>("warehouse", newWarehouse))
                    {
                        DataGridManager.AddDataGridEntry <Warehouse>(gridWarehouse, newWarehouse);
                    }
                    else
                    {
                        Error("Hiba a \"" + whEdit.EditedWarehouse.Name + "\" hozzáadása közben!", "Hiba!");
                    }
                }
            }
        }
Exemple #4
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;
                    }
                }
            }
        }