Beispiel #1
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     try
     {
         dssv.EndCurrentEdit();
         _db.SubmitChanges();
         enableNutLenh(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        public bool XoaKhoa(ref string err, string MaKhoa)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = from tp in qlSV.Khoas
                                      where tp.maKhoa == MaKhoa
                                      select tp;

            qlSV.Khoas.DeleteAllOnSubmit(tpQuery);
            qlSV.SubmitChanges();
            return(true);
        }
Beispiel #3
0
        public bool XoaSinhVien(ref string err, string MaSV)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = from tp in qlSV.SinhViens
                                      where tp.maSV == MaSV
                                      select tp;

            qlSV.SinhViens.DeleteAllOnSubmit(tpQuery);
            qlSV.SubmitChanges();
            return(true);
        }
Beispiel #4
0
        public bool XoaAc(ref string err, string user)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = from tp in qlSV.Logins
                                      where tp.userName == user
                                      select tp;

            qlSV.Logins.DeleteAllOnSubmit(tpQuery);
            qlSV.SubmitChanges();
            return(true);
        }
        public bool XoaDiem(ref string err, string MaSV, string MaMon)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = from tp in qlSV.KetQuas
                                      where tp.maSV == MaSV && tp.maMon == MaMon
                                      select tp;

            qlSV.KetQuas.DeleteAllOnSubmit(tpQuery);
            qlSV.SubmitChanges();
            return(true);
        }
Beispiel #6
0
        public bool ChangePassAccount(string username, string pass, string newpass, string comfimMK, string quyen)
        {
            if (quyen == "Member")
            {
                if (LoginMember(username, pass).Count > 0)
                {
                    if (newpass == comfimMK)
                    {
                        QLSVDataContext qlSV  = new QLSVDataContext();
                        var             query = (from tp in qlSV.Logins
                                                 where tp.userName == username
                                                 select tp);
                        foreach (var item in query)
                        {
                            item.passWord = newpass;
                        }
                        qlSV.SubmitChanges();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else //admin
            {
                if (newpass == comfimMK)
                {
                    QLSVDataContext qlSV  = new QLSVDataContext();
                    var             query = (from tp in qlSV.Logins
                                             where tp.userName == username
                                             select tp);

                    foreach (var item in query)
                    {
                        item.passWord = newpass;
                    }
                    qlSV.SubmitChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Beispiel #7
0
        public bool CapNhatKhoa(string MaKhoa, string TenKhoa, ref string err)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.Khoas
                                       where tp.maKhoa == MaKhoa
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.tenKhoa = TenKhoa;

                qlSV.SubmitChanges();
            }
            return(true);
        }
Beispiel #8
0
 public bool XoaLop(ref string err, string MaLop)
 {
     try
     {
         QLSVDataContext qlSV    = new QLSVDataContext();
         var             tpQuery = from tp in qlSV.Lops
                                   where tp.maLop == MaLop
                                   select tp;
         qlSV.Lops.DeleteAllOnSubmit(tpQuery);
         qlSV.SubmitChanges();
         return(true);
     }catch
     {
         return(false);
     }
 }
Beispiel #9
0
        public bool CapNhatDiem(string maSV, string maMon, string dgk, string dck, string dtb, bool kq)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.KetQuas
                                       where tp.maMon == maMon && tp.maSV == maSV
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.diemGiuaKi = Convert.ToDouble(dgk);
                tpQuery.diemCuoiKi = Convert.ToDouble(dck);
                tpQuery.diemTB     = Convert.ToDouble(dtb);
                tpQuery.ketQua     = kq;
                qlSV.SubmitChanges();
            }
            return(true);
        }
Beispiel #10
0
 public bool XoaDiem(string MaSV, string MaMon, string dgk, string dck)
 {
     try
     {
         QLSVDataContext qlSV    = new QLSVDataContext();
         var             tpQuery = from tp in qlSV.KetQuas
                                   where tp.maSV == MaSV && tp.maMon == MaMon && tp.diemGiuaKi == Convert.ToDouble(dgk) && tp.diemCuoiKi == Convert.ToDouble(dck)
                                   select tp;
         qlSV.KetQuas.DeleteAllOnSubmit(tpQuery);
         qlSV.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #11
0
        public bool CapNhatMon(string MaMon, string TenMon, string MaKhoa, int SoTinChi, string HK, ref string err)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.Mons
                                       where tp.maMon == MaMon
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.tenMon   = TenMon;
                tpQuery.maKhoa   = MaKhoa;
                tpQuery.soTinChi = SoTinChi;
                tpQuery.hocKi    = HK;
                qlSV.SubmitChanges();
            }
            return(true);
        }
        public bool CapNhatDiem(string maSV, string maMon, double dgk, double dck, double dtb, bool kq, ref string err)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.KetQuas
                                       where tp.maMon == maMon && tp.maSV == maSV
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.diemGiuaKi = dgk;
                tpQuery.diemCuoiKi = dck;
                tpQuery.diemTB     = dtb;
                tpQuery.ketQ       = kq;
                qlSV.SubmitChanges();
            }
            return(true);
        }
Beispiel #13
0
        public bool CapNhatSinhVien(string MaSV, string HoTen, DateTime NgaySinh, string GioiTinh, string DiaChi, string MaLop, ref string err)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.SinhViens
                                       where tp.maSV == MaSV
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.hoTen    = HoTen;
                tpQuery.ngaySinh = NgaySinh;
                tpQuery.gioiTinh = GioiTinh;
                tpQuery.diaChi   = DiaChi;
                tpQuery.maLop    = MaLop;
                qlSV.SubmitChanges();
            }
            return(true);
        }
Beispiel #14
0
        public bool CapNhatAc(string user, string pass, string Hoten, string GT, string phone, string email, ref string err)
        {
            QLSVDataContext qlSV    = new QLSVDataContext();
            var             tpQuery = (from tp in qlSV.Logins
                                       where tp.userName == user
                                       select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.passWord = pass;
                tpQuery.hoTen    = Hoten;
                tpQuery.gioiTinh = GT;
                tpQuery.Phone    = phone;
                tpQuery.Email    = email;
                qlSV.SubmitChanges();
            }
            return(true);
        }
Beispiel #15
0
 public bool CapNhatLop(string MaLop, string TenLop, string MaKhoa)
 {
     try
     {
         QLSVDataContext qlSV    = new QLSVDataContext();
         var             tpQuery = (from tp in qlSV.Lops
                                    where tp.maLop == MaLop
                                    select tp).SingleOrDefault();
         if (tpQuery != null)
         {
             tpQuery.tenLop = TenLop;
             tpQuery.maKhoa = MaKhoa;
             qlSV.SubmitChanges();
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #16
0
 public bool CapNhatAc(string user, string pass, string Hoten, string GT, string phone, string email)
 {
     //try
     {
         QLSVDataContext qlSV  = new QLSVDataContext();
         var             query = (from tp in qlSV.Logins
                                  where tp.userName == user.Trim()
                                  select tp);
         foreach (var item in query)
         {
             item.passWord = pass;
             item.hoTen    = Hoten;
             item.gioiTinh = GT;
             item.Phone    = phone;
             item.Email    = email;
         }
         qlSV.SubmitChanges();
         return(true);
     }//catch
     {
         return(false);
     }
 }