예제 #1
0
        private void btnFinalise_Click(object sender, EventArgs e)
        {
            decimal price;

            if (txtCost.Text != null && txtCost.Text != "")
            {
                price = decimal.Parse(txtCost.Text);

                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 dateOfInstallation = 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);
                dateOfInstallation = dateOfInstallation.Date + ts;

                Installation installation = new Installation(installationID, orderID, productCode, cbxTechnicianID.Text, dateOfInstallation, 0, price);

                if (installation.CalculateDuration(startHours, startMinutes, endHours, endMinutes))
                {
                    installation.FinaliseInstallation();

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

                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Please enter a price!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            frmManageInstallations form = new frmManageInstallations();

            form.Show();

            this.Hide();
        }