Example #1
0
        private void btn_ShowGroups_Go_Click(object sender, EventArgs e)
        {
            flp_showGroups.Controls.Clear();

            flp_showGroups.AutoScroll = false;
            flp_showGroups.HorizontalScroll.Enabled = false;
            flp_showGroups.HorizontalScroll.Visible = false;
            flp_showGroups.HorizontalScroll.Maximum = 0;
            flp_showGroups.AutoScroll = true;

            string semester          = cmb_ShowGroups_SemesterChoose.Text.ToString();
            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_groups
                        where p.grp_semester.Contains(semester)
                        where p.grp_subject.Contains(temporaryCourse)
                        where p.grp_userName.Contains(temporaryUser)
                        select p;

            foreach (var a in prods)
            {
                string grpnum   = a.grp_groupNumber;
                string grpname  = a.grp_groupName;
                string numOfmem = a.grp_NumberOfMember.ToString();
                string projName = a.grp_projectTitle;

                this.flp_showGroups.Controls.Add(new UcShowGroups(grpnum, grpname, numOfmem, projName));
            }
        }
Example #2
0
        private void btn_ShowSections_Go_Click(object sender, EventArgs e)
        {
            ClearAllFlowLayoutPanel();
            flp_show_sec.AutoScroll = false;
            flp_show_sec.HorizontalScroll.Enabled = false;
            flp_show_sec.HorizontalScroll.Visible = false;
            flp_show_sec.HorizontalScroll.Maximum = 0;
            flp_show_sec.AutoScroll = true;


            string semester = cmb_ShowSections_SemesterChooser.Text.ToString();
            string section  = cmb_ShowSections_SectionChooser.Text.ToString();
            // MessageBox.Show(semester);
            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_sections
                        where p.sec_semester.Contains(semester)
                        where p.sec_st_section.Contains(section)
                        where p.sec_subject.Contains(temporaryCourse)
                        where p.sec_username.Contains(temporaryUser)
                        select p;


            foreach (var a in prods)
            {
                string secstudentnum = a.sec_st_name;
                string secstudentid  = a.sec_st_id;
                string secstudentsec = a.sec_st_section;
                string secingroup    = a.sec_inGroup;

                this.flp_show_sec.Controls.Add(new Uc_ShowSection(secstudentnum, secstudentid, secstudentsec, secingroup));
                //txt_Viva_GroupName.Text = secstudentnum;
            }
        }
Example #3
0
        private void btn_EditGroup_Go_Click(object sender, EventArgs e)
        {
            flp_editgroup.Controls.Clear();
            string semester = cmb_EditGroup_SemesterChooser.Text.ToString();
            string grpno    = txt_EditGroup_GroupNo.Text.ToString();

            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_groups
                        where p.grp_semester.Contains(semester)
                        where p.grp_groupNumber.Contains(grpno)
                        select p;

            var prod = from q in db.tb_groupMembers
                       where q.grpm_semester.Contains(semester)
                       where q.grpm_groupNumber.Contains(grpno)
                       select q;



            foreach (var a in prods)
            {
                string grpname      = a.grp_groupName;
                string projecttitle = a.grp_projectTitle;
                string noofmem      = a.grp_NumberOfMember.ToString();


                //this.flp_addStudent.Controls.Add(new UcAddStudent(sname, sid, sSec, sSelect));
                txt_EditGroup_GroupName.Text      = grpname;
                txt_EditGroup_ProjectTitle.Text   = projecttitle;
                txt_EditGroup_NumberOfMember.Text = noofmem;
            }

            foreach (var b in prod)
            {
                string stuname = b.grpm_stdName;
                string stuid   = b.grpm_stdId;
                string stusec  = b.grpm_section;
                string stupart = b.grpm_stdPart;



                ArrayEditGroup1[0] = stuname;
                ArrayEditGroup1[1] = stuid;
                ArrayEditGroup1[2] = stusec;
                ArrayEditGroup1[3] = stupart;
                DataClass.EDitGroupTemporaryList.Add(ArrayEditGroup1);
                DataClass.EditGroupAddStudentList.Add(ArrayEditGroup1);



                this.flp_editgroup.Controls.Add(new UcEditGroup(stuname, stuid, stusec, stupart));
            }
        }
