Exemplo n.º 1
0
        private void cancel_Click(object sender, EventArgs e)
        {
            DashBoard d = new DashBoard();

            this.Hide();
            d.Show();
        }
Exemplo n.º 2
0
        private void delete_Click(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand cmd = new SqlCommand("DROP TABLE " + Session.UNAME + "" + rname.Text + "", con);

            cmd.ExecuteNonQuery();
            DashBoard d = new DashBoard();

            this.Hide();
            d.Show();
            MessageBox.Show("Deleted", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.None);
        }
Exemplo n.º 3
0
 private void create_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         SqlCommand cmd = new SqlCommand("CREATE TABLE [" + Session.UNAME + "" + rname.Text + "] (Name varchar(20) NOT NULL,Enrollment varchar(20) NOT NULL," + sub1.Text + " int NOT NULL ," + sub2.Text + " int NOT NULL ," + sub3.Text + " int NOT NULL ," + sub4.Text + " int NOT NULL ," + sub5.Text + " int NOT NULL,Average VARCHAR(5) NOT NULL,Grade varchar(5) NOT NULL)", con);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Created Successfull", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.None);
         DashBoard d = new DashBoard();
         this.Hide();
         d.Show();
     }
     catch { }
 }
Exemplo n.º 4
0
        private void update_Click(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand cmd   = new SqlCommand("UPDATE [User] SET UserName = '******', password = '******', [Class Name] = '" + classname.Text + "', Email = '" + email.Text + "'WHERE  (UserName = '******')", con);
            int        count = cmd.ExecuteNonQuery();

            if (count > 0)
            {
                DashBoard d = new DashBoard();
                this.Hide();
                d.Show();
                MessageBox.Show("Updated Successfully !!!", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            else
            {
                DashBoard d = new DashBoard();
                this.Hide();
                d.Show();
                MessageBox.Show("there is some problem occur in updation...!", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            con.Close();
        }
        private void update_Click(object sender, EventArgs e)
        {
            try
            {
                con.Open();
                int[] a = new int[5];
                a[0] = Convert.ToInt32(sub1t.Text);
                a[1] = Convert.ToInt32(sub2t.Text);
                a[2] = Convert.ToInt32(sub3t.Text);
                a[3] = Convert.ToInt32(sub4t.Text);
                a[4] = Convert.ToInt32(sub5t.Text);
                int sum = 0;
                for (int i = 0; i < 5; i++)
                {
                    sum += a[i];
                }
                float  avg      = sum / 5;
                string avgfinal = avg + "";

                if (avg >= 85 && avg <= 100)
                {
                    grade = "AA";
                }
                else if (avg >= 75 && avg <= 84)
                {
                    grade = "AB";
                }
                else if (avg >= 65 && avg <= 74)
                {
                    grade = "BB";
                }
                else if (avg >= 55 && avg <= 64)
                {
                    grade = "BC";
                }
                else if (avg >= 45 && avg <= 54)
                {
                    grade = "CC";
                }
                else if (avg >= 40 && avg <= 44)
                {
                    grade = "CD";
                }
                else if (avg > 35 && avg <= 39)
                {
                    grade = "DD";
                }
                else if (avg <= 35)
                {
                    grade = "AB";
                }
                SqlCommand cmd   = new SqlCommand("UPDATE [" + tname + "] SET Name = '" + stname + "', Enrollment = '" + enroll.Text + "', " + s[0] + " = '" + sub1t.Text + "', " + s[1] + " = '" + sub2t.Text + "', " + s[2] + " = '" + sub3t.Text + "', " + s[3] + " = '" + sub4t.Text + "', " + s[4] + " = '" + sub5t.Text + "',Average='" + avgfinal + "',Grade='" + grade + "'  WHERE (Enrollment = '" + enroll.Text + "')", con);
                int        count = cmd.ExecuteNonQuery();
                if (count > 0)
                {
                    DashBoard d = new DashBoard();
                    this.Hide();
                    d.Show();
                    MessageBox.Show("Updated Successfully !!!", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
                else
                {
                    DashBoard d = new DashBoard();
                    this.Hide();
                    d.Show();
                    MessageBox.Show("there is some problem occur in updation...!", "Grading_System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.Close();
            }
            catch { }
        }