コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //FETCHING DATA FROM SERVER
            //GEMIZEI TO COMBOBOX ME OLA TA DITHESIMA STATISTIKS
            username = textBox1.Text;
            if (!DBconnector.exists(username))
            {
                MessageBox.Show("User " + username + " not found");
                return;
            }

            ArrayList stats = new ArrayList();

            stats.Add("Bench press");
            stats.Add("Bicep curls");
            stats.Add("Deadlifts");
            stats.Add("Lat Pulldown");
            foreach (String exercise in stats)
            {
                comboBox2.Items.Add(exercise);
            }
            //Visits
            String    query = "select day(visitDate) as day  from visit  where Client_Username='******' and visitDate> DATE_SUB(NOW(), INTERVAL 1 WEEK ) group by day(visitDate);";
            ArrayList lst   = DBconnector.Select(query, "a");

            if (lst.Count == 0)
            {
                MessageBox.Show("Error");
                label2.Text = "";
            }
            else
            {
                fillVisitsGraph(lst);
                label2.Text = textBox1.Text;
            }
            //--Visits
            query = "select distinct  Exercise.Name as name from client_exercise ,exercise where  Exercise.Exerciseid=client_exercise.Exercise_Exerciseid and Client_Username='******' order by Client_Username, Exercise_Exerciseid,Weight ;";
            lst   = DBconnector.getExercises(query);
            fillFatWeight();
            comboBox2.Items.Clear();
            if (lst.Count > 0)
            {
                foreach (String exercise in lst)
                {
                    comboBox2.Items.Add(exercise);
                }
                comboBox2.SelectedIndex = 0;
                comboBox2.Visible       = true;
                chart1.Visible          = true;
                label5.Text             = "";
            }
            else
            {
                chart1.Visible    = false;
                comboBox2.Visible = false;
                label5.Text       = "DO YOU EVEN LIFT?";
                label4.Text       = "";
            }
        }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     foreach (Control c in this.Controls)
     {
         if (c is TextBox)
         {
             TextBox textBox = c as TextBox;
             if (textBox.Text == string.Empty)
             {
                 MessageBox.Show(textBox.Name + " is empty");
                 return;
             }
         }
     }
     DBconnector.Connect(server.Text, username.Text, password.Text, databaseName.Text);
     if (DBconnector.isConnected())
     {
         this.Hide();
     }
     else
     {
         MessageBox.Show("No connection");
     }
 }