Example #4
0
        private void btn_ViewGroup_Go_Click(object sender, EventArgs e)
        {
            flw_ViewGroup.Controls.Clear();
            flw_ViewGroup.AutoScroll = false;
            flw_ViewGroup.HorizontalScroll.Enabled = false;
            flw_ViewGroup.HorizontalScroll.Visible = false;
            flw_ViewGroup.HorizontalScroll.Maximum = 0;
            flw_ViewGroup.AutoScroll = true;

            txt_ViewGroup_GroupName.Text = "";
            //txt_ViewGroup_GroupNumber.Text = "";
            txt_ViewGroup_NumberOfMember.Text = "";
            txt_ViewGroup_ProjectTitle.Text   = "";
            string   semester        = cmb_ViewGroup_Semester.Text.ToString();
            string   grpnum          = txt_ViewGroup_GroupNumber.Text.ToString();
            tb_group tbg             = new tb_group();
            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_groups
                        where p.grp_semester.Contains(semester)
                        where p.grp_groupNumber.Contains(grpnum)
                        where p.grp_userName.Contains(temporaryUser)
                        where p.grp_subject.Contains(temporaryCourse)
                        select p;

            foreach (var a in prods)
            {
                txt_ViewGroup_GroupName.Text      = a.grp_groupName;
                txt_ViewGroup_ProjectTitle.Text   = a.grp_projectTitle;
                txt_ViewGroup_NumberOfMember.Text = a.grp_NumberOfMember.ToString();
            }

            db_accountDataContext db1 = new db_accountDataContext();
            var prods1 = from p in db1.tb_groupMembers
                         where p.grpm_semester.Contains(semester)
                         where p.grpm_groupNumber.Contains(grpnum)
                         where p.grpm_username.Contains(temporaryUser)
                         where p.grpm_subject.Contains(temporaryCourse)
                         select p;

            foreach (var a in prods1)
            {
                string name = a.grpm_stdName;
                string id   = a.grpm_stdId;

                string section = a.grpm_section;
                string part    = a.grpm_stdPart;
                string mark    = a.grpm_stdMark.ToString();


                this.flw_ViewGroup.Controls.Add(new UserControl_ViewGroup(name, id, section, part, mark));
            }
        }
Example #5
0
        private void btn_Editroup_Save_Click(object sender, EventArgs e)
        {
            string GroupName    = txt_EditGroup_GroupName.Text.ToString();
            string GroupNumber  = txt_EditGroup_GroupNo.Text.ToString();
            int    NoOfMember   = int.Parse(txt_EditGroup_NumberOfMember.Text);
            string ProjectTitle = txt_EditGroup_ProjectTitle.Text.ToString();
            string semester     = cmb_EditGroup_SemesterChooser.Text.ToString();
            string subject      = temporaryCourse;
            string username     = temporaryUser;

            db_accountDataContext db1 = new db_accountDataContext();
            tb_group acc1             = db1.tb_groups.SingleOrDefault(x => x.grp_groupNumber == GroupNumber);

            acc1.grp_groupName      = GroupName;
            acc1.grp_projectTitle   = ProjectTitle;
            acc1.grp_NumberOfMember = NoOfMember;
            acc1.grp_semester       = semester;
            acc1.grp_subject        = subject;
            acc1.grp_userName       = username;
            // db1.tb_groups.InsertOnSubmit(acc1);
            db1.SubmitChanges();


            foreach (string[] V1 in DataClass.EDitGroupTemporaryList)
            {
                string ax = V1[0];
                string bx = V1[1];
                string cx = V1[2];
                string dx = V1[3];
                // MessageBox.Show(V1[1]);


                db_accountDataContext db  = new db_accountDataContext();
                tb_groupMember        acc = db.tb_groupMembers.SingleOrDefault(x => x.grpm_stdId == bx);

                acc.grpm_stdName     = ax;
                acc.grpm_section     = cx;
                acc.grpm_stdPart     = dx;
                acc.grpm_stdMark     = 0;
                acc.grpm_groupNumber = GroupNumber;
                acc.grpm_subject     = subject;
                acc.grpm_semester    = semester;
                acc.grpm_username    = username;
                //db.tb_groupMembers.InsertOnSubmit(acc);
                db.SubmitChanges();

                MessageBox.Show("Success");
            }
        }
