Пример #1
0
        private void label2_Click(object sender, EventArgs e)
        {
            int    flag = 0;
            string numH;

            numH = tutor_db.GetAmauntHours(id_tu).ToString();
            if (Int32.Parse(numH) < 0)
            {
                MessageBox.Show("Invildable num of hours for the Tutors\n");
                flag = 1;
            }
            else if (Int32.Parse(numH) == 0)
            {
                MessageBox.Show("There is no left huors for the Tutors\n");
                flag = 1;
            }
            if (flag == 0)//all good :)
            {
                label2.Text = numH;
            }
        }
Пример #2
0
        private void check_Click(object sender, EventArgs e)
        {
            int    flag = 0;
            string numH;
            int    user_check = 0;

            while (flag == 0)
            {
                if (string.IsNullOrWhiteSpace(tb_id.Text))
                {
                    MessageBox.Show("Have empty field.");
                    tb_username.Text = String.Empty;
                    tb_id.Text       = String.Empty;

                    break;
                }

                else if (string.IsNullOrWhiteSpace(tb_username.Text))
                {
                    MessageBox.Show("Have empty field.");
                    tb_id.Text       = String.Empty;
                    tb_username.Text = String.Empty;

                    break;
                }

                //check if the Tutor exist----//check if the lecture exist
                else if ((!tutor_db.existTutors(tb_username.Text, tb_id.Text)) && (!lecturers_db.existlecturer_db(tb_username.Text, tb_id.Text)))
                {
                    // MessageBox.Show("Tutor not existe\n");
                    MessageBox.Show("User not existe\n");

                    tb_id.Text       = String.Empty;
                    tb_username.Text = String.Empty;
                    user_check       = 0;//=1
                    break;
                }
                else if (tutor_db.existTutors(tb_username.Text, tb_id.Text))
                {
                    user_check = 1; //tutors
                    flag       = 1; //out loop
                }
                else
                {
                    user_check = 2; //lecturer
                    flag       = 1; //out loop
                }
            }
            flag = 0;
            if (user_check == 0)
            {
                MessageBox.Show("ERROR:User lecture & Tutor\n");
            }
            if (user_check == 2)
            {
                //lec
                numH = lecturers_db.GetAmauntHours(tb_id.Text);
                if (Convert.ToInt32(numH) < 0)
                {
                    MessageBox.Show("Invildable num of hours for the lecturers\n");
                    flag = 1;
                }
                else if (Convert.ToInt32(numH) == 0)
                {
                    MessageBox.Show("There is no left huors for the lecturers\n");
                    flag = 1;
                }
                if (flag == 0)//all good :)
                {
                    tb_left.Text = numH.ToString();
                }
            }
            if (user_check == 1)
            {
                //tot
                numH = tutor_db.GetAmauntHours(tb_id.Text).ToString();
                if (Convert.ToInt32(numH) < 0)
                {
                    MessageBox.Show("Invildable num of hours for the Tutors\n");
                    flag = 1;
                }
                else if (Convert.ToInt32(numH) == 0)
                {
                    MessageBox.Show("There is no left huors for the Tutors\n");
                    flag = 1;
                }
                if (flag == 0)//all good :)
                {
                    tb_left.Text = numH.ToString();
                }
            }
        }