Ejemplo n.º 1
0
        private void bnListOwners_Click(object sender, EventArgs e)
        {
            ListDialog ld = new ListDialog();

            ld.AddDisplayItems(DataOperations.ListOwners());
            ld.ShowDialog();
        }
Ejemplo n.º 2
0
        private void ListOwnersHistory_Click(object sender, EventArgs e)
        {
            ListDialog             ld  = new ListDialog();
            LocateVehicleDialogbox lvd = new LocateVehicleDialogbox();

            if (lvd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (DataOperations.ListOwnersHistory(lvd.VIN) != null)
            {
                ld.AddDisplayItems(DataOperations.ListOwnersHistory(lvd.VIN));
                ld.ShowDialog();
            }
            else
            {
                MessageBox.Show("Vehicle was not found");
            }
        }
Ejemplo n.º 3
0
        private void bnListOwnedVehicles_Click(object sender, EventArgs e)
        {
            ListDialog           ld  = new ListDialog();
            LocateOwnerDialogbox lod = new LocateOwnerDialogbox();

            if (lod.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (DataOperations.ListOwnedVehicles(lod.SSN) != null)
            {
                ld.AddDisplayItems(DataOperations.ListOwnedVehicles(lod.SSN));
                ld.ShowDialog();
            }
            else
            {
                MessageBox.Show("Owner was not found");
            }
        }
Ejemplo n.º 4
0
        private void OperationPerformer(List <string> words)
        {
            string currentOperation = "";

            if (words.Count > 0)
            {
                currentOperation = words[0];
            }
            else
            {
                return;
            }

            ListDialog ld = new ListDialog();

            switch (currentOperation)
            {
            case "RegisterDealer":
            {
                DataOperations.RegisterDealer(words[1], words[2], words[3], words[4]);
                break;
            }

            case "RegisterVehicle":
            {
                DataOperations.RegisterVehicle(words[1], words[2], words[3], words[4], words[5], words[6]);
                break;
            }

            case "RegisterOwner":
            {
                DataOperations.RegisterOwner(words[1], words[2], words[3], words[4], words[5]);
                break;
            }

            case "TransferD2D":
            {
                DataOperations.TransferD2D(words[1], words[2], words[3]);
                break;
            }

            case "TransferD2O":
            {
                DataOperations.TransferD2O(words[1], words[2], words[3], words[4], words[5], words[6]);
                break;
            }

            case "TransferO2D":
            {
                DataOperations.TransferO2D(words[1], words[2], words[3], words[4]);
                break;
            }

            case "TransferO2O":
            {
                DataOperations.TransferO2O(words[1], words[2], words[3], words[4], words[5], words[6]);
                break;
            }

            case "ListOwnersOfVehicle":
            {
                try
                {
                    ld.AddDisplayItems(DataOperations.ListOwnersHistory(words[1]));
                    ld.ShowDialog();
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show("Vehicle was not found");
                }
                break;
            }

            case "ListVehiclesOfOwner":
            {
                try
                {
                    ld.AddDisplayItems(DataOperations.ListOwnedVehicles(words[1]));
                    ld.ShowDialog();
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show("Owner was not found");
                }
                break;
            }

            case "ListDealers":
            {
                ld.AddDisplayItems(DataOperations.ListDealers());
                ld.ShowDialog();
                break;
            }

            default:
            {
                MessageBox.Show("Operation was not found");
                break;
            }
            }
        }