Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public frmEnterCheck()
- {
- InitializeComponent();
- }
- private string tableName;
- private string user;
- public frmEnterCheck(string table, string user)
- {
- InitializeComponent();
- this.tableName = table;
- this.user = user;
- lblTableName.Text = table;
- }
- public void checkValues()
- {
- if (tbDrop.Text == "" || tbHeadcount.Text == "" || tbTo.Text == "" || tbFrom.Text == "" || tbResult.Text == "" || monthCalendar1.SelectionRange.Start.ToShortDateString() == null)
- {
- MessageBox.Show("Please enter all values and pick a date", "Invalid entry");
- return;
- }
- }
- private void btnFinish_Click(object sender, EventArgs e)
- {
- checkValues();
- //all good, insert
- int year = monthCalendar1.SelectionStart.Year;
- int month = monthCalendar1.SelectionStart.Month;
- int day = monthCalendar1.SelectionStart.Day;
- Data newData = new Data(user, tableName, year, month, day, int.Parse(tbFrom.Text), int.Parse(tbTo.Text),
- double.Parse(tbDrop.Text), double.Parse(tbResult.Text), int.Parse(tbHeadcount.Text));
- DbConnect conn = new DbConnect();
- conn.openConnection();
- conn.addNewData(newData);
- conn.closeConnection();
- MessageBox.Show("Successfully added!");
- this.Close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement