Exemplo n.º 1
0
        private void btnThem_Click_1(object sender, EventArgs e)
        {
            LTUDQL1DataContext themnd = new LTUDQL1DataContext();
            USER us = new USER();

            us.f_HoTen       = txtHoTen.Text;
            us.f_MaSo        = txtMaSo.Text;
            us.f_Email       = txtEmail.Text;
            us.f_GioiTinh    = txtGioiTinh.Text;
            us.f_NgaySinh    = txtNgaySinh.Text;
            us.f_Phone       = txtPhone.Text;
            us.f_TenDangNhap = txtTenDangNhap.Text;
            us.f_MatKhau     = txtMatKhau.Text;
            us.f_IDPhanQuyen = int.Parse(txtIDPhanQuyen.Text.ToString());
            if (us.f_HoTen == "" && us.f_TenDangNhap == "" && us.f_MaSo == "" && us.f_Email == "" && us.f_NgaySinh == "" && us.f_MatKhau == "")
            {
                MessageBox.Show("Không được bỏ trống !!!");
                return;
            }
            else
            {
                themnd.USERs.InsertOnSubmit(us);
                themnd.SubmitChanges();
                MessageBox.Show("Tạo thành công người Dùng!!!");
                LoadData();
            }
            CleanTextBox();
        }
Exemplo n.º 2
0
        private void Btndangnhap_Click(object sender, EventArgs e)
        {
            var tendangnhap = txtUsername.Text;
            var matkhau     = txtPassword.Text;

            using (var db = new LTUDQL1DataContext())
            {
                if (db.USERs.SingleOrDefault(u => u.f_TenDangNhap == tendangnhap && u.f_MatKhau == matkhau && u.f_IDPhanQuyen == 0) != null)
                {
                    MessageBox.Show("LOGIN ADMIN");
                    ViewAdmin f = new ViewAdmin();
                    this.Hide();
                    f.ShowDialog();
                }
                else if (db.USERs.SingleOrDefault(u => u.f_TenDangNhap == tendangnhap && u.f_MatKhau == matkhau && u.f_IDPhanQuyen == 2) != null)
                {
                    MessageBox.Show("LOGIN GIÁO VIÊN");
                    Form1 f = new Form1();
                    this.Hide();
                    f.ShowDialog();
                }
                else if (db.USERs.SingleOrDefault(u => u.f_TenDangNhap == tendangnhap && u.f_MatKhau == matkhau && u.f_IDPhanQuyen == 1) != null)
                {
                    MessageBox.Show("LOGIN HỌC SINH");
                    Form2 f = new Form2();
                    this.Hide();
                    f.ShowDialog();
                }
            }
        }
Exemplo n.º 3
0
        private void btn_TaoKyThi_Click(object sender, EventArgs e)
        {
            LTUDQL1DataContext themkt = new LTUDQL1DataContext();
            KyThi kt = new KyThi();

            kt.MaKT     = txtmakt.Text;
            kt.Ngay     = txtmant.Text;
            kt.MaDT     = txtmadt.Text;
            kt.ThoiGian = txttg.Text;
            kt.MaHV     = txtmahv.Text;

            if (kt.MaKT == "" && kt.MaHV == "")
            {
                MessageBox.Show("Không được bỏ trống Mã Kỳ Thi và Mã Học Viên!!!");
                return;
            }
            else
            {
                themkt.KyThis.InsertOnSubmit(kt);
                themkt.SubmitChanges();
                MessageBox.Show("Tạo thành công kỳ thi thử!!!");
                LoadData();
            }

            CleanTextBox();
        }
Exemplo n.º 4
0
 private void LoadData()
 {
     using (var db = new LTUDQL1DataContext())
     {
         dgv_NguoiDung.DataSource = db.USERs.Select(u => u);
     }
 }
Exemplo n.º 5
0
 private void LoadData()
 {
     using (var db = new LTUDQL1DataContext())
     {
         dataGridViewImport.DataSource = db.USERs.Select(u => u);
     }
 }
Exemplo n.º 6
0
 private void LoadData()
 {
     using (var db = new LTUDQL1DataContext())
     {
         dgv_HocVien.DataSource = db.KetQuas.Select(u => u);
     }
 }
 private void LoadData()
 {
     using (var db = new LTUDQL1DataContext())
     {
         dgv_CauHoi.DataSource = db.CauHois.Select(u => u);
     }
 }
