Exemple #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            Form12 f12 = new Form12();

            f12.Show();
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //  try
            // {
            if (!string.IsNullOrEmpty(this.comboBox1.Text))
            {
                int ye = Convert.ToInt16(label2.Text);

                cmd = new SqlCommand("select write from contr where materialcode =(select MaterialCode from Materials where MaterialCourseTitle='" + comboBox1.Text + "') and year=" + ye + " and semester='" + label4.Text + "'", cn);
                cn.Open();
                dr = cmd.ExecuteReader();
                dr.Read();
                string write = dr[0].ToString();
                dr.Close();
                cn.Close();
                if (write == "0")
                {
                    int yea = Convert.ToInt16(label2.Text);
                    cmd = new SqlCommand(" exec inserte7 @idofstudent='" + nationalid + "' ,@course='" + comboBox1.SelectedItem.ToString() + "',@year=" + yea + " ,@semester='" + label4.Text + "' ", cn);
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    cn.Close();
                    button1.Visible = true;
                    textBox1.Clear();
                    textBox1.ReadOnly = false;
                    comboBox1.Text    = null;
                    comboBox1.Items.Clear();
                    this.Size = new Size(904, 171);
                }
                else if (write == "1")
                {
                    int yea = Convert.ToInt16(label2.Text);
                    cmd = new SqlCommand(" update totalgpa set gpa=null where nationalid='" + nationalid + "' and year=" + yea + " and semester='" + label4.Text + "' ", cn);
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    cn.Close();
                    cmd = new SqlCommand(" exec inserte7 @idofstudent='" + nationalid + "' ,@course='" + comboBox1.SelectedItem.ToString() + "',@year=" + yea + " ,@semester='" + label4.Text + "' ", cn);
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    cn.Close();
                    DialogResult r = MessageBox.Show("الذهاب ورصد الدرجه الان ", "رسالة", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

                    if (r == DialogResult.Yes)
                    {
                        Form12 FrmStudentGrades = new Form12();
                        cmd = new SqlCommand("select [year],semester from stateofregisteration where id=(select max(id) from stateofregisteration)", cn);
                        cn.Open();
                        dr = cmd.ExecuteReader();
                        dr.Read();
                        FrmStudentGrades.label4.Text = dr[0].ToString();
                        FrmStudentGrades.label6.Text = dr[1].ToString();

                        string se = dr[1].ToString();
                        dr.Close();
                        cn.Close();
                        FrmStudentGrades.Show();
                        this.Close();
                    }
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("من فضللك المادة الدراسيه ", "رسالة", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            /*    }
             *  catch
             *  {
             *      MessageBox.Show("من فضللك التاكد من الاتصال بقاعده البيانات ", "رسالة", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *  }*/
        }
Exemple #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form12 form = new Form12();

            form.Show();
        }