Example #6
0
        private void btn_Viva_Go_Click(object sender, EventArgs e)
        {
            string semester  = cmb_Viva_Semester.Text.ToString();
            string grpNumber = txt_Viva_GroupNumber.Text.ToString();
            // MessageBox.Show(semester);
            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_groups

                        where p.grp_semester.Contains(semester)
                        where p.grp_groupNumber.Contains(grpNumber)
                        select p;



            var pord = from q in db.tb_groupMembers

                       where q.grpm_semester.Contains(semester)
                       where q.grpm_groupNumber.Contains(grpNumber)
                       select q;


            foreach (var a in prods)
            {
                string groupname    = a.grp_groupName;
                string projecttitle = a.grp_projectTitle;


                // this.flp_show_sec.Controls.Add(new Uc_ShowSection(secstudentnum, secstudentid, secstudentsec, secingroup));
                txt_Viva_GroupName.Text    = groupname;
                txt_Viva_ProjectTitle.Text = projecttitle;
            }

            foreach (var b in pord)
            {
                string stuname = b.grpm_stdName;
                string stuid   = b.grpm_stdId;


                this.flw_Viva.Controls.Add(new UserControl_Viva(stuname, stuid));
                // txt_viva_name1.Text = stuname;
                // txt_viva_id1.Text = stuid;
            }
        }
Example #7
0
        private void btn_AddStudent_Go_Click(object sender, EventArgs e)
        {
            flp_addStudent.Controls.Clear();
            string semester = cmb_AddStudent_SemesterChooser.Text.ToString();
            string section  = cmb_AddStudent_SectionChooser.Text.ToString();

            db_accountDataContext db = new db_accountDataContext();
            var prods = from p in db.tb_sections
                        where p.sec_semester.Contains(semester)
                        where p.sec_st_section.Contains(section)
                        select p;

            foreach (var a in prods)
            {
                string sname   = a.sec_st_name;
                string sid     = a.sec_st_id;
                string sSec    = a.sec_st_section;
                string sSelect = a.sec_inGroup;

                this.flp_addStudent.Controls.Add(new UcAddStudent(sname, sid, sSec, sSelect));
            }
        }
