Example #1
0
 //Get DB data and push to Datasource
 void LoadDB()
 {
     DSource                     = DBCall.GetTest();
     DGVTest.DataSource          = null;
     DGVTest.DataSource          = DSource;
     DGVTest.Columns[0].ReadOnly = true;
 }
Example #2
0
 //Check input and test connection
 private void BLogin_Click(object sender, EventArgs e)
 {
     if (Err.IsAllDigits(TBPort.Text))
     {
         DBCall.InitMySQL(TBIP.Text, Convert.ToUInt32(TBPort.Text), TBUser.Text, TBPass.Text, TBDB.Text);
         if (DBCall.logres)
         {
             loggedin = true;
             Close();
         }
     }
 }
Example #3
0
 //Send data to datasource
 private void BSubmit_Click(object sender, EventArgs e)
 {
     if (TBDKP.Text != null && TBDKP.Text != "" && Err.IsAllDigits(TBDKP.Text) && TBDKP.Text != DGVTest.SelectedRows[0].Cells[2].Value.ToString())
     {
         int tableval = Convert.ToInt32(DGVTest.SelectedRows[0].Cells[2].Value);
         if (RBAdd.Checked)
         {
             tableval += Convert.ToInt32(TBDKP.Text);
             DGVTest.SelectedRows[0].Cells[2].Value = tableval;
         }
         if (RBEdit.Checked)
         {
             DGVTest.SelectedRows[0].Cells[2].Value = Convert.ToInt32(TBDKP.Text);
         }
         if (RBSubtract.Checked)
         {
             tableval -= Convert.ToInt32(TBDKP.Text);
             DGVTest.SelectedRows[0].Cells[2].Value = tableval;
         }
         RefreshDB();
         DSend = GetChanges();
         DBCall.SetData();
         FuncDisable();
     }
     else if (TBDKP.Text == DGVTest.SelectedRows[0].Cells[2].Value.ToString())
     {
         FuncDisable();
     }
     //Verify input value
     else if (!Err.IsAllDigits(TBDKP.Text) && TBDKP.Text != null && TBDKP.Text != "")
     {
         MessageBox.Show("You can only use nubers.", "Input Error");
     }
     else if (TBDKP.Text == null || TBDKP.Text == "")
     {
         MessageBox.Show("Input cannot be blank", "Input Error");
     }
 }