public UserProfilesDTO ExternalUserProfile(Guid ID)
        {
            var retVal = new UserProfilesDTO();

            var result = db.ExternalShiftRequests.FirstOrDefault(a => a.Id == ID).CreatedBy;

            retVal.AboutMe         = result.AboutMe;
            retVal.Address         = result.Address;
            retVal.CurrentAddress  = result.CurrentAddress;
            retVal.DateofBirth     = result.DateofBirth;
            retVal.Distance        = result.Distance;
            retVal.Email           = result.Email;
            retVal.FirstName       = result.FirstName;
            retVal.HasViewedWizard = result.HasViewedWizard;
            retVal.Id             = result.Id;
            retVal.ImageData      = result.UserPreferences.ImageData;
            retVal.IndustryTypeId = result.IndustryTypesID;
            retVal.LastName       = result.LastName;
            retVal.MobilePhone    = result.MobilePhone;
            //retVal.OtherQualificationsList = result.OtherQualifications;
            retVal.QRCode             = result.QRCode;
            retVal.QualificationsList = result.UserQualifications.Select(a => new DropDownDTO {
                Text = a.Qualificationslookup.QualificationName, ValueGuid = a.Qualificationslookup.QualificationId
            }).ToList();
            retVal.SkillsList = result.UserSkills.Select(a => new DropDownDTO {
                Text = a.IndustrySkill.Name, ValueGuid = a.IndustrySkill.Id
            }).ToList();
            retVal.WorkHistoryList = result.WorkHistories.Select(a => new WorkHistoryDTO {
                workCompanyName = a.workCompanyName, workEndDate = a.workEndDate, workId = a.workId, workStartDate = a.workStartDate, UserRole = a.UserRole
            }).ToList();
            //retVal = MapperFacade.MapperConfiguration.Map<UserProfile, ExternalUserProfileViewDTO>(result);
            return(retVal);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To Update the Current location of User
        /// </summary>
        /// <param name="userLocation"></param>
        /// <returns></returns>
        public ActionResult UpdateLocation(UserProfilesDTO userLocation)
        {
            //Current user has requested to be linked to a business
            using (HttpClientWrapper httpClient = new HttpClientWrapper(Session))
            {
                var Data = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("Line1", userLocation.Line1),
                    new KeyValuePair <string, string>("Line2", userLocation.Line2),
                    new KeyValuePair <string, string>("Suburb", userLocation.Suburb),
                    new KeyValuePair <string, string>("State", userLocation.State),
                    new KeyValuePair <string, string>("Postcode", userLocation.Postcode),
                    new KeyValuePair <string, string>("PlaceLongitude", Convert.ToString(userLocation.PlaceLongitude)),
                    new KeyValuePair <string, string>("PlaceLatitude", Convert.ToString(userLocation.PlaceLatitude)),
                    new KeyValuePair <string, string>("PlaceId", userLocation.PlaceId)
                });
                var response = httpClient.PostAsync("api/UserProfileAPI/UpdateLocation", Data).Result;
                Response.StatusCode = (int)response.StatusCode;
                if (!response.IsSuccessStatusCode)
                {
                    return(this.Content(JsonConvert.DeserializeObject <dynamic>(response.Content.ReadAsStringAsync().Result).Message.ToString()));
                }
            }

            return(Content("Success"));
        }
Ejemplo n.º 3
0
        public ActionResult ProfileIndex()
        {
            UserProfilesDTO result = new UserProfilesDTO();

            using (HttpClientWrapper httpClient = new HttpClientWrapper(Session))
            {
                var response = httpClient.GetAsync("api/UserProfileAPI/ProfileInfo").Result;
                result = JsonConvert.DeserializeObject <UserProfilesDTO>(response.Content.ReadAsStringAsync().Result);

                //var RoleList = httpClient.GetAsync("api/UserProfileAPI/GetRoles").Result;
                //result.RoleList = JsonConvert.DeserializeObject<List<DropDownDTO>>(RoleList.Content.ReadAsStringAsync().Result);

                var WorkHistoryList = httpClient.GetAsync("api/UserProfileAPI/GetWorkHistory").Result;
                result.WorkHistoryList = JsonConvert.DeserializeObject <List <WorkHistoryDTO> >(WorkHistoryList.Content.ReadAsStringAsync().Result);

                var QualificationsList = httpClient.GetAsync("api/UserProfileAPI/GetQualificationsByIndustry").Result;
                result.QualificationsList = JsonConvert.DeserializeObject <List <DropDownDTO> >(QualificationsList.Content.ReadAsStringAsync().Result);

                var OtherQualifications = httpClient.GetAsync("api/UserProfileAPI/GetOtherQualifications").Result;
                result.OtherQualificationsList = JsonConvert.DeserializeObject <List <OtherQualificationDTO> >(OtherQualifications.Content.ReadAsStringAsync().Result);

                var Skills = httpClient.GetAsync("api/UserProfileAPI/GetSkillsByIndustry").Result;
                result.SkillsList = JsonConvert.DeserializeObject <List <DropDownDTO> >(Skills.Content.ReadAsStringAsync().Result);
            }

            return(View(result));
        }
