Ejemplo n.º 1
0
        public void initComboBox()
        {
            try
            {
                ManagementBLL mBLL = new ManagementBLL();
                /*----- ComboBox Class ------*/
                cbClass.Items.Clear();
                List <string> list = mBLL.getClassID();
                foreach (string item in list)
                {
                    cbClass.Items.Add(item);
                }
                cbClass.SelectedIndex = 0;

                /*----- ComboBox Course ------*/
                cbCourse.Items.Clear();
                List <string> list1 = mBLL.getCourseID();
                foreach (string item in list1)
                {
                    cbCourse.Items.Add(item);
                }
                cbCourse.SelectedIndex = 0;

                /*----- ComboBox Semester ------*/
                cbSemester.Items.Clear();
                List <string> list2 = mBLL.getSemester();
                foreach (string item in list2)
                {
                    cbSemester.Items.Add(item);
                }
                cbSemester.SelectedIndex = 0;
                cbViews.SelectedIndex    = 0;
            }
            catch { MessageBox.Show("No Data"); }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            mBLL = new ManagementBLL();
            processLogin();
            pnContent.Controls.Clear();
            ImportData layout = new ImportData();

            pnContent.Controls.Add(layout);
            layout.Dock = DockStyle.Fill;
        }
Ejemplo n.º 3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            ManagementBLL mBLL = new ManagementBLL();

            grade.DiemGK   = float.Parse(tbDiemGK.Text);
            grade.DiemCK   = float.Parse(tbDiemCK.Text);
            grade.DiemKhac = float.Parse(tbDiemKhac.Text);
            grade.DiemTong = float.Parse(tbDiemTong.Text);
            mBLL.updateGrade(grade);
        }
Ejemplo n.º 4
0
        void importDataStudent(string path)
        {
            List <Student>   studentList = new List <Student>();
            List <LoginData> loginList   = new List <LoginData>();
            string           classID     = "";
            var reader = new StreamReader(@path);
            int rows   = 0;

            try
            {
                while (!reader.EndOfStream)
                {
                    Student   student = new Student();
                    LoginData login   = new LoginData();
                    var       line    = reader.ReadLine();
                    var       value   = line.Split(',');
                    if (rows == 0)
                    {
                        classID = value[0];
                    }
                    else if (rows > 1)
                    {
                        student.MSSV     = value[1];
                        student.Name     = value[2];
                        student.Birthday = DateTime.Parse(value[3]);
                        student.Gender   = value[4];
                        student.CMND     = value[5];
                        student.ClassID  = classID;

                        login.UsernameL = student.MSSV;
                        login.TypeL     = "1";
                        string str  = value[3];
                        var    temp = str.Split('/');
                        //login.Password =
                        foreach (string s in temp)
                        {
                            login.PasswordL += s;
                        }
                        loginList.Add(login);

                        studentList.Add(student);
                    }
                    rows++;
                }
                ManagementBLL mBLL = new ManagementBLL();

                mBLL.insertClass(studentList[0].ClassID);
                mBLL.insertStudent(studentList);
                mBLL.insertLogin(loginList);
            }
            catch { }
        }
Ejemplo n.º 5
0
        void insertDataGV()
        {
            gvSchedule.Rows.Clear();
            ManagementBLL mBLL       = new ManagementBLL();
            List <Course> courseList = mBLL.GetSchedule(cbClass.SelectedItem.ToString(), cbSemester.SelectedItem.ToString());

            foreach (Course course in courseList)
            {
                int n = gvSchedule.Rows.Add();
                gvSchedule.Rows[n].Cells[0].Value = course.ID;
                gvSchedule.Rows[n].Cells[1].Value = course.Name;
                gvSchedule.Rows[n].Cells[2].Value = course.RoomID;
            }
        }
        string processLogin()
        {
            ManagementBLL    mBLL      = new ManagementBLL();
            List <LoginData> loginList = mBLL.getLogin();

            foreach (LoginData login in loginList)
            {
                if (login.UsernameL == tbUsername.Text && login.PasswordL == tbPassword.Text)
                {
                    return(login.TypeL);
                }
                ;
            }
            return("-1");
        }
