예제 #1
0
        public void RoleList()
        {
            PMSEntities1 db    = new PMSEntities1();
            var          roles = db.Roles.Where(r => r.Title != "Patient" && r.Title != "Physician" && r.Title != "Admin").ToList();

            ViewBag.RolesList = roles;
        }
        public ActionResult ResetPassword(ResetPasswordModel model)
        {
            var message = "";

            if (ModelState.IsValid)
            {
                using (PMSEntities1 db = new PMSEntities1())
                {
                    var user = db.tbl_SuperAdminLogin.Where(a => a.ResetPassword == model.NewPassword).FirstOrDefault();
                    if (user != null)
                    {
                        user.password      = Crypto.Hash(model.NewPassword);
                        user.ResetPassword = "";
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SaveChanges();
                        message = "New password updated successfully";
                    }
                }
            }
            else
            {
                message = "Something invalid";
            }
            ViewBag.Message = message;
            return(View(model));
        }
        public ActionResult ResetPassword(string id)
        {
            //Verify the reset password link
            //Find account associated with this link
            //redirect to reset password page
            if (string.IsNullOrWhiteSpace(id))
            {
                return(HttpNotFound());
            }

            using (PMSEntities1 db = new PMSEntities1())
            {
                var user = db.tbl_SuperAdminLogin.Where(a => a.ResetPassword == id).FirstOrDefault();
                if (user != null)
                {
                    ResetPasswordModel model = new ResetPasswordModel();
                    model.NewPassword = id;
                    return(View(model));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
        }
        public ActionResult ForgotPassword(string useremail)
        {
            //Verify Email ID
            //Generate Reset password link
            //Send Email
            string message = "";

            // bool status = false;

            using (PMSEntities1 db = new PMSEntities1())
            {
                var account = db.tbl_SuperAdminLogin.Where(a => a.useremail == useremail).FirstOrDefault();
                if (account != null)
                {
                    //Send email for reset password
                    string resetCode = Guid.NewGuid().ToString();
                    SendVerificationLinkEmail(account.useremail, "ResetPassword");
                    account.ResetPassword = resetCode;
                    //This line I have added here to avoid confirm password not match issue , as we had added a confirm password property
                    //in our model class in part 1
                    db.Configuration.ValidateOnSaveEnabled = false;
                    db.SaveChanges();
                    message = "Reset password link has been sent to your email id.";
                }
                else
                {
                    message = "Account not found";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
예제 #5
0
        public ActionResult Add()
        {
            PMSEntities1 db      = new PMSEntities1();
            var          Getlist = db.Roles.ToList();
            SelectList   list    = new SelectList(Getlist, "Id", "Title");

            ViewBag.RolesList = list;
            return(View());
        }
예제 #6
0
        public ActionResult EditPermission(int id)
        {
            var          User = _userRepo.GetUserP(id);
            PMSEntities1 db   = new PMSEntities1();

            SetRolesAndModules();


            return(View("RegisterPermission", User));
        }
예제 #7
0
        public ActionResult Edit(int id)
        {
            var          User  = _userRepo.GetUser(id);
            PMSEntities1 db    = new PMSEntities1();
            var          roles = db.Roles.Where(r => r.Title != "Patient" && r.Title != "Physician").ToList();

            //SelectList list = new SelectList(Getlist, "Id", "Title");
            ViewBag.RolesList = roles;

            return(View("Register", User));
        }
예제 #8
0
        public void SetRolesAndModules()
        {
            PMSEntities1 db    = new PMSEntities1();
            var          roles = db.Roles.Where(r => r.Title != "Admin").ToList();

            //SelectList list = new SelectList(Getlist, "Id", "Title");
            ViewBag.RolesList = roles;
            var modules = db.Modules.ToList();

            ViewBag.ModulesList = modules;
        }
        // GET: Admin/ReportController
        public ActionResult Report(DateTime?startdate, DateTime?enddate)
        {
            //if (startdate != null && enddate != null)
            //{
            //    var model = db.tbl_ManageProjects.Where(x => x.startdate >= startdate && x.enddate <= enddate).ToList();


            //    return View(model);
            //}


            //return View(db.tbl_ManageProjects.ToList());

            using (PMSEntities1 db = new PMSEntities1())
            {
                List <tbl_TimeSheet>      timesheet = db.tbl_TimeSheet.ToList();
                List <tbl_ManageTask>     task      = db.tbl_ManageTask.ToList();
                List <tbl_ManageProjects> project   = db.tbl_ManageProjects.ToList();
                if (startdate != null && enddate != null)
                {
                    // var Record = db.tbl_ManageProjects.Where(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                    var Record = from e in timesheet
                                 join d in task on e.FKtaskid equals d.taskid into table1
                                 from d in table1.ToList()
                                 join i in project on e.FKprojectid equals i.projectid into table2
                                 from i in table2.ToList()
                                 where (i.startdate >= startdate && i.enddate <= enddate)
                                 //(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                                 select new Join
                    {
                        timesheet = e,
                        task      = d,
                        project   = i
                    };

                    return(View(Record));
                }
                var filterRecord = from e in timesheet
                                   join d in task on e.FKtaskid equals d.taskid into table1
                                   from d in table1.ToList()
                                   join i in project on e.FKprojectid equals i.projectid into table2
                                   from i in table2.ToList()
                                   //(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                                   select new Join
                {
                    timesheet = e,
                    task      = d,
                    project   = i
                };

                return(View(filterRecord));
            }
        }
예제 #10
0
        public ActionResult Save(User patient)
        {
            if ((IsEmailValid(patient.Email)) || (IsValid(patient.UserName)))
            {
                ViewBag.Message = "User name or Email already exists, please try another user name!";
                PMSEntities1 db = new PMSEntities1();
                return(View("Add"));
            }

            else
            {
                int userId = _userRepo.Save(patient);
                patient.Patients.First().UserId = userId;
                int pateintId = _patientRepo.Save(patient.Patients.First());

                patient.Patients.First().PatientPhysicians.First().PatientId = pateintId;
                _patientRepo.SavePatientPhysician(patient.Patients.First().PatientPhysicians.First());
                return(RedirectToAction("Index", "Patient", new { }));
            }
        }
예제 #11
0
        public ActionResult TaskReport(DateTime?startdate, DateTime?enddate)
        {
            //if (startdate != null && enddate != null)
            //{
            //    var model = db.tbl_ManageProjects.Where(x => x.startdate >= startdate && x.enddate <= enddate).ToList();


            //    return View(model);
            //}


            //return View(db.tbl_ManageProjects.ToList());

            using (PMSEntities1 db = new PMSEntities1())
            {
                List <tbl_ManageTask> task = db.tbl_ManageTask.ToList();
                if (startdate != null && enddate != null)
                {
                    // var Record = db.tbl_ManageProjects.Where(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                    var Record = from e in task
                                 where (e.startdate >= startdate && e.enddate <= enddate)
                                 //(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                                 select new TaskSummary
                    {
                        task = e
                    };

                    return(View(Record));
                }
                var filterRecord = from e in task
                                   //(x => x.startdate >= startdate && x.enddate <= enddate).ToList();
                                   select new TaskSummary
                {
                    task = e
                };

                return(View(filterRecord));
            }
        }