Exemplo n.º 1
0
 private void updateAddDriver()
 {
     MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
     MySqlConnection sqlReader = MySQLHandle.Connect();
     MySQLHandle.Update("UPDATE `rrs`.`drivers` SET `DRV_NAME` = '" + driverNameTextbox.Text + "', `DRV_HOUR_RATE` = '" + hourlyRateTextbox.Text + "', `DRV_FUEL_SURCH` = '" + mileageRateTextbox.Text + "' WHERE `drivers`.`DRV_NAME` ='" + currentAddDriver + "';", sqlReader);
     sqlReader.Close();
 }
Exemplo n.º 2
0
        void bw3_DoWork(object sender, DoWorkEventArgs e)
        {
            DateTime viewdate = currentLogDate.Value;
            try
            {
                //get invoices for current day
                MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
                MySqlConnection sqlReader = MySQLHandle.Connect();
                string selectquery = "SELECT `invoice` FROM shipping_log WHERE `date_delivered` LIKE '" + currentLogDate.Value.ToString("yyyy-MM-dd") + "';";
                MySqlDataReader dataReader = MySQLHandle.Select(selectquery, sqlReader);
                List<int> invoices = new List<int>();
                for (int i = 0; dataReader.Read(); i++)
                {

                    invoices.Add(dataReader.GetInt32(0));
                }
                dataReader.Close();
                sqlReader.Close();
                rrsdatareader = new RRSDataReader(GlobalVar.sqlsettings.RRSHeaderFile, GlobalVar.sqlsettings.RRSLinesFile);
                rrsdatareader.ReadInvoices(viewdate);

                List<Invoice> filteredinvoices = rrsdatareader.FilterInvoices(viewdate, invoices);

                //List<LineItem> filteredlineitems = rrsdatareader.FilterLineItems(filteredinvoices);
                List<Invoice> newfilteredinvoices = new List<Invoice>(filteredinvoices);
                mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
                newfilteredinvoices = mysql_invoices.AddInvoices(newfilteredinvoices, false);
                mysql_invoices.UpdateInvoices(filteredinvoices, viewdate, true);
                dataReader.Close();
                sqlReader.Close();
                MySQLHandle.Disconnect();
                for (int i = 0; i < newfilteredinvoices.Count; i++)
                {
                    MySqlConnection sqlWriter = MySQLHandle.Connect();
                    String updatecmd = "UPDATE `shipping_log` SET customer_name='" + newfilteredinvoices[i].customername + "' WHERE `invoice`=" + newfilteredinvoices[i].number + ";";
                    MySQLHandle.Update(updatecmd, sqlWriter);
                    MySQLHandle.Disconnect();
                }
            }
            catch { }
        }
Exemplo n.º 3
0
        private void updateDriver()
        {
            string driverName = "" + this.Controls[0].Text;

            DateTimePicker temp = (DateTimePicker)this.Parent.Parent.Parent.Parent.Controls["logDate"];
            DateTime logDate = temp.Value;
            GregorianCalendar gc = new GregorianCalendar();
            int weekno = gc.GetWeekOfYear(logDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
            string stringdate = DateTime.Now.Year.ToString() + weekno.ToString();

            MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
            MySqlConnection sqlWriter = MySQLHandle.Connect();
            string command = "UPDATE `th_ryan_invoices` SET `cost`="+costTextBox.Text+" ,`billed_hours`="+billedhoursTextbox.Text+",`billed_miles`="+billedmilesTextbox.Text+", review='"+weeklyReviewTextBox.Text+"' WHERE `driver` LIKE '" + driverName + "' AND `date` LIKE '" + stringdate + "';";
            MySQLHandle.Update(command, sqlWriter);
            MySQLHandle.Disconnect();
        }
        private void updateDriverInfo()
        {
            try
            {
                string reviewtext = "";
                if (reviewCheckbox.Checked == true)
                {
                    reviewtext = weeklyReviewTextBox.Text;
                }
                DateTimePicker temp = (DateTimePicker)this.Parent.Parent.Parent.Parent.Controls["logDate"];
                DateTime viewdate = temp.Value;
                Driver driver = new Driver(driverLabel.Text.ToString(), Convert.ToDouble(billedhoursTextbox.Text), Convert.ToDouble(billedmilesTextbox.Text), reviewtext, temp.Value);
                MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost,GlobalVar.sqlport,GlobalVar.sqldatabase,GlobalVar.sqlusername,"");
                MySqlConnection sqlWriter = MySQLHandle.Connect();

                MySQLHandle.Update("UPDATE `rrs`.`driver_log` SET `miles` = " + driver.miles.ToString("N" + 2) + ",`hours` = " + driver.hours.ToString("N" + 2) + ", reason='" + driver.reason.ToString() + "' WHERE (`driver_log`.`driver` LIKE '" + driverLabel.Text + "') && (`driver_log`.`date` LIKE '" + viewdate.Date.ToString("yyyy-MM-dd") + "');", sqlWriter);
                //MySQLHandle.Update("UPDATE `rrs`.`driver_log` SET `miles` = " + billedhoursTextbox.Text + " WHERE (`driver_log`.`driver` = '" + driverLabel.Text + "') && (`driver_log`.`date` = '" + viewdate.Date.ToString("yyyy-MM-dd") + "');", sqlWriter);
                //MySQLHandle.updateDriverHourLogger(driver, sqlWriter);
                MySQLHandle.Disconnect();
            }
            catch { }
        }