public ActionResult ChinhSuaLoiDanToc(int id)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                LoiModel  chitietLoi = new LoiModel();
                TABLE_LOI tableLoi   = db.TABLE_LOI.Find(id);
                string    typeLoi    = tableLoi.TypeLOI;
                ViewBag.typeLoi = typeLoi;
                ViewBag.idLoi   = id;
                Xuly xuly = new Xuly();
                ViewBag.HocSinhLoi = xuly.ReturnHoten(id);
                int id_GKS = tableLoi.id_GKS ?? 0;
                int id_BTN = tableLoi.id_BTN ?? 0;
                int id_HB  = tableLoi.id_HB ?? 0;
                if (check(id_GKS))
                {
                    chitietLoi.Giaykhaisinh = db.GIAYKHAISINHs.Find(id_GKS);
                }
                if (check(id_BTN))
                {
                    chitietLoi.Bangtotnghiep = db.BANGTOTNGHIEPs.Find(id_BTN);
                }
                if (check(id_HB))
                {
                    chitietLoi.Hocba = db.HOCBAs.Find(id_HB);
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 2
0
        public ActionResult Dangnhap(string tenDangNhap, string matKhau)
        {
            Xuly     xuly       = new Xuly();
            string   matKhauNew = xuly.chuoiMaHoa(matKhau);
            NHANVIEN Listnv     = db.NHANVIENs.SingleOrDefault(n => n.TenDangNhap == tenDangNhap);
            NHANVIEN nv         = Listnv != null ? Listnv : null;

            if (nv != null)
            {
                if (nv.MatKhau == matKhauNew)
                {
                    List <PHANQUYEN>    listPQ         = db.PHANQUYENs.Where(n => n.id_quyen == nv.id_Quyen).ToList();
                    QUYEN               quyen          = db.QUYENs.Find(nv.id_Quyen);
                    ModelQuyenNguoiDung QuyenNguoiDung = new ModelQuyenNguoiDung(nv, quyen);
                    Session["QuyenNguoiDung"] = QuyenNguoiDung;

                    Session["DangNhap"]    = "OK";
                    Session["thongbaoDN"]  = null;
                    Session["NguoiDung"]   = nv.TenDangNhap;
                    Session["NguoiDungHT"] = nv;
                    listTb();
                    return(RedirectToAction("Index", "Home"));
                }
                Session["DangNhap"]   = "NO";
                Session["thongbaoDN"] = "Đăng nhập thất bại";
                return(View());
            }
            else
            {
                Session["DangNhap"]   = "NO";
                Session["thongbaoDN"] = "Đăng nhập thất bại";
                return(View());
            }
        }
        public ActionResult Themmoi(NHANVIEN nhanvien)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && quyenNguoiDung.Quyen.Ten == "Admin")
            {
                NHANVIEN nguoiDung = Session["NguoiDungHT"] as NHANVIEN;
                if (nguoiDung != null)
                {
                    if (ModelState.IsValid)
                    {
                        nhanvien.NguoiTao = nguoiDung.id;
                        nhanvien.NgayTao  = DateTime.Now;
                        Senmail senmail = new Senmail();
                        senmail.SendEmail("*****@*****.**", "Mật khẩu vào hệ thống của bạn \n là " + nhanvien.TenDangNhap);
                        Xuly xuly = new Xuly();
                        nhanvien.MatKhau = xuly.chuoiMaHoa(nhanvien.TenDangNhap);
                        db.NHANVIENs.Add(nhanvien);
                        db.SaveChanges();

                        return(RedirectToAction("Index"));
                    }
                    return(View());
                }
                return(View());
            }
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult ChinhSuaLoiQueQuan(int id)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                LoiModel  chitietLoi = new LoiModel();
                TABLE_LOI tableLoi   = db.TABLE_LOI.Find(id);
                string    typeLoi    = tableLoi.TypeLOI;
                ViewBag.idLoi   = id;
                ViewBag.typeLoi = typeLoi;
                Xuly xuly = new Xuly();
                ViewBag.HocSinhLoi = xuly.ReturnHoten(id);
                int    id_GKS = tableLoi.id_GKS ?? 0;
                string so_CMT = tableLoi.So_CMT ?? null;
                if (check(id_GKS))
                {
                    chitietLoi.Giaykhaisinh = db.GIAYKHAISINHs.Find(id_GKS);
                }
                if (so_CMT != null)
                {
                    chitietLoi.Cmt = db.CMTs.Find(so_CMT);
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Xuly xuly = db.Xulies.Find(id);

            db.Xulies.Remove(xuly);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "idxl,phuongphap,mota")] Xuly xuly)
 {
     if (ModelState.IsValid)
     {
         db.Entry(xuly).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(xuly));
 }
