コード例 #1
0
 public ActionResult ResetPersonnelPassword(Personnel personnelModel)
 {
     using (IsYonetimDBEntities dbModel = new IsYonetimDBEntities())
     {
         var personnelDetail = dbModel.Personnels.AsNoTracking().Where(x => x.username == personnelModel.username && x.email == personnelModel.email).FirstOrDefault();
         if (personnelDetail == null)
         {
             //ModelState.AddModelError(string.Empty, "Hatalı Kullanıcı Adı ve/veya E-mail");
             ViewBag.DuplicateMessage = "Hatalı Kullanıcı Adı ve/veya E-mail";
         }
         else
         {
             personnelModel.user_id              = Convert.ToInt32(personnelDetail.user_id);
             personnelModel.username             = personnelDetail.username.ToString();
             personnelModel.first_name           = personnelDetail.first_name.ToString();
             personnelModel.last_name            = personnelDetail.last_name.ToString();
             personnelModel.email                = personnelDetail.email.ToString();
             personnelModel.salary               = Convert.ToInt32(personnelDetail.salary);
             personnelModel.password             = Crypto.Hash(personnelModel.password);
             personnelModel.confirm_password     = Crypto.Hash(personnelModel.confirm_password);
             dbModel.Entry(personnelModel).State = EntityState.Modified;
             dbModel.SaveChanges();
             personnelModel.password = "";
             ViewBag.SuccessMessage  = "Parola Yenilendi.";
             return(View("PersonnelLogin", personnelModel));
         }
         //ModelState.AddModelError(string.Empty, "Hatalı Kullanıcı Adı ve/veya E-mail");
         ViewBag.DuplicateMessage = "Hatalı Kullanıcı Adı ve/veya E-mail";
         return(View("PersonnelLogin", personnelModel));
     }
 }
コード例 #2
0
        //[MultipleButton(Name = "action", Argument = "PersonelLogin")]
        public ActionResult PersonnelLogin(IsYonetimSistemi.Models.Personnel personnelModel)
        {
            using (IsYonetimDBEntities db = new IsYonetimDBEntities())
            {
                if (personnelModel.password == null || personnelModel.username == null)
                {
                    ModelState.AddModelError("", "Hatalı Kullanıcı Adı ve/veya Parola");
                    personnelModel.password = "";
                    return(View("PersonnelLogin", personnelModel));
                }

                personnelModel.password = Crypto.Hash(personnelModel.password);
                var personnelDetail = db.Personnels.Where(x => x.username == personnelModel.username && x.password == personnelModel.password).FirstOrDefault();
                if (personnelDetail == null)
                {
                    ModelState.AddModelError("", "Hatalı Kullanıcı Adı ve/veya password");
                    personnelModel.password = "";
                    return(View("PersonnelLogin", personnelModel));
                }
                else
                {
                    Session["personnelID"]    = personnelDetail.user_id;
                    Session["personnelFName"] = personnelDetail.first_name;
                    Session["PersonnelLName"] = personnelDetail.last_name;
                    return(RedirectToAction("PersonnelHomePage", "Home"));
                }
            }
        }
コード例 #3
0
        public ActionResult ManagerLogin(IsYonetimSistemi.Models.Manager managerModel)
        {
            using (IsYonetimDBEntities db = new IsYonetimDBEntities())
            {
                if (managerModel.password == null || managerModel.username == null)
                {
                    ModelState.AddModelError("", "Hatalı Kullanıcı Adı ve/veya Parola");
                    managerModel.password = "";
                    return(View("ManagerLogin", managerModel));
                }



                managerModel.password = Crypto.Hash(managerModel.password);
                var managerDetail = db.Managers.Where(x => x.username == managerModel.username && x.password == managerModel.password).FirstOrDefault();

                if (managerDetail == null)
                {
                    ModelState.AddModelError("", "Hatalı Kullanıcı Adı ve/veya Parola");
                    managerModel.password = "";
                    return(View("ManagerLogin", managerModel));
                }
                else
                {
                    Session["managerID"]    = managerDetail.user_id;
                    Session["managerFName"] = managerDetail.first_name;
                    Session["managerLName"] = managerDetail.last_name;
                    return(RedirectToAction("ManagerHomePage", "Home"));
                }
            }
        }
