Ejemplo n.º 1
0
        private void comboBoxSelectCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];
            //labelUserName.Text = nameCourse+"  "+ nameSection;

            CourseRegistrationRepository crr   = new CourseRegistrationRepository();
            List <CourseRegistration>    cList = new List <CourseRegistration>();

            cList = crr.GetAllStudents(comboBoxSelectSemester.Text, nameCourse, nameSection);
            //List<CourseRegistration>mList=new List<CourseRegistration>();
            //for (int i = 0; i < cList.Count; i++)
            //{
            //    mList.Add(cList[i]);
            //}

            DataTable table = new DataTable();

            table.Columns.Add("Student Id", typeof(string));
            table.Columns.Add("Student Name", typeof(string));

            List <string> cTempList = new List <string>(cList.Count);

            for (int i = 0; i < cList.Count; i++)
            {
                cTempList.Add(cList[i].AccountId);
            }
            //Account ac = new Account();
            for (int i = 0; i < cList.Count; i++)
            {
                cTempList.Remove(cList[i].AccountId);
                if (!cTempList.Contains(cList[i].AccountId))
                {
                    AccountRepository ar = new AccountRepository();
                    Account           ac = ar.GetAccount(cList[i].AccountId);
                    //ac = new ar.GetAccount(cList[i].AccountId);
                    table.Rows.Add(cList[i].AccountId, ac.Name);
                }
            }

            //for (int i = 0; i < cList.Count; i++)
            //{
            //    mList.Remove(cList[i]);
            //    if (!mList.Contains(cList[i]))
            //    {
            //        //AccountRepository ar = new AccountRepository();
            //        ////Account ac = new Account();
            //        //Account ac = new ar.GetAccount(cList[i].AccountId);
            //        table.Rows.Add(cList[i].AccountId, cList[i].);
            //    }
            //}

            dataGridView1.DataSource = table;
            dataGridView1.ReadOnly   = true;
            dataGridView1.Visible    = true;
        }
Ejemplo n.º 2
0
        private void comboBoxSelectCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBoxSelectStudent.Items.Clear();
            comboBoxSelectStudent.Text = "";


            buttonUploadQuizMark.Visible        = false;
            buttonUploadTermMark.Visible        = false;
            numericUpDownUploadQuizMark.Visible = false;
            numericUpDownUploadTermMark.Visible = false;
            buttonUploadQuiz.Visible            = false;
            buttonUploadTerm.Visible            = false;

            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];
            //labelUserName.Text = nameCourse+"  "+ nameSection;

            CourseRegistrationRepository crr   = new CourseRegistrationRepository();
            List <CourseRegistration>    cList = new List <CourseRegistration>();

            cList = crr.GetAllStudents(comboBoxSelectSemester.Text, nameCourse, nameSection);
            List <string> cTempList = new List <string>(cList.Count);

            for (int i = 0; i < cList.Count; i++)
            {
                cTempList.Add(cList[i].AccountId);
            }
            for (int i = 0; i < cList.Count; i++)
            {
                cTempList.Remove(cList[i].AccountId);
                if (!cTempList.Contains(cList[i].AccountId))
                {
                    AccountRepository ar = new AccountRepository();
                    Account           ac = ar.GetAccount(cList[i].AccountId);
                    comboBoxSelectStudent.Items.Add(ac.AccountId + "  " + ac.Name);
                }
            }
        }