private void ConfigureRoute_Click(object sender, EventArgs e)
 {
     ConfigureTruckRoute configureroute =new ConfigureTruckRoute();
     configureroute.SetData(viewdate, scheduleddrivers[listScheduledDrivers.SelectedIndex]);
     configureroute.Show();
     this.Close();
 }
Exemplo n.º 2
0
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                //check blank fields
                if (textInvoice.Text == "" || textValue.Text == "" || textCustomer.Text == "" || textStreet.Text == "" || textCity.Text == "" || textState.Text == "")
                {
                    toolStripStatusLabel2.Text = "Some required fields are blank.";
                    return;
                }
                string pattern = @"^\$?\-?([1-9]{1}[0-9]{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\-?\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\(\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))\)$";
                if (!Regex.IsMatch(textValue.Text, pattern))
                {
                    textValue.Focus();
                    toolStripStatusLabel2.Text = "Value must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                pattern = @"^[0-9]+$";
                if (!Regex.IsMatch(textInvoice.Text, pattern))
                {
                    textInvoice.Focus();
                    toolStripStatusLabel2.Text = "Invoice number must be a number.";
                    return;
                }

                newinvoice = new Invoice(Int32.Parse(textInvoice.Text), DataFormat.FormatMoneyToInt(textValue.Text), currentday, textCustomer.Text, textStreet.Text, "", textCity.Text, textState.Text, textZip.Text, longitude, latitude, currentday.AddYears(1));
                List < Invoice > toadd = new List<Invoice>();
                toadd.Add(newinvoice);
                mysql_invoices.AddInvoices(toadd,false);
            }
            catch {
                toolStripStatusLabel2.Text = "Failed to update invoice.";
                return;
            }
            if (flag == true)
            {
                DeliverySchedule deliveryschedule = new DeliverySchedule();
                deliveryschedule.SetDate(currentday,0);
                deliveryschedule.Show();
                this.Close();
            }
            else
            {
                ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
                configureroute.SetData(currentday, driver);
                configureroute.Show();
            }
            this.Close();
        }
Exemplo n.º 3
0
 private void Cancel_Click(object sender, EventArgs e)
 {
     if (flag == true)
     {
         DeliverySchedule deliveryschedule = new DeliverySchedule();
         deliveryschedule.SetDate(currentday,0);
         deliveryschedule.Show();
         this.Close();
     }
     else
     {
         ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
         configureroute.SetData(currentday, driver);
         configureroute.Show();
     }
         this.Close();
 }
Exemplo n.º 4
0
        private void Cancel_Click_1(object sender, EventArgs e)
        {
            try
            {
                newinvoice.addr1 = textStreet.Text;
                newinvoice.addr2 = "";
                newinvoice.city = textCity.Text;
                newinvoice.state = textState.Text;
                newinvoice.zip = textZip.Text;
                newinvoice.latitude = currentgeodata.latitude[listAddresses.SelectedIndex];
                newinvoice.longitude = currentgeodata.longitude[listAddresses.SelectedIndex];
                mysql_invoices.UpdateInvoice(newinvoice, inputinvoice);
                if (_bw != null)
                {
                    _bw.Dispose();
                }

            }
            catch
            {

            }
            if (caller == 0)
            {

                DeliverySchedule deliveryschedule = new DeliverySchedule();
                deliveryschedule.SetDate(viewdate,0);
                deliveryschedule.Show();
                this.Close();
            }
            else if(caller==1)
            {
                ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
                configureroute.SetData(viewdate, driverinfo);
                configureroute.Show();
            }
            else if (caller == 2)
            {
                EditInvoice editinvoice = new EditInvoice();
                editinvoice.SetInvoice(inputinvoice, flag,viewdate,driverinfo,0);
                editinvoice.Show();
            }
            this.Close();
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //check blank fields
                if (textInvoice.Text == "" || textValue.Text == "" || textCustomer.Text == "" || textStreet.Text == "" || textCity.Text == "" || textZip.Text == "" || textState.Text == "")
                {
                    toolStripStatusLabel1.Text = "Some required fields are blank.";
                }

                string pattern = @"^\$?\-?([1-9]{1}[0-9]{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\-?\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\(\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))\)$";
                if (!Regex.IsMatch(textValue.Text, pattern))
                {
                    textValue.Focus();
                    toolStripStatusLabel1.Text = "Value must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                pattern = @"^[0-9]+$";
                if (!Regex.IsMatch(textInvoice.Text, pattern))
                {
                    textInvoice.Focus();
                    toolStripStatusLabel1.Text = "Invoice number must be a number.";
                    return;
                }
                newinvoice.number = Int32.Parse(textInvoice.Text);
                newinvoice.value = DataFormat.FormatMoneyToInt(textValue.Text);
                newinvoice.customername = textCustomer.Text;
                newinvoice.due = DatePicker.Value;
                newinvoice.addr1 = textStreet.Text;
                newinvoice.addr2="";
                newinvoice.city = textCity.Text;
                newinvoice.zip = textZip.Text;
                newinvoice.state = textState.Text;

                mysql_invoices.UpdateInvoice(newinvoice, inputinvoice);
            }
            catch
            {
                toolStripStatusLabel1.Text = "Failed to update invoice.";
                return;
            }

            if (caller == true)
            {
                DeliverySchedule deliveryschedule = new DeliverySchedule();
                deliveryschedule.SetDate(viewdate,this.selection);
                deliveryschedule.Show();
                this.Close();
            }
            else
            {
                ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
                configureroute.SetData(viewdate, driverinfo);
                configureroute.Show();

            }
            this.Close();
        }
Exemplo n.º 6
0
 private void Cancel_Click_1(object sender, EventArgs e)
 {
     if (caller == true)
     {
         DeliverySchedule deliveryschedule = new DeliverySchedule();
         deliveryschedule.SetDate(viewdate,this.selection);
         deliveryschedule.Show();
         this.Close();
     }
     else
     {
         ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
         configureroute.SetData(viewdate, driverinfo);
         configureroute.Show();
     }
     this.Close();
 }