コード例 #4
0
 public ActionResult GiveTask(int[] PersonnelIDs, IsYonetim isYonetim)
 {
     using (IsYonetimDBEntities dbModel = new IsYonetimDBEntities())
     {
         if (PersonnelIDs == null)
         {
             ViewBag.DuplicateMessage = "Görev atanacak personnel seçilmedi.";
             ViewBag.personnelList    = db.Personnels.ToList();
             return(View("GiveTask", isYonetim));
         }
         else
         {
             foreach (int personnelID in PersonnelIDs)
             {
                 ModelState.Clear();
                 Task newTask = new Task()
                 {
                     manager_id = isYonetim.taskViewModel.manager_id, personnel_id = personnelID,
                     task_name  = isYonetim.taskViewModel.task_name, task_detail = isYonetim.taskViewModel.task_detail
                 };
                 dbModel.Tasks.Attach(newTask);
                 dbModel.Tasks.Add(newTask);
                 dbModel.SaveChanges();
             }
             ViewBag.SuccessMessage = "Gorev Atandi.";
             ViewBag.personnelList  = db.Personnels.ToList();
             return(View("GiveTask", isYonetim));
         }
     }
 }
コード例 #5
0
 public ActionResult GiveLeave(int[] PersonnelIDs, IsYonetim isYonetim)
 {
     using (IsYonetimDBEntities dbModel = new IsYonetimDBEntities())
     {
         if (PersonnelIDs == null)
         {
             ViewBag.DuplicateMessage = "Izin verilecek personel seçilmedi.";
             ViewBag.personnelList    = db.Personnels.ToList();
             return(View("GiveLeave", isYonetim));
         }
         else
         {
             foreach (int personnelID in PersonnelIDs)
             {
                 ModelState.Clear();
                 Leave newLeave = new Leave()
                 {
                     manager_id     = isYonetim.leaveViewModel.manager_id, personnel_id = personnelID,
                     leave_reason   = isYonetim.leaveViewModel.leave_reason, leave_start_date = isYonetim.leaveViewModel.leave_start_date,
                     leave_end_date = isYonetim.leaveViewModel.leave_end_date
                 };
                 dbModel.Leaves.Attach(newLeave);
                 dbModel.Leaves.Add(newLeave);
                 dbModel.SaveChanges();
             }
             ViewBag.SuccessMessage = "İzin verildi.";
             ViewBag.personnelList  = db.Personnels.ToList();
             return(View("GiveLeave", isYonetim));
         }
     }
 }
コード例 #6
0
        public ActionResult ManagerRegister(Manager managerModel)
        {
            using (IsYonetimDBEntities dbModel = new IsYonetimDBEntities())
            {
                if (dbModel.Managers.Any(x => x.username == managerModel.username))
                {
                    ViewBag.DuplicateMessage = "Kullanıcı adı bir başka kullanıcı tarafından kullanılıyor.";
                    return(View("ManagerRegister", managerModel));
                }
                managerModel.password         = Crypto.Hash(managerModel.password);
                managerModel.confirm_password = Crypto.Hash(managerModel.confirm_password);
                dbModel.Managers.Add(managerModel);
                dbModel.SaveChanges();

                ModelState.Clear();
                ViewBag.SuccessMessage = "Yonetici Kaydedildi.";
                return(View("ManagerRegister", new Manager()));
            }
        }
コード例 #7
0
        public ActionResult PersonnelRegister(Personnel personnelModel)
        {
            using (IsYonetimDBEntities dbModel = new IsYonetimDBEntities())
            {
                if (dbModel.Personnels.Any(x => x.username == personnelModel.username))
                {
                    ViewBag.DuplicateMessage = "Kullanıcı adı bir başka kullanıcı tarafından kullanılıyor.";
                    return(View("PersonnelRegister", personnelModel));
                }

                personnelModel.password         = Crypto.Hash(personnelModel.password);
                personnelModel.confirm_password = Crypto.Hash(personnelModel.confirm_password);
                dbModel.Personnels.Add(personnelModel);
                dbModel.SaveChanges();

                ModelState.Clear();
                ViewBag.SuccessMessage = "Personel Kaydedildi.";
                return(View("PersonnelRegister", new Personnel()));
            }
        }