Ejemplo n.º 7
0
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            if (tbConfirm.Text != tbNewPass.Text)
            {
                MessageBox.Show("Nhập lại mật khẩu sai!");
                new ChangePassword(username);
            }
            ManagementBLL mBLL    = new ManagementBLL();
            string        oldPass = tbOldPass.Text;
            string        newPass = tbNewPass.Text;

            if (!mBLL.updatePass(username, newPass, oldPass))
            {
                new ChangePassword(username);
            }
        }
Ejemplo n.º 8
0
        void insertDataGrade()
        {
            gvGrade.Rows.Clear();
            ManagementBLL mBLL = new ManagementBLL();

            List <Entity.Grade> list = mBLL.getGradeStudent(MSSV, cbYear.SelectedItem.ToString(), cbSemester.SelectedItem.ToString());

            foreach (Entity.Grade item in list)
            {
                int n = gvGrade.Rows.Add();
                gvGrade.Rows[n].Cells[0].Value = item.CourseID;
                gvGrade.Rows[n].Cells[1].Value = item.DiemGK;
                gvGrade.Rows[n].Cells[2].Value = item.DiemCK;
                gvGrade.Rows[n].Cells[3].Value = item.DiemKhac;
                gvGrade.Rows[n].Cells[4].Value = item.DiemTong;
            }
        }
Ejemplo n.º 9
0
        void insertDataGrade()
        {
            gvGrade.Rows.Clear();
            ManagementBLL       mBLL      = new ManagementBLL();
            List <Entity.Grade> gradeList = mBLL.getGradeList(cbClass.SelectedItem.ToString(), cbSemester.SelectedItem.ToString(), cbCourse.SelectedItem.ToString());

            foreach (Entity.Grade grade in gradeList)
            {
                int n = gvGrade.Rows.Add();
                gvGrade.Rows[n].Cells[0].Value = grade.MSSV;
                gvGrade.Rows[n].Cells[1].Value = grade.Name;
                gvGrade.Rows[n].Cells[2].Value = grade.DiemGK;
                gvGrade.Rows[n].Cells[3].Value = grade.DiemCK;
                gvGrade.Rows[n].Cells[4].Value = grade.DiemKhac;
                gvGrade.Rows[n].Cells[5].Value = grade.DiemTong;
            }
        }
Ejemplo n.º 10
0
        public void initComboBox()
        {
            try
            {
                ManagementBLL mBLL = new ManagementBLL();
                /*----- ComboBox Semester ------*/
                cbSemester.Items.Clear();
                List <string> list2 = mBLL.getSemester();
                foreach (string item in list2)
                {
                    cbSemester.Items.Add(item);
                }
                cbSemester.SelectedIndex = 0;

                cbYear.SelectedIndex = 2;
            }
            catch { MessageBox.Show("No Data"); }
        }
Ejemplo n.º 11
0
        public void initComboBox()
        {
            ManagementBLL mBLL = new ManagementBLL();

            /*----- ComboBox Class ------*/
            cbClass.Items.Clear();
            List <string> list = mBLL.getClassID();

            foreach (string item in list)
            {
                cbClass.Items.Add(item);
            }
            try
            {
                cbClass.SelectedIndex = 0;
            }
            catch { MessageBox.Show("No Data"); }
        }
Ejemplo n.º 12
0
        void importDataGrade()
        {
            List <Entity.Grade> gradeList = new List <Entity.Grade>();

            string path     = tbPath.Text.ToString();
            string namefile = path.Substring(path.LastIndexOf("\\") + 1);
            var    str      = namefile.Split('-');

            var reader = new StreamReader(@path);
            int rows   = 0;

            try
            {
                while (!reader.EndOfStream)
                {
                    Entity.Grade grade = new Entity.Grade();
                    var          line  = reader.ReadLine();
                    var          value = line.Split(',');
                    if (rows > 1)
                    {
                        grade.MSSV     = value[1];
                        grade.CourseID = str[1];
                        grade.DiemGK   = float.Parse(value[3]);
                        grade.DiemCK   = float.Parse(value[4]);
                        grade.DiemKhac = float.Parse(value[5]);
                        grade.DiemTong = float.Parse(value[6]);
                        grade.Semester = str[0];
                        grade.ClassID  = str[2];

                        gradeList.Add(grade);
                    }
                    rows++;
                }
                ManagementBLL mBLL = new ManagementBLL();
                mBLL.insertGrade(gradeList);
            }
            catch
            {
            }
        }