Ejemplo n.º 7
0
        public ActionResult Create([Bind(Include = "idxl,phuongphap,mota")] Xuly xuly)
        {
            //if (ModelState.IsValid)
            //{
            db.Xulies.Add(xuly);
            db.SaveChanges();
            return(RedirectToAction("Index"));
            //}

            //return View(xuly);
        }
 public JsonResult DoiMatKhau(NHANVIEN nv)
 {
     if (ModelState.IsValid)
     {
         NHANVIEN nvOld = db.NHANVIENs.Find(nv.id);
         Xuly     xuly  = new Xuly();
         nvOld.MatKhau         = xuly.chuoiMaHoa(nv.MatKhau);
         db.Entry(nvOld).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(Json("YES", JsonRequestBehavior.AllowGet));
     }
     return(Json("NO", JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 9
0
        // GET: /Xuly/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Xuly xuly = db.Xulies.Find(id);

            if (xuly == null)
            {
                return(HttpNotFound());
            }
            return(View(xuly));
        }
        public JsonResult CheckMatKhau(int id, string matkhauOld)
        {
            NHANVIEN nvOld = db.NHANVIENs.Find(id);
            Xuly     xuly  = new Xuly();

            if (nvOld != null && nvOld.MatKhau == xuly.chuoiMaHoa(matkhauOld))
            {
                return(Json("YES", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("NO", JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Index(int?page)
        {
            ModelQuyenNguoiDung quyenNguoiDung = Session["QuyenNguoiDung"] as ModelQuyenNguoiDung;

            if (quyenNguoiDung != null && (quyenNguoiDung.Quyen.Ten == "QuanLyThongTinHocSinh" || quyenNguoiDung.Quyen.Ten == "Admin"))
            {
                Session["chuyenTab"] = null;
                Xuly           xuly    = new Xuly();
                List <string>  listNam = new List <string>();
                List <HOCSINH> lisths  = db.HOCSINHs.OrderByDescending(n => n.timeStart).ToList();
                foreach (var item1 in lisths)
                {
                    if (!xuly.checkTrungTimeStart(item1.timeStart, listNam)) //chưa tồn tại trong list thì thêm vào list
                    {
                        listNam.Add(item1.timeStart);
                    }
                }
                ViewBag.listNam = listNam;
                int count = db.HOCSINHs.Where(n => n.NguoiTao == quyenNguoiDung.Nhanvien.id).ToList().Count;
                ViewBag.All            = count;
                Session["chiasotrang"] = count % 10 == 0 ? count / 10 : count / 10 + 1;
                page = page ?? 1;
                int lineStart = (int)(page - 1) * 10; //dòng bắt đầu
                int soBanGhi  = 10;                   //số bản ghi cần hiện thị mỗi trang
                Session["trangdangload"] = page;

                var idParam0 = new SqlParameter
                {
                    ParameterName = "NguoiTao",
                    Value         = quyenNguoiDung.Nhanvien.id
                };
                var idParam1 = new SqlParameter
                {
                    ParameterName = "LineStart",
                    Value         = lineStart
                };
                var idParam2 = new SqlParameter
                {
                    ParameterName = "soBanGhi",
                    Value         = soBanGhi
                };
                var list = db.Database.SqlQuery <HOCSINH>("exec PhanTrang @NguoiTao,@LineStart,@soBanGhi ", idParam0, idParam1, idParam2).ToList <HOCSINH>();
                return(View(list));
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 12
0
 public void chitietNV_Insert(Dulieu dt)
 {
     Xuly.table_Command("INSERT INTO chitietStaff VALUES(N'" + dt.WorkName + "',N'" + dt.WorkStatus + "',N'" + dt.StaffName + "')");
 }
Ejemplo n.º 13
0
 //public void Work_Delete(Dulieu dt)
 //{
 //    Xuly.table_Command("DELETE FROM work WHERE workID = '" + dt.WorkID + "'");
 //}
 public void Work_Insert(Dulieu dt)
 {
     Xuly.table_Command("INSERT INTO work VALUES(N'" + dt.WorkName + "','" + dt.FromTime + "','" + dt.ToTime + "','" + dt.WorkStatus + "','" + dt.WorkDate + "')");
 }
Ejemplo n.º 14
0
 public DataTable staff_selectAll()
 {
     return(Xuly.table_Select("select * from staff"));
 }
Ejemplo n.º 15
0
 public DataTable staff_selectAllId(Dulieu dt)
 {
     return(Xuly.table_Select("select * from staff where DepartmentID = '" + dt.DepartmentID + "'"));
 }
Ejemplo n.º 16
0
 public DataTable department_selectAll()
 {
     return Xuly.table_Select("select * from department");
 }
Ejemplo n.º 17
0
 public void chitietCV_Insert(Dulieu dt)
 {
     Xuly.table_Command("INSERT INTO chitietWork VALUES(N'" + dt.WorkName + "','" + dt.StaffName + "','" + dt.DepartmentName + "')");
 }
Ejemplo n.º 18
0
 public DataTable Boss_SelectAll()
 {
     return(Xuly.table_Select("select * from boss"));
 }