/// <summary> /// Returns the user profile info from the EFS Service /// </summary> /// <param name="userAnid"> /// Encrypted Anid of the user /// </param> /// <returns> /// UserInfo for the Anid /// </returns> public UserDemographics GetUserProfile(string userAnid) { Trace.WriteLine(string.Format("Received ProfileInfo request for Encrypted Anid : {0}", userAnid)); UserDemographics userProfile = null; if (!string.IsNullOrEmpty(userAnid)) { try { userProfile = Proxy.GetUserProfile(userAnid); Trace.WriteLine(string.Format("Finished Processing ProfileInfo request for Anid : {0}", userAnid)); } catch (CryptographicException) { throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Invalid key...Unbale to decrypt the anid")); } catch (Exception exception) { Trace.TraceError(exception.Message, exception); } } else { throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Empty useranid passed")); } return(userProfile); }
public ActionResult Create(UserDemographics obj) { using (RentMyWroxContext context = new RentMyWroxContext()) { var ids = Request.Form.GetValues("HobbyIds"); if (ids != null) { obj.Hobbies = context.Hobbies.Where(x => ids.Contains(x.Id.ToString())).ToList(); } context.UserDemographics.Add(obj); var validationErrors = context.GetValidationErrors(); if (validationErrors.Count() == 0) { context.SaveChanges(); ApplicationUser user = UserHelper.GetApplicationUser(); user.UserDemographicsId = obj.Id; context.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ServerValidationErrors = ConvertValidationErrorsToString(validationErrors); return(View("Manage", obj)); } }
/// <summary> /// Returns the user profile from the EFS service for the Anid /// </summary> /// <param name="userAnid"> /// Encrypted Anid /// </param> /// <returns> /// User profile info for the Anid /// </returns> public static UserDemographics GetUserProfile(string userAnid) { UserDemographics userProfile = null; string decryptedAnid = Cipher.Decrypt(userAnid, AnidPassphrase); Trace.WriteLine(string.Format("Decrypted Anid : {0}", decryptedAnid)); var client = new EfsService.UserInfoServiceClient(); var lst = new List <KeyValuePair <EfsService.UserIdType, string> > { new KeyValuePair <EfsService.UserIdType, string>(EfsService.UserIdType.Anid, decryptedAnid) }; Trace.WriteLine(string.Format("Calling EFS Service to get Profile info for Anid : {0}", decryptedAnid)); EfsService.UserDemographics result = client.GetDemographics(lst.ToArray()); if (result != null) { Trace.WriteLine(string.Format("Successfully retrieved Profile info for Anid : {0}", decryptedAnid)); userProfile = new UserDemographics { Gender = result.Gender.ToString(), Age = result.Age }; Trace.WriteLine("Constructed UserProfile Object"); Trace.WriteLine(string.Format("Calling EFS Service to get opt out info for Anid : {0}", decryptedAnid)); var pref = new EfsService.UserPreferenceServiceClient(); bool?optout = pref.GetOptOutState(decryptedAnid, EfsService.UserIdType.Anid); userProfile.OptOut = optout.GetValueOrDefault(false); } else { Trace.WriteLine(string.Format("Profile not found fsor Anid : {0}", decryptedAnid)); } return(userProfile); }
/// <summary> /// Initializes a new instance of the <see cref="UserData"/> class. /// </summary> /// <param name="anid">The anid.</param> /// <param name="muid">The muid.</param> /// <param name="ip">The ip.</param> /// <param name="upanid">The upanid.</param> /// <param name="demographics">The user demographics</param> /// <param name="sessionId">The session id</param> public UserData(string anid = null, string muid = null, string ip = null, string upanid = null, UserDemographics demographics = null, Guid?sessionId = null) { Anid = anid; Muid = muid; Ip = ip; Upanid = upanid; Demographics = demographics; SessionId = sessionId; }
public ActionResult Create(UserDemographics obj) { try { // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: UserDemographics/Edit/5 public ActionResult Edit(int id) { var model = new UserDemographics { Gender = "Male", Birthdate = new DateTime(2000, id, id), MaritalStatus = "Married", OwnHome = true, TotalPeopleInHome = id, Hobbies = new List <string> { "Gardening", "Other" } }; return(View("Manage", model)); }
// GET: UserDemographics/Edit/5 public ActionResult Edit(int id) { //var model = new UserDemographics //{ // Gender = "Male", // Birthdate = new DateTime(2000, id, id), // MaritalStatus = "Married", // OwnHome = true, // TotalPeopleInHome = id, // Hobbies = new List<string> { "Gardening", "Other" } //}; //return View("Manage", model); var model = new UserDemographics(); return(View("Manage", model)); }
public async Task <JsonResult> FaceAttribute(string data, bool flag) { try { UserDemographics ud = new UserDemographics(); await ud.DetectFaceAttribute(data, flag); if (ud.Erorr == "")//converting all face's attribute as Json and returning the Json { return(Json(new { Face = ud.Jarray, MaleCount = ud.MCount, FemaleCount = ud.FCount, Total = ud.MCount + ud.FCount })); } return(Json(new { Erorr = ud.Erorr })); } catch (Exception e)// handling runtime errors and returning error as Json { return(Json(new { Erorr = e.Message })); } }
public ActionResult Create(UserDemographics obj) { try { using (RentMyWroxContext context = new RentMyWroxContext()) { var ids = Request.Form.GetValues("HobbyIds"); obj.Hobbies = context.Hobbies .Where(x => ids.Contains(x.Id.ToString())).ToList(); context.UserDemographics.Add(obj); context.SaveChanges(); return(RedirectToAction("Index")); } } catch { return(View()); } }
public PatientDetails(string hipCode, UserDemographics patient) { Code = hipCode; UserDemographics = patient; }
// GET: UserDemographics/Edit/5 public ActionResult Edit(int id) { var model = new UserDemographics(); return(View("Manage", model)); }
public PatientDetails(string code, UserDemographics userDemo) { Code = code; UserDemographics = userDemo; }