Exemplo n.º 8
0
        private void BtnDangKy_Click(object sender, EventArgs e)
        {
            var hoten       = txtHoTen.Text;
            var maso        = txtMaSo.Text;
            var email       = txtEmail.Text;
            var ngaysinh    = datengaysinh.Text;
            var gioitinh    = cbbGioiTinh.Text;
            var phone       = txtPhone.Text;
            var tendangnhap = txttendangnhap.Text;
            var matkhau     = txtmatkhau.Text;
            var phanquyen   = int.Parse(cbbPhanQuyen.Text.ToString());

            using (var db = new LTUDQL1DataContext())
            {
                if (db.USERs.SingleOrDefault(u => u.f_TenDangNhap == tendangnhap) != null)
                {
                    MessageBox.Show("User đã tồn tại!");
                    return;
                }
                db.USERs.InsertOnSubmit(new USER
                {
                    f_HoTen       = hoten,
                    f_MaSo        = maso,
                    f_Email       = email,
                    f_GioiTinh    = gioitinh,
                    f_MatKhau     = matkhau,
                    f_NgaySinh    = ngaysinh,
                    f_Phone       = phone,
                    f_TenDangNhap = tendangnhap,
                    f_IDPhanQuyen = phanquyen
                });
                db.SubmitChanges();
            }



            if (txtmatkhau.Text == txtxacnhanmatkhau.Text)
            {
                MessageBox.Show("Đăng ký thành công!");
            }
            else if (txtxacnhanmatkhau.Text != txtmatkhau.Text)
            {
                MessageBox.Show("Mật khẩu xác nhận không trùng!");
                txtxacnhanmatkhau.Focus();
                txtxacnhanmatkhau.SelectAll();
            }
        }
Exemplo n.º 9
0
        private void btn_sua_Click(object sender, EventArgs e)
        {
            LTUDQL1DataContext Suadt = new LTUDQL1DataContext();
            DeThi dt = new DeThi();

            dt = Suadt.DeThis.Where(u => u.MaDK == txtMaDK.Text).Where(u => u.MaDT == txtMaDT.Text).Single();

            dt.MaDT = txtMaDT.Text;
            dt.MaBD = txtMaBD.Text;
            dt.MaCH = txtMaCH.Text;
            dt.MaDK = txtMaDK.Text;

            Suadt.SubmitChanges();
            MessageBox.Show("Update Success!!!");
            LoadData();
            CleanTextBox();
        }
Exemplo n.º 10
0
        private void btn_sua_Click(object sender, EventArgs e)
        {
            LTUDQL1DataContext suakt = new LTUDQL1DataContext();
            KyThi kt = new KyThi();

            kt          = suakt.KyThis.Where(u => u.MaKT == txtmakt.Text).Where(u => u.MaHV == txtmahv.Text).Single();
            kt.MaKT     = txtmakt.Text;
            kt.Ngay     = txtmant.Text;
            kt.MaDT     = txtmadt.Text;
            kt.ThoiGian = txttg.Text;
            kt.MaHV     = txtmahv.Text;

            suakt.SubmitChanges();
            LoadData();
            MessageBox.Show("UpDate thành công!!!");
            CleanTextBox();
        }
Exemplo n.º 11
0
        private void btn_RPCauhoi_Click(object sender, EventArgs e)
        {
            string cauhoi = txtRPCauHoi.Text;

            using (var db = new LTUDQL1DataContext())
            {
                bsCR.DataSource = from kq in db.KetQuas
                                  join kt in db.KyThis on new { kq.MaKT, kq.MaHV }
                equals new { kt.MaKT, kt.MaHV }
                join dt in db.DeThis on kt.MaDT equals dt.MaDT
                join ch in db.CauHois on dt.MaCH equals ch.MaCH
                where ch.MaCH == cauhoi
                     select new KetQuaRP {
                    MaHocVien = kq.MaHV, Diem = kq.Diem, KyThi = kt.MaKT, CauHoi = ch.MaCH
                };
            }
            this.rpv_HocSinh.RefreshReport();
        }
Exemplo n.º 12
0
 private void rpv_HocSinh_Load(object sender, EventArgs e)
 {
     rpv_HocSinh.LocalReport.DataSources.Clear();
     using (var db = new LTUDQL1DataContext())
     {
         bsCR.DataSource = from kq in db.KetQuas
                           join kt in db.KyThis on new { kq.MaKT, kq.MaHV }
         equals new { kt.MaKT, kt.MaHV }
         join dt in db.DeThis on kt.MaDT equals dt.MaDT
         join ch in db.CauHois on dt.MaCH equals ch.MaCH
              select new KetQuaRP {
             MaHocVien = kq.MaHV, Diem = kq.Diem, KyThi = kt.MaKT, CauHoi = ch.MaCH
         };
     }
     rdsCR.Value = bsCR;
     rdsCR.Name  = "DataSetHV";
     rpv_HocSinh.LocalReport.DataSources.Add(rdsCR);
 }
