Exemplo n.º 1
0
        private void dgvEvaluations_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                Id = Evaluation.Evaluations[e.RowIndex].Id1;
                Evaluation evaluation = Evaluation.Evaluations[e.RowIndex];
                txtName.Text      = evaluation.Name1;
                txtMarks.Text     = evaluation.TotalMarks1.ToString();
                txtWeightage.Text = evaluation.TotalWeightage1.ToString();

                Mode = 1;
            }
            else if (e.ColumnIndex == 1)
            {
                Id = Evaluation.Evaluations[e.RowIndex].Id1;
                string Delete = "DELETE FROM GroupEvaluation WHERE EvaluationId = '" + Id + "'";
                string Delete_Group_Evaluation = "DELETE FROM Evaluation WHERE Id = '" + Id + "'";
                try
                {
                    SqlConnection con = new SqlConnection(AddProject.conStr);
                    con.Open();
                    if (con.State == ConnectionState.Open)
                    {
                        SqlCommand cmd = new SqlCommand(Delete_Group_Evaluation, con);
                        cmd.ExecuteNonQuery();
                    }
                    if (con.State == ConnectionState.Open)
                    {
                        SqlCommand cmd = new SqlCommand(Delete, con);
                        cmd.ExecuteNonQuery();
                    }
                    setGrid();

                    MessageBox.Show("Succesfully Deleted");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:" + ex);
                }
            }
        }
Exemplo n.º 2
0
        private void GEdatagrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to delete this Group Evaluation?", "Group Evaluation", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    DeleteGE();
                }
                else if (result == DialogResult.No)
                {
                    this.Hide();
                    Evaluation obj = new Evaluation();
                    obj.Show();
                }
            }
            if (e.ColumnIndex == 5)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to update this Group Evaluation?", "Group Evaluation", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    edpanbt.Hide();
                    addpan.Hide();
                    panel2.Hide();
                    panel1.Hide();

                    shoeGE.Hide();

                    panel3.Show();
                }
                else if (result == DialogResult.No)
                {
                    this.Hide();
                    Evaluation obj = new Evaluation();
                    obj.Show();
                }
            }
        }
Exemplo n.º 3
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();
            }
        }
        private void button9_Click_1(object sender, EventArgs e)
        {
            Evaluation evalfm = new Evaluation();

            evalfm.Show();
        }
Exemplo n.º 5
0
        private void button6_Click(object sender, EventArgs e)
        {
            Evaluation fm2 = new Evaluation();

            fm2.Show();
        }
Exemplo n.º 6
0
        private void button10_Click(object sender, EventArgs e)
        {
            Evaluation eval = new Evaluation();

            eval.Show();
        }
        private void eval_Click(object sender, EventArgs e)
        {
            Evaluation evalfm = new Evaluation();

            evalfm.Show();
        }
Exemplo n.º 8
0
        private void addGEbt_Click(object sender, EventArgs e)
        {
            con.Close();
            con.Open();
            SqlCommand check_User_Name = new SqlCommand("SELECT GroupId FROM GroupEvaluation WHERE ([GroupId] = @GI) AND ([EvaluationId] = @EI)", con);

            check_User_Name.Parameters.AddWithValue("GI", GItxt.Text);
            check_User_Name.Parameters.AddWithValue("EI", GItxt.Text);
            SqlDataReader reader = check_User_Name.ExecuteReader();

            if (reader.HasRows)
            {
                con.Close();
                MessageBox.Show("Already exists.");
            }
            else
            {
                //string id = evaldispGrid.SelectedCells[0].Value.ToString();
                SqlCommand    cmd1    = new SqlCommand("SELECT * FROM Evaluation WHERE Id = '" + EItxt.Text + "'", con);
                SqlDataReader reader1 = cmd1.ExecuteReader();
                if (!(reader1.HasRows))
                {
                    con.Close();
                    MessageBox.Show("Evaluation Is Not Present Defined.");
                }
                else
                {
                    SqlCommand cmd       = new SqlCommand("Select TotalMarks from Evaluation WHERE Id = '" + EItxt.Text + "';", con);
                    object     countstd1 = cmd.ExecuteScalar();
                    int        countstd  = 0;
                    if (!(countstd1 == DBNull.Value))
                    {
                        countstd = Convert.ToInt32(countstd1);
                    }

                    if (countstd <= Convert.ToInt32(OMtxt.Text))
                    {
                        con.Close();
                        MessageBox.Show("Obtained marks must not excedd TotalMarks.");
                    }
                    else
                    {
                        cmd1 = new SqlCommand("SELECT * FROM [Group] WHERE Id = '" + GItxt.Text + "'", con);
                        SqlDataReader reader2 = cmd1.ExecuteReader();
                        if (!(reader2.HasRows))
                        {
                            con.Close();
                            MessageBox.Show("Group does not exists.");
                        }
                        else
                        {
                            try
                            {
                                cmd = con.CreateCommand();
                                cmd = new SqlCommand("INSERT INTO GroupEvaluation(GroupId,EvaluationId,ObtainedMarks,EvaluationDate) VALUES(@GroupId,@EvaluationId,@ObtainedMarks,@EvaluationDate);SELECT SCOPE_IDENTITY();", con);
                                cmd.Parameters.AddWithValue("@GroupId", GItxt.Text);
                                cmd.Parameters.AddWithValue("@EvaluationId", EItxt.Text);
                                cmd.Parameters.AddWithValue("@ObtainedMarks", OMtxt.Text);
                                cmd.Parameters.AddWithValue("@EvaluationDate", DateTime.Parse(datetx.Text));
                                cmd.ExecuteNonQuery();
                                con.Close();
                                MessageBox.Show("Added.");
                                this.Hide();
                                Evaluation obj = new Evaluation();
                                obj.Show();
                            }
                            catch
                            {
                                MessageBox.Show("Something went wrong.");
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
 private void groupWiseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Evaluation l = Evaluation.getInstance();
     l.Show();
     this.Hide();
 }