Exemplo n.º 1
0
        private void back1_Click(object sender, EventArgs e)
        {
            evaluations s = new evaluations();

            this.Hide();
            s.Show();
        }
Exemplo n.º 2
0
        private void evllist_Click(object sender, EventArgs e)
        {
            evaluations ev = new evaluations();

            this.Hide();
            ev.Show();
        }
Exemplo n.º 3
0
        private void saveupadd_Click(object sender, EventArgs e)
        {
            Evaluation evl = new Evaluation();

            Regexp(@"^[a-zA-Z]{1,100}", nametext, addnme, "name");
            Regexp(@"^[0-9]{1,20}", tmrkstxt, tmeks, "Total Marks");
            Regexp(@"^[0-9]{1,20}", twttxt, twt, "Total Weightage");
            evl.Name       = nametext.Text;
            evl.totalmarks = Convert.ToInt32(tmrkstxt.Text);
            evl.weightage  = Convert.ToInt32(twttxt.Text);
            if (Convert.ToInt32(obttext.Text) > Convert.ToInt32(tmrkstxt.Text))
            {
                MessageBox.Show("Obtain marks should be less than or equal to Total Marks");
                obttext.Clear();
            }
            else
            {
                String cmd = String.Format("UPDATE Evaluation SET Name = '{0}' , TotalMarks = '{1}',TotalWeightage='{2}' WHERE Id ='{3}' ", evl.Name, evl.totalmarks, evl.weightage, ide);
                DatabaseConnection.getInstance().exectuteQuery(cmd);
                cmd = String.Format("SELECT GroupProject.GroupId FROM Project JOIN GroupProject On (Project.Id = GroupProject.ProjectId) WHERE (title = '{0}')", procombo.Text);
                SqlCommand a = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int        id;
                id = (Int32)a.ExecuteScalar();

                cmd = String.Format("UPDATE  GroupEvaluation SET ObtainedMarks = '{0}',EvaluationDate = GetDate() WHERE EvaluationId = '{1}' AND GroupId= '{2}')", obttext.Text, ide, id);
                DatabaseConnection.getInstance().exectuteQuery(cmd);

                evaluations s = new evaluations();
                this.Hide();
                s.Show();
            }
        }
Exemplo n.º 4
0
 private void delstu_Click(object sender, EventArgs e)
 {
     if (dataGridstudent.SelectedCells.Count != 0)
     {
         int        rw  = dataGridstudent.SelectedCells[0].RowIndex;
         String     cmd = String.Format("Select Id from Evaluation  Where Name = '{0}'", dataGridstudent.Rows[rw].Cells["Evaluation Name"].Value.ToString());
         SqlCommand del = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
         int        idp;
         idp = (Int32)del.ExecuteScalar();
         cmd = String.Format("delete from GroupEvaluation Where Evaluation.EvaluationId = '{0}'", idp);
         del = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
         int         count = del.ExecuteNonQuery();
         evaluations p     = new evaluations();
         this.Hide();
         p.Show();
     }
 }
Exemplo n.º 5
0
        private void createbtn_Click(object sender, EventArgs e)
        {
            Evaluation evl = new Evaluation();

            Regexp(@"^[a-zA-Z]{1,100}", nametext, addnme, "name");
            Regexp(@"^[0-9]{1,20}", tmrkstxt, tmeks, "Contact");
            Regexp(@"^[0-9]{1,20}", obttext, obt, "Contact");
            Regexp(@"^[0-9]{1,20}", twttxt, twt, "Contact");
            if (Convert.ToInt32(obttext.Text) > Convert.ToInt32(tmrkstxt.Text))
            {
                MessageBox.Show("Obtain marks should be less than or equal to Total Marks");
                obttext.Clear();
            }
            else
            {
                evl.Name       = nametext.Text;
                evl.totalmarks = Convert.ToInt32(tmrkstxt.Text);
                evl.weightage  = Convert.ToInt32(twttxt.Text);
                String cmd = String.Format("INSERT INTO Evaluation(Name,TotalMarks,TotalWeightage) values('{0}','{1}','{2}' )", evl.Name, evl.totalmarks, evl.weightage);
                DatabaseConnection.getInstance().exectuteQuery(cmd);
                cmd = String.Format("SELECT GroupProject.GroupId FROM Project JOIN GroupProject On (Project.Id = GroupProject.ProjectId) WHERE (title = '{0}')", procombo.Text);
                SqlCommand a = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int        id;
                id  = (Int32)a.ExecuteScalar();
                cmd = String.Format("SELECT Max(Id) FROM Evaluation");
                a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int ide;
                ide = (Int32)a.ExecuteScalar();

                cmd = String.Format("INSERT INTO GroupEvaluation(GroupId,EvaluationId,ObtainedMarks,EvaluationDate) values('{0}','{1}','{2}',GetDate() )", id, ide, obttext.Text);
                DatabaseConnection.getInstance().exectuteQuery(cmd);
                evaluations s = new evaluations();
                this.Hide();
                s.Show();
            }
        }