Exemplo n.º 1
0
        private void btnServices_Click(object sender, EventArgs e)
        {
            UC_ViewServices allServices = new UC_ViewServices(_vehicle);

            this.Controls.Clear();
            this.Controls.Add(allServices);
        }
Exemplo n.º 2
0
 private void btnBillAndSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsValidKM(CurrentKm) && WorkPay > 0)
         {
             Service sv = new Service(DateTime.Now, CurrentKm, WorkPay, allInspections, servicedBy, LastTotal);
             if (_client != null)
             {
                 using (ViewInvoice vI = new ViewInvoice(new Invoice(sv.ServiceId, _vehicle, sv, _client, servicedBy, VAT, (CalculateTotal() + WorkPay), LastTotal), false))
                 {
                     vI.ShowDialog();
                     if (vI.DialogResult == DialogResult.OK)
                     {
                         UpdateStock();
                         _vehicle.ServiceList.Add(sv);
                     }
                 }
             }
             else if (_company != null)
             {
                 using (ViewInvoice vI = new ViewInvoice(new Invoice(sv.ServiceId, _vehicle, sv, _company, servicedBy, VAT, (CalculateTotal() + WorkPay), LastTotal), false))
                 {
                     vI.ShowDialog();
                     if (vI.DialogResult == DialogResult.Yes)
                     {
                         UpdateStock();
                         _vehicle.ServiceList.Add(sv);
                     }
                     else
                     {
                         MessageBox.Show("Service Aborted!", "New service", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
             DialogResult dg = MessageBox.Show("New service added successfully!", "New service", MessageBoxButtons.OK, MessageBoxIcon.Information);
             if (dg == DialogResult.OK)
             {
                 UC_ViewServices services = new UC_ViewServices(_vehicle);
                 this.Controls.Clear();
                 this.Controls.Add(services);
             }
         }
     }
     catch (Exception)
     {
         //MessageBox.Show("Your current kilometres are invalid!");
     }
 }