示例#1
0
        private void btnFinalise_Click(object sender, EventArgs e)
        {
            int startHours   = int.Parse(txtStartTimeHours.Text);
            int startMinutes = int.Parse(txtStartTimeMinutes.Text);
            int endHours     = int.Parse(txtEndTimeHours.Text);
            int endMinutes   = int.Parse(txtEndTimeMinutes.Text);

            DateTime dateOfMaintenance = new DateTime(int.Parse(date.Substring(0, 4)), int.Parse(date.Substring(5, 2)), int.Parse(date.Substring(8, 2)));

            TimeSpan ts = new TimeSpan(startHours, startMinutes, 0);

            dateOfMaintenance = dateOfMaintenance.Date + ts;

            Maintenance maintenance = new Maintenance(maintenanceID, orderID, productCode, cbxTechnicianID.Text, dateOfMaintenance, 0);

            if (maintenance.CalculateDuration(startHours, startMinutes, endHours, endMinutes))
            {
                maintenance.FinaliseMaintenance();

                frmManageMaintenances form = new frmManageMaintenances();
                form.Show();

                this.Hide();
            }
        }