Ejemplo n.º 1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            frmManageCorrections form = new frmManageCorrections();

            form.Show();

            this.Hide();
        }
Ejemplo n.º 2
0
        private void btnLogServiceTicket_Click(object sender, EventArgs e)
        {
            Correction.days = 1;

            _ValidationMethods.Reset();

            if (cbxClientID.Text == null || cbxClientID.Text == "")
            {
                _ValidationMethods.AddToInvalidFields("Client ID");
            }

            if (cbxOrderID.Text == null || cbxOrderID.Text == "")
            {
                _ValidationMethods.AddToInvalidFields("Order ID");
            }

            if (cbxProductCode.Text == null || cbxProductCode.Text == "")
            {
                _ValidationMethods.AddToInvalidFields("Product Code");
            }

            ServiceTicket serviceTicket = new ServiceTicket(DataHandler.lastCallLogID, txtDescription.Text);

            if (_ValidationMethods.isValid)
            {
                serviceTicket.SaveServiceTicketToDB();

                Correction correction = new Correction(0, int.Parse(cbxOrderID.Text), cbxProductCode.Text, null, DateTime.MinValue, null, null, null);

                correction.SaveCorrectionToDB();

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

                this.Hide();
            }
        }
Ejemplo n.º 3
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 dateOfCorrection = 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);
                dateOfCorrection = dateOfCorrection.Date + ts;

                Correction correction = new Correction(correctionID, orderID, productCode, cbxTechnicianID.Text, dateOfCorrection, 0, price, null);


                if (correction.CalculateDuration(startHours, startMinutes, endHours, endMinutes))
                {
                    correction.FinaliseCorrection();

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

                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Please enter a price!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }