public void SetInvoice(Invoice invoice,bool caller,DateTime date,DriverInfo driver,int selection)
 {
     inputinvoice = invoice;
     this.caller = caller;
     this.viewdate = date;
     this.driverinfo = driver;
     this.selection = selection;
 }
 public void SetInvoice(Invoice invoice,int caller,DateTime date,DriverInfo driver,bool flag)
 {
     this.flag = flag;
     inputinvoice = invoice;
     this.caller = caller;
     this.viewdate = date;
     this.driverinfo = driver;
     currentgeodata = new GeoData();
 }
 public void SetData(DateTime date,DriverInfo driverinfo)
 {
     viewdate = date;
     driver = driverinfo;
 }
        private void ApplyEdits_Click(object sender, EventArgs e)
        {
            ApplyEdits.Enabled = false;
                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(hourlyRate.Text, pattern))
                {

                    toolStripStatusLabel1.Text = "Hourly rate must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                if (!Regex.IsMatch(overtimeRate.Text, pattern))
                {

                    toolStripStatusLabel1.Text = "Overtime rate must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                if (!Regex.IsMatch(fuelSurcharge.Text, pattern))
                {

                    toolStripStatusLabel1.Text = "Fuel surcharge must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                if (!Regex.IsMatch(maitenanceSurcharge.Text, pattern))
                {

                    toolStripStatusLabel1.Text = "Maitenance surcharge must be a U.S. dollar amount (dollar symbol is optional).";
                    return;
                }
                bool flatflag = false;
                bool trailerflag = false;
                if (truckType.SelectedIndex == 0)
                {
                    flatflag = true;
                }
                if (truckType.SelectedIndex == 1)
                {
                    trailerflag = true;
                }
                int hourrate = DataFormat.FormatMoneyToInt(hourlyRate.Text);
                int overrate = DataFormat.FormatMoneyToInt(overtimeRate.Text);
                int fuelsurch = DataFormat.FormatMoneyToInt(fuelSurcharge.Text);
                int maintsurch = DataFormat.FormatMoneyToInt(maitenanceSurcharge.Text);
                DriverInfo drivertoupdate = new DriverInfo(drivers[driversList.SelectedIndex].number, name.Text, flatflag, trailerflag, hourrate, overrate, fuelsurch, maintsurch, driverNotes.Text);
                mysql_drivers.UpdateDriverInfo(drivertoupdate);
                new ConfigureAvaiableDrivers().Show();
                this.Close();
        }
 public void SetDay(DateTime day,bool flag,DriverInfo driver)
 {
     currentday = day;
     this.driver = driver;
     this.flag = flag;
 }
Example #6
0
 public bool UpdateDriverInfo(DriverInfo drivertoupdate)
 {
     MySqlConnection theconnection = Connect();
     int flag1 = 0;
     int flag2 = 0;
     if (drivertoupdate.flat == true) { flag1 = 1; }
     if (drivertoupdate.trailer == true) { flag2 = 1; }
     string updatequery = "UPDATE drivers SET `DRV_NUMBER`=" + drivertoupdate.number.ToString() + ", `DRV_NAME`='"+drivertoupdate.name+"', `DRV_FLAT`="+flag1+", `DRV_TRAILER`="+flag2+", `DRV_HOUR_RATE`="+drivertoupdate.hour_rate+",`DRV_OVERTIME`="+drivertoupdate.overtime_rate+", `DRV_FUEL_SURCH`="+drivertoupdate.fuel_surch+", `DRV_MAINT_SURCH`="+drivertoupdate.maint_surch+", `DRV_NOTES`='"+drivertoupdate.notes+"' WHERE DRV_NUMBER="+drivertoupdate.number+";";
     Update(updatequery, theconnection);
     Disconnect();
     return true;
 }
Example #7
0
        public DriverInfo GetDriverInfo(int ID)
        {
            try
            {
                MySqlConnection theconnection = Connect();

                MySqlDataReader rdr = Select("SELECT * FROM drivers WHERE DRV_NUMBER="+ID.ToString()+";", theconnection);
                rdr.Read();
                    DriverInfo driverinfo = new DriverInfo((int)rdr[0], (string)rdr[1], (bool)rdr[2], (bool)rdr[3], (int)rdr[4], (int)rdr[5], (int)rdr[6], (int)rdr[7],(string)rdr[8]);

                Disconnect();
                return (driverinfo);
            }
            catch
            {
                Disconnect();
                return null;
            }
        }
Example #8
0
 public bool AddDriverInfo(DriverInfo drivertoadd)
 {
     MySqlConnection theconnection = Connect();
     int flag1 = 0;
     int flag2 = 0;
     if (drivertoadd.flat == true) { flag1 = 1; }
     if (drivertoadd.trailer == true) { flag2 = 1; }
     string insertquery = "INSERT INTO drivers (`DRV_NUMBER`, `DRV_NAME`, `DRV_FLAT`, `DRV_TRAILER`, `DRV_HOUR_RATE`,`DRV_OVERTIME`, `DRV_FUEL_SURCH`, `DRV_MAINT_SURCH`, `DRV_NOTES`) VALUES (NULL, '"+drivertoadd.name+"', '"+flag1+"', '"+flag2+"', '"+drivertoadd.hour_rate+"','"+drivertoadd.overtime_rate+"', '"+drivertoadd.fuel_surch+"', '"+drivertoadd.maint_surch+"', '"+drivertoadd.notes+"');";
     Insert(insertquery,theconnection);
     Disconnect();
     return true;
 }
Example #9
0
 public List<DriverInfo>GetDrivers()
 {
     try{
         MySqlConnection theconnection=Connect();
         List<DriverInfo> drivers = new List<DriverInfo>();
         MySqlDataReader rdr=Select("SELECT * FROM drivers;", theconnection);
         while (rdr.Read())
         {
             DriverInfo driverinfo = new DriverInfo((int)rdr[0], (string)rdr[1], (bool)rdr[2], (bool)rdr[3], (int)rdr[4], (int)rdr[5], (int)rdr[6], (int)rdr[7],(string)rdr[8]);
             drivers.Add(driverinfo);
         }
         Disconnect();
         return (drivers);
     }catch{
         Disconnect();
     return null;
     }
 }