private void addDriverButton_Click(object sender, EventArgs e) { MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, ""); MySqlConnection sqlReader = MySQLHandle.Connect(); string stringdrivername = driverName.Text; DateTimePicker picker = (DateTimePicker)this.Parent.Parent.Parent.Parent.Controls["logDate"]; GregorianCalendar gc = new GregorianCalendar(); int weekno = gc.GetWeekOfYear(picker.Value, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday); string stringdate = "" + picker.Value.Year + weekno; string insertstring="INSERT INTO `th_ryan_invoices` (`id`, `billed_hours`, `billed_miles`, `cost`, `review`, `driver`,`date`) VALUES (NULL, '', '', '', '', '"+stringdrivername+"','"+stringdate+"');"; FlowLayoutPanel tabcontrol = (FlowLayoutPanel)this.Parent.Parent.Controls[0]; WeeklyLog newDriver = new WeeklyLog(stringdrivername,picker.Value); tabcontrol.Controls.Add(newDriver); FlowLayoutPanel newlayout = new FlowLayoutPanel(); tabcontrol.Controls.SetChildIndex(newDriver, tabcontrol.Controls.Count - 2); tabcontrol = newlayout; MySQLHandle.Insert(insertstring, sqlReader); MySQLHandle.Disconnect(); driverName.Text = ""; }
private void button2_Click(object sender, EventArgs e) { MySQL MySQLHandle = new MySQL(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, ""); MySqlConnection sqlReader = MySQLHandle.Connect(); MySQLHandle.Insert("INSERT INTO `rrs`.`drivers` (`DRV_NUMBER`, `DRV_NAME`, `DRV_FLAT`, `DRV_TRAILER`, `DRV_HOUR_RATE`, `DRV_OVERTIME`, `DRV_FUEL_SURCH`, `DRV_MAINT_SURCH`, `DRV_NOTES`) VALUES (NULL, '" + driverNameTextbox.Text + "', '1', '0', '" + hourlyRateTextbox.Text + "', '', '" + mileageRateTextbox.Text + "', '0', '0');", sqlReader); sqlReader.Close(); populateAddDriverSelect(); }