コード例 #1
0
        private void BackButton_Click(object sender, EventArgs e)
        {
            GroupEvaluation form = new GroupEvaluation();

            form.Show();
            this.Close();
        }
コード例 #2
0
        private void GroupEvaluations_Click(object sender, EventArgs e)
        {
            GroupEvaluation form = new GroupEvaluation();

            form.Show();
            this.Hide();
        }
コード例 #3
0
        private void EvaluateButton_Click(object sender, EventArgs e)
        {
            try
            {
                int    groupId        = Convert.ToInt32(GroupsComboBox.Text);
                string EvaluationName = EvaluationComboBox.Text;
                int    ObtMarks       = Convert.ToInt32(ObtainedMarksNUmericUpDown.Value.ToString());

                SqlConnection conn = new SqlConnection(connString);
                conn.Open();
                if (value != "edit")
                {
                    string     eval = string.Format("INSERT INTO GroupEvaluation(GroupId, EvaluationId, ObtainedMarks, EvaluationDate) Values('{0}', '{1}', '{2}', '{3}')", groupId, evalId, ObtMarks, DateTime.Now);
                    SqlCommand cmd  = new SqlCommand(eval, conn);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Group Evaluated!");
                }
                else if (value == "edit")
                {
                    string getid = string.Format("SELECT Id FROM EValuation WHERE Name = '{0}'", Ename);
                    string eval  = string.Format("UPDATE GroupEvaluation SET ObtainedMarks = '{0}', EvaluationDate = '{3}' WHERE GroupId = '{1}' AND EvaluationId = '{2}'", Convert.ToInt32(ObtainedMarksNUmericUpDown.Value.ToString()), Gid, evalId, DateTime.Now);

                    SqlCommand cmd = new SqlCommand(getid, conn);
                    int        id  = (Int32)cmd.ExecuteScalar();
                    cmd.CommandText = string.Format("UPDATE GroupEvaluation SET ObtainedMarks = '{0}', EvaluationDate = '{3}' WHERE GroupId = '{1}' AND EvaluationId = '{2}'", Convert.ToInt32(ObtainedMarksNUmericUpDown.Value.ToString()), Gid, id, DateTime.Now);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Obtained marks updated!");
                }
                GroupEvaluation form = new GroupEvaluation();
                form.Show();
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Please select group, evaluation from the drop-down list and enter the obtained marks");
            }
        }