Esempio n. 1
0
        private void linkLabel10_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CreateGroup g = new CreateGroup();

            this.Hide();
            g.Show();
        }
Esempio n. 2
0
        private void groupBox1_Enter(object sender, EventArgs e)
        {
            CreateGroup frm = new CreateGroup();

            this.Hide();
            frm.Show();
        }
Esempio n. 3
0
        public void Addstudentinexistinggroup(ComboBox comboBox2, DataGridView dataGridView1, Label labelerror, Label lblerror)
        {
            if (comboBox2.Text != "")
            {
                string     cmd     = "select GroupId from GroupProject where ProjectId = (Select Id from Project where Title = '" + comboBox2.Text + "')";
                int        h       = dbConnection.getInstance().getScalerData(cmd);
                string     co      = "Select count(StudentId) from GroupStudent where GroupId = '" + h + "'";
                int        ho      = dbConnection.getInstance().getScalerData(co);
                bool       iss     = false;
                int        count   = 0;
                List <int> indexes = new List <int>();
                foreach (DataGridViewRow r in dataGridView1.Rows)
                {
                    if (Convert.ToBoolean(r.Cells["ADD"].Value) == true)
                    {
                        count++;
                        iss = true;
                        int com = r.Index;
                        indexes.Add(com);
                    }
                }
                if (count == 0)
                {
                    labelerror.Text    = "Select the student first";
                    labelerror.Visible = true;
                }

                if (ho + count <= 4 && comboBox2.Text != "")
                {
                    foreach (int i in indexes)
                    {
                        foreach (DataGridViewRow row in dataGridView1.Rows)

                        {
                            if (row.Index == i)
                            {
                                string Reg = row.Cells["RegistrationNo"].Value.ToString();
                                string cd  = "Select Id from Student where RegistrationNo ='" + Reg + "'";

                                int q = dbConnection.getInstance().getScalerData(cd);


                                string final = "Insert into GroupStudent (GroupId, StudentId,Status,AssignmentDate) values ('" + h + "','" + q + "','" + 4 + "','" + DateTime.Now.Date + "')";
                                dbConnection.getInstance().exectuteQuery(final);
                            }
                        }
                    }
                    MessageBox.Show("Student has been added");
                    // CreateGroup.Hide();
                    CreateGroup frm = new CreateGroup();
                    frm.Hide();
                    CreateGroup frmo = new CreateGroup();
                    frmo.Show();
                }
                else if (comboBox2.Text == "")
                {
                    lblerror.Text    = "Select Title for project";
                    lblerror.Visible = true;
                }
                else if (ho + count > 4)
                {
                    labelerror.Text    = "Only 4 students are allowed in each group";
                    labelerror.Visible = true;
                }
            }
            else
            {
                lblerror.Text    = "Select Title for project";
                lblerror.Visible = true;
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Group g     = new Group();
            bool  iss   = g.checkboxchech(dataGridView1);
            int   count = g.NoOfSt(dataGridView1);

            if (iss == true && comboBox1.Text != "" && count <= 4)
            {
                List <int> indexess = new List <int>();

                string cmd2 = "Insert into [Group] (Created_On) Values ('" + DateTime.Now.Date + "')";
                dbConnection.getInstance().exectuteQuery(cmd2);
                string cmd3 = "Select max(Id) from [Group]";

                int gh = dbConnection.getInstance().getScalerData(cmd3);



                string cmdt = "Select Id from Project where Title = '" + comboBox1.Text + "'";

                int yu = dbConnection.getInstance().getScalerData(cmdt);


                string vb = "Insert into GroupProject (ProjectId,GroupId,AssignmentDate) values ('" + yu + "','" + gh + "','" + DateTime.Now + "')";
                dbConnection.getInstance().exectuteQuery(vb);
                //List of those row indexes having add checkbox checked
                List <int> indexes = g.ListOfindexes(indexess, dataGridView1);
                foreach (int i in indexes)
                {
                    foreach (DataGridViewRow row in dataGridView1.Rows)

                    {
                        if (row.Index == i)
                        {
                            string Reg = row.Cells["RegistrationNo"].Value.ToString();
                            string cmd = "Select Id from Student where RegistrationNo ='" + Reg + "'";

                            int q = dbConnection.getInstance().getScalerData(cmd);

                            string s = "Select Id from Lookup where Category = 'STATUS' and Value = 'InActive'";


                            int qo = dbConnection.getInstance().getScalerData(s);

                            string final = "Insert into GroupStudent (GroupId, StudentId,Status,AssignmentDate) values ('" + gh + "','" + q + "','" + qo + "','" + DateTime.Now.Date + "')";
                            dbConnection.getInstance().exectuteQuery(final);
                        }
                    }
                }
                MessageBox.Show("Group has been Created");
                this.Hide();
                CreateGroup gm = new CreateGroup();
                gm.Show();
            }
            else if (count > 4)
            {
                labelerror.Text    = "Only 4 students are allowed in a group";
                labelerror.Visible = true;
            }
            else if (comboBox1.Text == "")
            {
                lblerror.Text    = "Please Select a Title";
                lblerror.Visible = true;
            }
            else if (iss == false)
            {
                lblerror.Text    = "Select Student First";
                lblerror.Visible = true;
            }
        }