Ejemplo n.º 13
0
        void importDataSchedule()
        {
            List <Course> courseList = new List <Course>();

            string path     = tbPath.Text.ToString();
            string namefile = path.Substring(path.LastIndexOf("\\") + 1);
            var    str      = namefile.Split('-');

            var reader = new StreamReader(@path);
            int rows   = 0;

            try
            {
                while (!reader.EndOfStream)
                {
                    Course course = new Course();
                    var    line   = reader.ReadLine();
                    var    value  = line.Split(',');
                    if (rows > 1)
                    {
                        course.ID       = value[1];
                        course.Name     = value[2];
                        course.RoomID   = value[3];
                        course.Year     = str[1];
                        course.ClassID  = str[2];
                        course.Semester = str[0];

                        courseList.Add(course);
                    }
                    rows++;
                }

                ManagementBLL mBLL = new ManagementBLL();
                mBLL.insertClass(courseList[0].ClassID);
                mBLL.insertSchedule(courseList);
            }
            catch { }
        }
Ejemplo n.º 14
0
        void insertDataGrade()
        {
            gvGrade.Rows.Clear();
            ManagementBLL       mBLL      = new ManagementBLL();
            List <Entity.Grade> gradeList = mBLL.getGradeList(cbClass.SelectedItem.ToString(), cbSemester.SelectedItem.ToString(), cbCourse.SelectedItem.ToString());

            foreach (Entity.Grade grade in gradeList)
            {
                int n;
                switch (cbViews.Text)
                {
                case "Pass":
                {
                    if (grade.DiemTong >= 5)
                    {
                        n = gvGrade.Rows.Add();
                        gvGrade.Rows[n].Cells[0].Value = grade.MSSV;
                        gvGrade.Rows[n].Cells[1].Value = grade.Name;
                        gvGrade.Rows[n].Cells[2].Value = grade.DiemGK;
                        gvGrade.Rows[n].Cells[3].Value = grade.DiemCK;
                        gvGrade.Rows[n].Cells[4].Value = grade.DiemKhac;
                        gvGrade.Rows[n].Cells[5].Value = grade.DiemTong;
                    }
                    break;
                }

                case "Fail":
                {
                    if (grade.DiemTong < 5)
                    {
                        n = gvGrade.Rows.Add();
                        gvGrade.Rows[n].Cells[0].Value = grade.MSSV;
                        gvGrade.Rows[n].Cells[1].Value = grade.Name;
                        gvGrade.Rows[n].Cells[2].Value = grade.DiemGK;
                        gvGrade.Rows[n].Cells[3].Value = grade.DiemCK;
                        gvGrade.Rows[n].Cells[4].Value = grade.DiemKhac;
                        gvGrade.Rows[n].Cells[5].Value = grade.DiemTong;
                    }
                    break;
                }

                default:
                    n = gvGrade.Rows.Add();
                    gvGrade.Rows[n].Cells[0].Value = grade.MSSV;
                    gvGrade.Rows[n].Cells[1].Value = grade.Name;
                    gvGrade.Rows[n].Cells[2].Value = grade.DiemGK;
                    gvGrade.Rows[n].Cells[3].Value = grade.DiemCK;
                    gvGrade.Rows[n].Cells[4].Value = grade.DiemKhac;
                    gvGrade.Rows[n].Cells[5].Value = grade.DiemTong;
                    break;
                }
            }
            int pass = 0;
            int fail = 0;

            foreach (Entity.Grade grade in gradeList)
            {
                if (grade.DiemTong >= 5)
                {
                    pass++;
                }
                else if (grade.DiemTong < 5)
                {
                    fail++;
                }
            }
            double lenght = gradeList.Count;
            double Pass   = pass / lenght * 100;
            double Fail   = fail / lenght * 100;

            lbDau.Text = $"Pass:{pass}/{Pass} %";
            lbRot.Text = $"Fail: {fail}/{Fail} %";
        }
Ejemplo n.º 15
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            ManagementBLL mBLL = new ManagementBLL();

            mBLL.insertStudent(insertStudent());
        }