Exemplo n.º 13
0
 private void reportViewer1_Load(object sender, EventArgs e)
 {
     reportViewer1.LocalReport.DataSources.Clear();
     using (var db = new LTUDQL1DataContext())
     {
         bsCR.DataSource = from kq in db.KetQuas
                           join kt in db.KyThis on new { kq.MaKT, kq.MaHV }
         equals new { kt.MaKT, kt.MaHV }
         join sv in db.USERs on kt.MaHV equals sv.f_MaSo
              select new ThiSinhRP {
             MaKyThi    = kt.MaKT, MaHocVien = sv.f_MaSo,
             TenHocVien = sv.f_HoTen, NgaySinh = sv.f_NgaySinh,
             GioiTinh   = sv.f_GioiTinh, Diem = kq.Diem
         };
     }
     rdsCR.Value = bsCR;
     rdsCR.Name  = "RPTheoKy";
     reportViewer1.LocalReport.DataSources.Add(rdsCR);
 }
Exemplo n.º 14
0
        private void btnSua_Click_1(object sender, EventArgs e)
        {
            LTUDQL1DataContext sua = new LTUDQL1DataContext();
            USER us = new USER();

            us               = sua.USERs.Where(u => u.f_MaSo == txtMaSo.Text).Single();
            us.f_HoTen       = txtHoTen.Text;
            us.f_Email       = txtEmail.Text;
            us.f_GioiTinh    = txtGioiTinh.Text;
            us.f_NgaySinh    = txtNgaySinh.Text;
            us.f_Phone       = txtPhone.Text;
            us.f_TenDangNhap = txtTenDangNhap.Text;
            us.f_MatKhau     = txtMatKhau.Text;
            us.f_IDPhanQuyen = int.Parse(txtIDPhanQuyen.Text.ToString());

            sua.SubmitChanges();
            MessageBox.Show("UpDate thành công!!!");
            LoadData();
            CleanTextBox();
        }
Exemplo n.º 15
0
        private void btn_Sua_Click(object sender, System.EventArgs e)
        {
            LTUDQL1DataContext themCauHoi = new LTUDQL1DataContext();
            CauHoi             ch         = new CauHoi();

            ch           = themCauHoi.CauHois.Where(u => u.MaCH == txtMaCH.Text).Single();
            ch.MaCH      = txtMaCH.Text;
            ch.CapHoc    = txtCaphoc.Text;
            ch.MonHoc    = txtMH.Text;
            ch.NoiDung   = txtND.Text;
            ch.DapAnA    = txtDAA.Text;
            ch.DapAnB    = txtDAB.Text;
            ch.DapAnC    = txtDAC.Text;
            ch.DapAnD    = txtDAD.Text;
            ch.DapAnDung = txtDA.Text;

            themCauHoi.SubmitChanges();
            LoadData();
            MessageBox.Show("Update success!!!");
            CleanTextBox();
        }
Exemplo n.º 16
0
        private void btn_them_Click(object sender, EventArgs e)
        {
            LTUDQL1DataContext themdt = new LTUDQL1DataContext();
            DeThi dt = new DeThi();

            dt.MaDT = txtMaDT.Text;
            dt.MaBD = txtMaBD.Text;
            dt.MaCH = txtMaCH.Text;
            dt.MaDK = txtMaDK.Text;

            if (dt.MaDK == "" && dt.MaDT == "")
            {
                MessageBox.Show("Insert Fail!!!");
                return;
            }
            themdt.DeThis.InsertOnSubmit(dt);
            themdt.SubmitChanges();
            MessageBox.Show("Insert Success!!!");
            LoadData();
            CleanTextBox();
        }
Exemplo n.º 17
0
        private void btn_LoadReport_Click(object sender, EventArgs e)
        {
            string ky = txtChonKy.Text;

            using (var db = new LTUDQL1DataContext())
            {
                bsCR.DataSource = from kq in db.KetQuas
                                  join kt in db.KyThis on new { kq.MaKT, kq.MaHV }
                equals new { kt.MaKT, kt.MaHV }
                join sv in db.USERs on kt.MaHV equals sv.f_MaSo
                where kt.MaKT == ky
                     select new ThiSinhRP
                {
                    MaKyThi    = kt.MaKT,
                    MaHocVien  = sv.f_MaSo,
                    TenHocVien = sv.f_HoTen,
                    NgaySinh   = sv.f_NgaySinh,
                    GioiTinh   = sv.f_GioiTinh,
                    Diem       = kq.Diem
                };
            }
            this.reportViewer1.RefreshReport();
        }
Exemplo n.º 18
0
 private void btnDongGop_Click(object sender, EventArgs e)
 {
     LTUDQL1DataContext DongGop = new LTUDQL1DataContext();