private void editMaintenanceB_Click(object sender, EventArgs e)
        {
            switch (editMaintenanceB.Text)
            {
            case "Edit":
                editMaintenanceB.Text = "Update";
                EnableMaintenance();
                break;

            case "Update":

                _maintenanceID = int.Parse(maintenanceLV.SelectedItems[0].Text);
                _partID        = _part.RetrievePartID(partCB.Text);
                _maintenance   = new Maintenance(_maintenance.MaintenanceID,
                                                 _maintenance.PlateNumber,
                                                 _partID, _status); //added

                _maintenance.UpdateMaintenanceInfo(_maintenance);
                editMaintenanceB.Text = "Edit";

                LoadRegistration(_plateNumber);
                LoadInsurance(_plateNumber);
                LoadRepair(_plateNumber);
                Loadfuel(_plateNumber);
                MaintenanceListLoad(_plateNumber);
                DisableMaintenance();
                break;
            }
        }
Esempio n. 2
0
        private void payB_Click(object sender, EventArgs e)
        {
            repairSupplierID    = _supplier.RetrieveSupplierID(repairSupplierCB.Text);
            repairDate          = repairDateDTP.Value;
            repairInvoiceNumber = repairInvoiceNumberTB.Text;
            repairAmount        = double.Parse(repairAmountTB.Text);
            typeOfRepair        = typeOfRepairCB.Text;

            try
            {
                foreach (RepairDetail repairDetail in _repairDetails)
                {
                    _repairDetail.InsertRepairDetail(repairDetail);
                }
                plateNumber   = plateNumberCB.Text.Trim();
                repairDate    = repairDateDTP.Value;
                typeOfRepair  = typeOfRepairCB.Text.Trim();
                partID        = _part.RetrievePartID(partCB.Text);
                maintenanceID = _maintenance.RetrieveMaintenanceID(plateNumber, partID);

                repairSupplierID    = _supplier.RetrieveSupplierID(repairSupplierCB.Text.Trim());
                repairInvoiceNumber = repairInvoiceNumberTB.Text.Trim();
                repairAmount        = double.Parse(repairAmountTB.Text.Trim());
                status = statusCB.Text.Trim();

                _repair = new Repair(repairID, maintenanceID, repairDate, typeOfRepair, repairInvoiceNumber, repairSupplierID, repairAmount);
                _repair.InsertRepair(_repair);

                _maintenance = new Maintenance(maintenanceID, plateNumber, partID, status);
                _maintenance.UpdateMaintenanceInfo(_maintenance);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            NewPaymentForm newPaymentForm = new NewPaymentForm();

            newPaymentForm.ShowDialog();
        }