Ejemplo n.º 4
0
        public UserProfilesDTO ExternalUserProfile(Guid ID)
        {
            var             LoggedInUser = db.UserProfiles.FirstOrDefault(a => a.Email == HttpContext.Current.User.Identity.Name).Id;
            UserProfilesDTO retVal       = new UserProfilesDTO();
            Guid            userID       = new Guid();
            //This is the check if an user finds from uniq search Top bar and if the user is an employee
            var employee = db.Employees.FirstOrDefault(a => a.Id == ID);

            if (employee != null)
            {
                userID = employee.UserProfile.Id;
            }
            else
            {
                userID = ID;
            }

            var result = db.UserProfiles.Where(usr => usr.Id == userID).FirstOrDefault();

            retVal.AboutMe         = result.AboutMe;
            retVal.Address         = result.Address;
            retVal.CurrentAddress  = result.CurrentAddress;
            retVal.DateofBirth     = result.DateofBirth;
            retVal.Distance        = result.Distance;
            retVal.Email           = result.Email;
            retVal.FirstName       = result.FirstName;
            retVal.HasViewedWizard = result.HasViewedWizard;
            retVal.ExternalUserID  = result.Id;
            retVal.ImageData       = result.UserPreferences.ImageData;
            retVal.IndustryTypeId  = result.IndustryTypesID;
            retVal.LastName        = result.LastName;
            retVal.MobilePhone     = result.MobilePhone;
            retVal.QRCode          = result.QRCode;
            retVal.Id         = LoggedInUser;
            retVal.Businesses = db.Employees.Where(a => a.Email == HttpContext.Current.User.Identity.Name && a.UserProfile.Id != userID).Select(x => new DropDownDTO {
                Text = x.BusinessLocation.Business.Name, ValueGuid = x.BusinessLocation.Business.Id
            }).ToList();
            retVal.QualificationsList = result.UserQualifications.Select(a => new DropDownDTO {
                Text = a.Qualificationslookup.QualificationName, ValueGuid = a.Qualificationslookup.QualificationId
            }).ToList();
            retVal.SkillsList = result.UserSkills.Select(a => new DropDownDTO {
                Text = a.IndustrySkill.Name, ValueGuid = a.UserSkillId
            }).ToList();
            retVal.WorkHistoryList = result.WorkHistories.Select(a => new WorkHistoryDTO {
                workCompanyName = a.workCompanyName, workEndDate = a.workEndDate, workId = a.workId, workStartDate = a.workStartDate, UserRole = a.UserRole
            }).ToList();
            retVal.EmployeeList           = EpmloyeeList(userID);
            retVal.UserRecommendationsDTO = UserRecommending(userID);
            //retVal.UserRecommendationsDTO = UserRecommending(ID);
            //retVal.UserSkillEndorsementDTO.UserSkillEndorsedBy = skillEndorsedBY.Id;
            retVal.UserSkillEndorsmentListDTO = GetSkillsEndorsedByUsers(ID);
            // retVal.UserSkillEndorsementDTO = SkillsEndorsedUserBeingRecommended(ID);
            retVal.Count = result.UserRecommendationsUserRecommended.Where(a => a.UserProfileUserRecommended.Id == userID).Count();
            // retVal = MapperFacade.MapperConfiguration.Map<UserProfile, UserProfilesDTO>(result);
            return(retVal);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// To Update the Profile About Me of User
 /// </summary>
 /// <returns></returns>
 public ActionResult UpdateAboutMe(string AboutMe)
 {
     using (HttpClientWrapper httpClient = new HttpClientWrapper(Session))
     {
         UserProfilesDTO objProfile = new UserProfilesDTO()
         {
             AboutMe = AboutMe
         };
         var updateAboutMe = httpClient.PostAsJsonAsync <UserProfilesDTO>("api/UserProfileAPI/UpdateAboutMe", objProfile).Result;
         var resultAboutMe = JsonConvert.DeserializeObject <string>(updateAboutMe.Content.ReadAsStringAsync().Result);
         return(Json(new { Success = true, AboutMe = resultAboutMe }, JsonRequestBehavior.AllowGet));
     };
 }
Ejemplo n.º 6
0
        public string PostUpdateAboutMe([FromBody] UserProfilesDTO aboutMeData)
        {
            var email = HttpContext.Current.User.Identity.Name;

            UserProfile userProfile = db.UserProfiles.FirstOrDefault(usr => usr.Email == email);

            if (userProfile == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            userProfile.AboutMe = aboutMeData.AboutMe;
            db.SaveChanges();

            return(userProfile.AboutMe);
        }
Ejemplo n.º 7
0
        public bool PostUpdateDistance([FromBody] UserProfilesDTO userProfileDTO)
        {
            var email = HttpContext.Current.User.Identity.Name;

            UserProfile userProfile = db.UserProfiles.FirstOrDefault(usr => usr.Email == email);

            if (userProfile == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            userProfile.Distance             = userProfileDTO.Distance;
            userProfile.IsRegisteredExternal = true;
            userProfile.IndustryTypesID      = userProfileDTO.IndustryTypeId;
            db.SaveChanges();

            return(true);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// To Update the Current location of User
 /// </summary>
 /// <param name="userLocation"></param>
 /// <returns></returns>
 public ActionResult UpdateRange(UserProfilesDTO userLocation)
 {
     using (HttpClientWrapper httpClient = new HttpClientWrapper(Session))
     {
         var Data = new FormUrlEncodedContent(new[]
         {
             new KeyValuePair <string, string>("Distance", Convert.ToString(userLocation.Distance)),
             new KeyValuePair <string, string>("IndustryTypeId", Convert.ToString(userLocation.IndustryTypeId))
         });
         var response = httpClient.PostAsync("api/UserProfileAPI/UpdateDistance", Data).Result;
         Response.StatusCode = (int)response.StatusCode;
         if (!response.IsSuccessStatusCode)
         {
             return(this.Content(JsonConvert.DeserializeObject <dynamic>(response.Content.ReadAsStringAsync().Result).Message.ToString()));
         }
     }
     return(Content("Success"));
 }
Ejemplo n.º 9
0
        public ActionResult ExternalUserProfile(Guid externalshiftRequestID, Guid ExternalShiftBroadCastID)
        {
            UserProfilesDTO up = new UserProfilesDTO();

            if (ClaimsHelper.IsInRole(System.Web.HttpContext.Current, Constants.RoleBusinessLocationManager))
            {
                //Get a summary of the employes currently linked to the Employee
                using (HttpClientWrapper httpClient = new HttpClientWrapper(Session))
                {
                    var response = httpClient.GetAsync("api/ManagerShiftActionAPI/ExternalUserProfile?ID=" + externalshiftRequestID).Result;
                    up = JsonConvert.DeserializeObject <UserProfilesDTO>(response.Content.ReadAsStringAsync().Result);
                    up.ExternalShiftBroadCastID = ExternalShiftBroadCastID;
                    up.ExternalshfitRequestID   = externalshiftRequestID;
                    // er = Task.Factory.StartNew(() => JsonConvert.DeserializeObject<ExternalShiftRequestListsDTO>(response.Result)).Result;
                }
            }

            return(PartialView(up));
        }
Ejemplo n.º 10
0
        public bool PostUpdateLocation([FromBody] UserProfilesDTO userProfileDTO)
        {
            var email = HttpContext.Current.User.Identity.Name;

            UserProfile userProfile = db.UserProfiles.FirstOrDefault(usr => usr.Email == email);

            if (userProfile == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            userProfile.CurrentAddress.Line1          = !String.IsNullOrEmpty(userProfileDTO.Line1) ? userProfileDTO.Line1.Replace(",", "") : "";
            userProfile.CurrentAddress.Line2          = !String.IsNullOrEmpty(userProfileDTO.Line2) ? userProfileDTO.Line2.Replace(",", "") : "";
            userProfile.CurrentAddress.Suburb         = !String.IsNullOrEmpty(userProfileDTO.Suburb) ? userProfileDTO.Suburb.Replace(",", "") : "";
            userProfile.CurrentAddress.State          = !String.IsNullOrEmpty(userProfileDTO.State) ? userProfileDTO.State.Replace(",", "") : "";
            userProfile.CurrentAddress.Postcode       = !String.IsNullOrEmpty(userProfileDTO.Postcode) ? userProfileDTO.Postcode : "";
            userProfile.CurrentAddress.PlaceLongitude = userProfileDTO.PlaceLongitude;
            userProfile.CurrentAddress.PlaceLatitude  = userProfileDTO.PlaceLatitude;

            db.SaveChanges();

            return(true);
        }
Ejemplo n.º 11
0
        public UserProfilesDTO GetProfileInfo()
        {
            var email = HttpContext.Current.User.Identity.Name;

            UserProfilesDTO userProfile = db.UserProfiles.Where(usr => usr.Email == email).Select(x => new UserProfilesDTO
            {
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                Line1       = x.CurrentAddress.Line1,
                Line2       = x.CurrentAddress.Line2,
                Suburb      = x.CurrentAddress.Suburb,
                State       = x.CurrentAddress.State,
                AboutMe     = x.AboutMe,
                DateofBirth = x.DateofBirth,
                ImageData   = x.UserPreferences.ImageData
            }).FirstOrDefault();

            if (userProfile == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(userProfile);
        }