示例#1
0
 private void CancelBtn_Click(object sender, EventArgs e)
 {
     LicenseTxt.Focus();
     if (LicenseTxt.Text == "" && StateTxt.Text == "" && VINTxt.Text == "")
     {
         pg.locationForm.Show();
         this.Hide();
     }
     else
     {
         LicenseTxt.Text = "";
         StateTxt.Text   = "";
         VINTxt.Text     = "";
     }
 }
示例#2
0
        private void SubmitBtn_Click(object sender, EventArgs e)
        {
            LicenseTxt.Focus();
            bool hasEdits = false;

            if (LicenseTxt.Text != "" && StateTxt.Text != "")
            {
                if (LicenseTxt.Text.Length < 13)
                {
                    Vehicle.TagNumber = LicenseTxt.Text.ToUpper();
                    Ticket.TagNumber  = LicenseTxt.Text.ToUpper();
                }
                else
                {
                    LicenseTxt.Focus();
                    PopUpForm pf = new PopUpForm("Tag Number is too long");
                    pf.ShowDialog();
                    LicenseTxt.Text = "";
                    return;
                }

                if (stateList.Contains(StateTxt.Text.ToUpper()))
                {
                    Vehicle.TagState = StateTxt.Text.ToUpper();
                    Ticket.TagState  = StateTxt.Text.ToUpper();
                }
                else
                {
                    StateTxt.Focus();
                    PopUpForm pf = new PopUpForm("Not valid state");
                    pf.ShowDialog();
                    StateTxt.Text = "";
                    return;
                }

                hasEdits = true;
            }
            else if (VINTxt.Text != "")
            {
                Vehicle.VIN  = VINTxt.Text.ToUpper();
                Ticket.Notes = "VIN: " + VINTxt.Text.ToUpper();
                hasEdits     = true;
            }

            if (hasEdits)
            {
                if (dbh.IsNetConnected())
                {
                    TicketService();
                }
                else
                {
                    TicketOffline();
                }


                //pg.locationForm.Show();
                this.Hide();
                LicenseTxt.Text = "";
                StateTxt.Text   = "";
                VINTxt.Text     = "";

                //reset is set to true if there a ticket is unable to be written due to constraints
                //If reset is false, go to Offence Form, else go to Location Form
                if (reset == false)
                {
                    pg.offenceForm.Show();
                }
                else
                {
                    reset = false;
                    pg.locationForm.Show();
                }
            }
            else
            {
                PopUpForm pf = new PopUpForm("Not Enough Information Entered");
                pf.ShowDialog();
            }
        }