Example #8
0
        private void btn_SaveGroup_Click(object sender, EventArgs e)
        {
            if ((txt_CreateGroup_NumberOfMember.Text != "") && (txt_CreateGroup_GroupName.Text != "") && (txt_CreateGroup_GroupNumber.Text != "") && (txt_CreateGroup_ProjectTitle.Text != "") && (cmb_CreateGroup_SemesterChooser.Text != "          Semester"))
            {
                string GroupName    = txt_CreateGroup_GroupName.Text.ToString();
                string GroupNumber  = txt_CreateGroup_GroupNumber.Text.ToString();
                int    NoOfMember   = int.Parse(txt_CreateGroup_NumberOfMember.Text);
                string ProjectTitle = txt_CreateGroup_ProjectTitle.Text.ToString();
                string semester     = cmb_CreateGroup_SemesterChooser.Text.ToString();
                string subject      = temporaryCourse;
                string username     = temporaryUser;



                if ((NoOfMember >= 1) && (NoOfMember <= 4))
                {
                    using (SqlConnection connection = new SqlConnection(@"Data Source=DESKTOP-UH9DSCF\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True"))
                    {
                        SqlCommand command = new SqlCommand();
                        command.Connection = connection;

                        command.CommandType = System.Data.CommandType.Text;
                        command.CommandText = @"INSERT INTO [tb_group] ([grp_groupNumber], [grp_groupName],[grp_projecttitle],[grp_NumberOfMember],[grp_semester],[grp_subject],[grp_userName]) VALUES ( @number, @name,@title,@member,@sem,@sub,@user)";
                        command.Parameters.Add("@number", SqlDbType.VarChar, 150).Value = GroupNumber;
                        command.Parameters.Add("@name", SqlDbType.VarChar, 150).Value   = GroupName;
                        command.Parameters.Add("@title", SqlDbType.VarChar, 150).Value  = ProjectTitle;
                        command.Parameters.Add("@member", SqlDbType.Int).Value          = NoOfMember;
                        command.Parameters.Add("@sem", SqlDbType.VarChar, 150).Value    = semester;
                        command.Parameters.Add("@sub", SqlDbType.VarChar, 150).Value    = subject;
                        command.Parameters.Add("@user", SqlDbType.VarChar, 150).Value   = username;

                        connection.Open();

                        command.ExecuteNonQuery();
                    }



                    /*  db_accountDataContext db1 = new db_accountDataContext();
                     * tb_group acc1 = new tb_group();
                     * acc1.grp_groupNumber = GroupNumber;
                     * acc1.grp_groupName = GroupName;
                     * acc1.grp_projectTitle = ProjectTitle;
                     * acc1.grp_NumberOfMember = NoOfMember;
                     * acc1.grp_semester = semester;
                     * acc1.grp_subject = subject;
                     * acc1.grp_userName = username;
                     * db1.tb_groups.InsertOnSubmit(acc1);
                     * db1.SubmitChanges();*/


                    int mark = 0;



                    foreach (string[] V1 in DataClass.CreateGroupTemporary)
                    {
                        string ax = V1[0];
                        string bx = V1[1];
                        string cx = V1[2];
                        string dx = V1[3];



                        // MessageBox.Show(V1[1]);



                        using (SqlConnection connection = new SqlConnection(@"Data Source=DESKTOP-UH9DSCF\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True"))
                        {
                            SqlCommand command = new SqlCommand();
                            command.Connection = connection;

                            command.CommandType = System.Data.CommandType.Text;
                            command.CommandText = @"INSERT INTO [tb_groupMember] ([grpm_stdName], [grpm_stdId],[grpm_section],[grpm_stdPart],[grpm_stdMark],[grpm_groupNumber],[grpm_subject],[grpm_semester]) VALUES (@a,@b,@c,@d,@e,@f,@g,@h)";
                            command.Parameters.Add("@a", SqlDbType.VarChar, 150).Value = ax;
                            command.Parameters.Add("@b", SqlDbType.VarChar, 150).Value = bx;
                            command.Parameters.Add("@c", SqlDbType.VarChar, 150).Value = cx;
                            command.Parameters.Add("@d", SqlDbType.VarChar, 150).Value = dx;

                            command.Parameters.Add("@e", SqlDbType.Int).Value          = mark;
                            command.Parameters.Add("@f", SqlDbType.VarChar, 150).Value = GroupNumber;
                            command.Parameters.Add("@g", SqlDbType.VarChar, 150).Value = subject;
                            command.Parameters.Add("@h", SqlDbType.VarChar, 150).Value = semester;


                            connection.Open();

                            command.ExecuteNonQuery();
                        }



                        db_accountDataContext db  = new db_accountDataContext();
                        tb_groupMember        acc = new tb_groupMember();
                        acc.grpm_stdName     = ax;
                        acc.grpm_stdId       = bx;
                        acc.grpm_section     = cx;
                        acc.grpm_stdPart     = dx;
                        acc.grpm_stdMark     = 0;
                        acc.grpm_groupNumber = GroupNumber;
                        acc.grpm_subject     = subject;
                        acc.grpm_semester    = semester;
                        acc.grpm_username    = username;
                        db.tb_groupMembers.InsertOnSubmit(acc);
                        db.SubmitChanges();
                    }
                    MessageBox.Show("Group Created Successfully");
                    DataClass.CreateGroupAddStudent.Clear();
                    DataClass.CreateGroupTemporary.Clear();
                    fl_CreateGroup.Controls.Clear();
                    txt_CreateGroup_NumberOfMember.Text = "";
                    txt_CreateGroup_GroupName.Text      = "";
                    txt_CreateGroup_GroupNumber.Text    = "";
                    txt_CreateGroup_ProjectTitle.Text   = "";
                }
                else
                {
                    MessageBox.Show("Invalid Group Number. Group Member should be maximum 4");
                }
            }


            else
            {
                MessageBox.Show("Please Fill all the required Fields");
            }
        }