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 = "";
        }
예제 #2
0
 private void addDriverToTHRyan(string driverName,DateTime date)
 {
     WeeklyLog newDriver = new WeeklyLog(driverName,date);
     THRyanFlowPanel.Controls.Add(newDriver);
     newDriver.Show();
 }