Example #1
0
 public ActionResult AddVolunteerDoctor(SignUpViewModel signUpViewModel)
 {
     try
     {
         var user            = new User();
         var volunteerDoctor = new VolunteerDoctor();
         var signuphelper    = new SignUpHelper();
         user = signuphelper.GetUserobj(signUpViewModel);
         var result = _userService.Save(user);
         var userid = _userService.GetLastId(signUpViewModel.Email);
         signUpViewModel.UserId = userid.Data;
         volunteerDoctor        = signuphelper.GetVolunteerDoctorobj(signUpViewModel);
         var result2 = _volunteerDoctorService.Save(volunteerDoctor);
         if (result.HasError)
         {
             ViewBag.Message = result.Message;
             return(Content(result.Message));
         }
         if (result2.HasError)
         {
             ViewBag.Message = result2.Message;
             return(Content(result2.Message));
         }
         return(RedirectToAction("GetAllVolunteerDoctor"));
     }
     catch (Exception e)
     {
         return(Content(e.Message));
     }
 }
 public ActionResult AssignedRequestsDoctor(int requestId, int doctorId, int empId)
 {
     try
     {
         AssignedRequest assign = new AssignedRequest();
         assign.RequestId         = requestId;
         assign.VolunteerDoctorId = doctorId;
         assign.EmployeeId        = empId;
         var result2 = _volunteerDoctorService.GetById(doctorId);
         if (result2.HasError)
         {
             ViewBag.Message = result2.Message;
             return(Content(result2.Message));
         }
         result2.Data.IsActive     = "false";
         result2.Data.IsDoctorDone = "Not Done";
         _volunteerDoctorService.Save(result2.Data);
         var result = _assignedRequest.Save(assign);
         if (result.HasError)
         {
             ViewBag.Message = result.Message;
             return(Content(result.Message));
         }
         ViewBag.count = 1;
         Notification notification = new Notification();
         notification.RequestId = requestId;
         notification.UserId    = doctorId;
         var result3 = _notificationService.Save(notification);
         if (result3.HasError)
         {
             ViewBag.Message = result3.Message;
             return(Content(result3.Message));
         }
     }
     catch (Exception e)
     {
         return(Content(e.Message));
     }
     return(RedirectToAction("RequestDetails", "Request", new { id = requestId, count = 1 }));
 }
Example #3
0
        public ActionResult LogIn(User user)
        {
            try
            {
                var obj       = _service.GetByEmail(user.Email);
                var volunteer = _volunteerService.GetById(obj.Data.UserId);

                if (obj.Data.UserType.Equals("Volunteer"))
                {
                    if (volunteer.Data.IsApprove.Equals("false"))
                    {
                        return(Content("Your Volunteer Request is Pending !!! Please wait"));
                    }
                    if (volunteer.Data.IsVolunteerDone.Equals("Done"))
                    {
                        volunteer.Data.IsActive = "true";
                    }
                    else
                    {
                        volunteer.Data.IsActive = "false";
                    }

                    _volunteerService.Save(volunteer.Data);
                }
                var volunteerdoctor = _volunteerDoctorService.GetById(obj.Data.UserId);

                if (obj.Data.UserType.Equals("Doctor"))
                {
                    if (volunteerdoctor.Data.IsDoctorDone.Equals("Done"))
                    {
                        volunteerdoctor.Data.IsActive = "true";
                    }
                    else
                    {
                        volunteerdoctor.Data.IsActive = "false";
                    }
                    _volunteerDoctorService.Save(volunteerdoctor.Data);
                }
                var result = _service.Login(user.Email, user.Password);
                if (result == false)
                {
                    ViewBag.Message = "Invalid Email and Password";
                    return(Content("Invalid Email and Password"));
                }
                if (obj.HasError)
                {
                    ViewBag.Message = "Invalid Email and Password";
                    return(Content(obj.Message));
                }
                var jasonUserInfo = JsonConvert.SerializeObject(obj.Data);
                FormsAuthentication.SetAuthCookie(jasonUserInfo, false);
                if (obj.Data.UserType.Equals("Volunteer"))
                {
                    return(RedirectToAction("VolunteerActivities", "Volunteer"));
                }
                else if (obj.Data.UserType.Equals("Doctor"))
                {
                    return(RedirectToAction("VolunteerDoctorActivities", "VolunteerDoctor"));
                }
                return(RedirectToAction("GetAllRequest", "Request"));
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
        }
Example #4
0
        public ActionResult WorkShopAssign(int workShopId, int userId, int track = 0)
        {
            try
            {
                AssignWorkShop assign = new AssignWorkShop();
                assign.WorkShopId = workShopId;
                assign.UserId     = userId;
                var result = _assignworkShopService.Save(assign);
                if (track == 1)
                {
                    var result2 = _volunteerService.GetById(userId);
                    //result2.Data.WorkShopStatus = "true";
                    var result3 = _volunteerService.Save(result2.Data);
                    if (result2.HasError)
                    {
                        ViewBag.Message = result2.Message;
                        return(Content(result2.Message));
                    }
                    if (result3.HasError)
                    {
                        ViewBag.Message = result3.Message;
                        return(Content(result3.Message));
                    }
                }

                else if (track == 2)
                {
                    var result2 = _volunteerDoctorService.GetById(userId);
                    //result2.Data.WorkShopStatus = "true";
                    var result3 = _volunteerDoctorService.Save(result2.Data);
                    if (result2.HasError)
                    {
                        ViewBag.Message = result2.Message;
                        return(Content(result2.Message));
                    }
                    if (result3.HasError)
                    {
                        ViewBag.Message = result3.Message;
                        return(Content(result3.Message));
                    }
                }

                Notification notification = new Notification();
                notification.UserId     = userId;
                notification.WorkShopId = workShopId;
                notification.IsWorkShop = "true";
                var result4 = _notificationService.Save(notification);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content(result.Message));
                }

                if (result4.HasError)
                {
                    ViewBag.Message = result4.Message;
                    return(Content(result4.Message));
                }
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
            return(RedirectToAction("WorkShopDetails", new{ id = workShopId }));
        }