Beispiel #1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string username = txtTenDN.Text;
            string password = txtMatKhau.Text;

            if (rdbAd.Checked)
            {
                QLSVDataContext qlSV    = new QLSVDataContext();
                var             tpQuery = (from tp in qlSV.Logins
                                           where tp.userName == txtTenDN.Text && tp.passWord == txtMatKhau.Text && tp.Quyen == rdbAd.Text
                                           select tp);
                if (tpQuery.Count() > 0)
                {
                    string user = txtTenDN.Text;
                    string pass = txtMatKhau.Text;
                    MessageBox.Show("Đăng nhập thành công");
                    frmAdmin ad = new frmAdmin(user, pass, "Admin");
                    this.Hide();
                    ad.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu");
                    txtTenDN.Select();
                }
            }

            if (rdbMb.Checked)
            {
                QLSVDataContext qlSV    = new QLSVDataContext();
                var             vpQuery = (from vp in qlSV.Logins
                                           where vp.userName == txtTenDN.Text.Trim() && vp.passWord == txtMatKhau.Text && vp.Quyen == rdbMb.Text
                                           select vp);
                if (vpQuery.Count() > 0)
                {
                    string user = txtTenDN.Text;
                    string pass = txtMatKhau.Text;
                    MessageBox.Show("Đăng nhập thành công");
                    frmAdmin ad = new frmAdmin(user, pass, "Member");
                    this.Hide();
                    ad.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu");
                    txtTenDN.Select();
                }
            }
        }
Beispiel #2
0
        void LoadDiem(string MaSV)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.KetQuas
                                       from up in qlSV.Mons
                                       where tp.maSV == MaSV &&
                                       up.maMon == tp.maMon
                                       select new
            {
                tp.maMon,
                up.soTinChi,
                up.tenMon,
                tp.diemGiuaKi,
                tp.diemCuoiKi,
                tp.diemTB,
                up.hocKi,
                tp.ketQua,
            }
                                       ).ToList();

            dgvDiem.DataSource = tpQuery;
        }
Beispiel #3
0
        private void dgvSV_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int r = dgvSV.CurrentCell.RowIndex;

            this.txtMaSV.Text         = dgvSV.Rows[r].Cells["maSV"].Value.ToString();
            this.txttenSV.Text        = dgvSV.Rows[r].Cells["hoTen"].Value.ToString();
            this.dateTimePicker1.Text = dgvSV.Rows[r].Cells["ngaySinh"].Value.ToString();
            this.txtGT.Text           = dgvSV.Rows[r].Cells["gioiTinh"].Value.ToString();
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.Mons
                                       from up in qlSV.KetQuas
                                       where tp.maMon == up.maMon && up.maSV == txtMaSV.Text
                                       orderby up.maSV, tp.hocKi
                                       select tp).ToList();

            chartTC.DataSource = tpQuery;

            chartTC.ChartAreas["ChartArea1"].AxisX.Title = "Học Kì";
            chartTC.ChartAreas["ChartArea1"].AxisY.Title = "Số tín chỉ";
            chartTC.Series["Đăng kí"].XValueMember       = "hocKi";
            chartTC.Series["Đăng kí"].YValueMembers      = "stcHoc";
            chartTC.Series["Tích lũy"].XValueMember      = "hocKi";
            chartTC.Series["Tích lũy"].YValueMembers     = "stcdau";
        }