public void ShowCompletedStep3(PersonalProfile personalProfile) { TraceLicenseItem.CertItem = personalProfile.Certs[1]; if (TraceLicenseItem.CertItem.Document != null) { if (TraceLicenseItem.CertItem.Document.Media == null && IsUploadingTradePhoto == false && TraceLicenseItem.CertItem.Document.LocalMedia != null) { var cancelToken = new CancellationTokenSource(); var bitmapImage = View.GetByteImage(TraceLicenseItem.CertItem.Document.LocalMedia); var imageName = Guid.NewGuid().ToString() + ".jpeg"; var taskUpload = System.Threading.Tasks.Task.Run(async() => { var urlResponse = await Mvx.Resolve <IAzureService>().Upload(bitmapImage, imageName); TraceLicenseItem.CertItem.Document.Media = urlResponse.Replace("/ShopItstore", string.Empty);; TraceLicenseItem.CertItem.Document.MediaCreated = DateTime.Now; IsUploadingTradePhoto = false; }, cancelToken.Token); IsUploadingTradePhoto = true; Mvx.Resolve <ITaskManagementService>().AddTask(taskUpload, cancelToken); } } }
public TestState() { Mock <IGetPersonalProfileDependencies> dependencies = new Mock <IGetPersonalProfileDependencies>(); Mock <IHttpContextAccessor> httpContextAccessor = new Mock <IHttpContextAccessor>(); Mock <IHeaderDictionary> headerDictionary = new Mock <IHeaderDictionary>(); httpContextAccessor.Setup(a => a.HttpContext.Request.Headers) .Returns(headerDictionary.Object); IDataProtectionProvider provider = new EphemeralDataProtectionProvider(); _protector = provider.CreateProtector("PersonalProfile.Protector"); dependencies.Setup(a => a.GetUserId(Username)) .Returns(Task.FromResult(UserIdEntity.Create(Username, UserId))); dependencies.Setup(a => a.GetPersonalProfile(UserId)) .Returns(Task.FromResult(GetPersonalProfileEntity(UserId))); dependencies.Setup(a => a.GetSkills(UserId)) .Returns(Task.FromResult(GetSkills(UserId))); dependencies.Setup(a => a.GetInterests(UserId)) .Returns(Task.FromResult(GetInterests(UserId))); _dependencies = dependencies; Subject = new PersonalProfile(_dependencies.Object, provider, httpContextAccessor.Object); }
public ActionResult DeleteConfirmed(string id) { PersonalProfile PersonalProfiles = db.Profile.Find(id); db.Profile.Remove(PersonalProfiles); db.SaveChanges(); return(RedirectToAction("Index")); }
// constructors public PersonalSkill(Skill skill, SkillLevel currentSkillLevel, PersonalProfile profile) : base() { Skill = skill ?? throw new ArgumentNullException(nameof(skill)); SkillLevel = currentSkillLevel; Profile = profile ?? throw new ArgumentNullException(nameof(profile)); }
public async Task <APIResponse <string> > CreatePersonalProfile(PersonalProfile personalProfile) { var url = ApiUrls.PersonalProfile.SetQueryParams(new { userKey = mUserData.UserKey, }); var data = await HandleForPOST <string>(url, personalProfile); return(data); }
public void ShouldCreateInstance() { // arrange var employee = new Employee(101, "John Doe"); // act var result = new PersonalProfile(employee); // assert Assert.Equal(employee, result.Employee); Assert.NotNull(result.Skills); }
public ActionResult Create([Bind(Include = "ProfileID,AboutMe,TagLine")] PersonalProfile PersonalProfiles) { if (ModelState.IsValid) { db.Profile.Add(PersonalProfiles); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProfileID = new SelectList(db.Users, "Id", "DisplayName", PersonalProfiles.ProfileID); return(View(PersonalProfiles)); }
// GET: PersonalProfiles/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonalProfile PersonalProfiles = db.Profile.Find(id); if (PersonalProfiles == null) { return(HttpNotFound()); } return(View(PersonalProfiles)); }
public void ShowCompletedStep1(PersonalProfile personalProfile) { FirstName = personalProfile.FirstName; LastName = personalProfile.LastName; DOB = personalProfile.DOB; MobileNumber = personalProfile.Mobile; UnitNumber = personalProfile.BulidingNo; StreetName = personalProfile.Street; PostCode = personalProfile.PostCode; State = personalProfile.State; NOK = personalProfile.NOK; NOKPhone = personalProfile.NOKPhone; DOBText = personalProfile.DOB.ToString().Split(' ')[0]; }
public IActionResult Post([FromBody] PersonalProfile profile) { try{ int id = _profileservice.SavePersonalPrfile(profile); if (id == -1) { return(StatusCode(500, "An error ocuured in creating profile profile")); } return(Ok(id)); } catch (Exception ex) { return(StatusCode(500, ex.ToString())); } }
public void UpdateStudentGroup(PersonalProfile student) { var tempStudent = _context.PersonalProfiles .Where( s => s.IsLanguageInstructor == false && s.PersonalProfileId == student.PersonalProfileId ).SingleOrDefault(); tempStudent.StudentsGroupId = student.StudentsGroupId; tempStudent.StudentsGroup = _context.StudentsGroup .Where(x => x.StudentsGroupId == student.StudentsGroupId) .SingleOrDefault(); _context.PersonalProfiles.Update(tempStudent); _context.SaveChanges(); }
public void Update(PersonalProfile profile) { var localStoredProfile = _context.PersonalProfiles .Where(x => x.LoginName == profile.LoginName) .SingleOrDefault(); //if (localStoredProfile == null) //{ // _context.Add(profile); //} /*else*/ if (!string.IsNullOrWhiteSpace(profile.LoginName)) { _context.Entry(localStoredProfile).CurrentValues.SetValues(profile); _context.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "ProfileID,AboutMe,TagLine")] PersonalProfile PersonalProfiles, IndexViewModel ProfileID) { //var ProfileID = Request["ProfileID"]; //var AboutMe = Request["About Me"]; //var TagLine = Request["TagLine"]; //return RedirectToAction(ProfileID); if (ModelState.IsValid) { db.Entry(PersonalProfiles).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProfileID = new SelectList(db.Users, "ProfileID", "DisplayName", PersonalProfiles.ProfileID); return(View(PersonalProfiles)); }
// GET: PersonalProfiles/Edit/5 public ActionResult Edit(string id, string ProfileID) { //var ProfileID = Request.QueryString["id"]; //return View(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonalProfile PersonalProfiles = db.Profile.Find(id); if (PersonalProfiles == null) { return(HttpNotFound()); } ViewBag.ProfileID = new SelectList(db.Users, "ProfileID", "DisplayName", PersonalProfiles.ProfileID); return(View(PersonalProfiles)); }
public async Task <ActionResult> Create(PersonalProfileModel personalProfileModel) { // TODO: Country is invalid if (ModelState.IsValid) { var country = CountryArrays.Names[int.Parse(personalProfileModel.CountryIndex)]; var countryCode = CountryArrays.Abbreviations[int.Parse(personalProfileModel.CountryIndex)]; var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); /// Maps the personal profile model to the viewmodel, might add DTO's in the future PersonalProfile personalProfile = _mapper.Map <PersonalProfile>(personalProfileModel); personalProfile.Country = country; personalProfile.CountryCode = countryCode; personalProfile.ContextId = userId; personalProfile.Id = Guid.NewGuid().ToString(); personalProfile.DateUpdated = DateTime.Now; personalProfile.DateCreated = DateTime.Now; /*PersonalProfile personalProfile = new PersonalProfile * { * Id = * ContextId = userId, * DateCreated = DateTime.Now, * DateUpdated = DateTime.Now, * FirstName = personalProfileModel.FirstName, * LastName = personalProfileModel.LastName, * PhoneNumber = personalProfileModel.PhoneNumber, * EmailAddress = personalProfileModel.EmailAddress, * Address = personalProfileModel.Address, * Country = country, * CountryCode = countryCode, * City = personalProfileModel.City, * State = personalProfileModel.State, * PostalCode = personalProfileModel.PostalCode, * Links = personalProfileModel.Links * };*/ await _personalProfileService.AddAsync(personalProfile); } return(RedirectToAction(nameof(Index))); }
public TestState() { Mock <IGetPersonalProfileDependencies> dependencies = new Mock <IGetPersonalProfileDependencies>(); dependencies.Setup(a => a.GetUserId(Username)) .Returns(Task.FromResult(UserIdEntity.Create(Username, UserId))); dependencies.Setup(a => a.GetPersonalProfile(UserId)) .Returns(Task.FromResult(GetPersonalProfileEntity(UserId))); dependencies.Setup(a => a.GetSkills(UserId)) .Returns(Task.FromResult(GetSkills(UserId))); dependencies.Setup(a => a.GetInterests(UserId)) .Returns(Task.FromResult(GetInterests(UserId))); _dependencies = dependencies; Subject = new PersonalProfile(_dependencies.Object); }
public IActionResult Get(string loginName) { var profile = _context.PersonalProfiles .Where(x => x.LoginName == loginName) .SingleOrDefault(); if (profile == null && !string.IsNullOrWhiteSpace(loginName)) { PersonalProfile newProfile = new PersonalProfile() { FirstName = "", SecondName = "", IsLanguageInstructor = User.IsInRole("LanguageInstructor"), LoginName = loginName, Email = loginName, Telephone = "" }; _context.Add(newProfile); _context.SaveChanges(); return(Json(newProfile)); } return(Json(profile)); }
private void btnSave_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to save this details?", "Save Applicant Information?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { List <PersonalProfile> PersonalProfile = new List <PersonalProfile>(); PersonalProfile pp = new PersonalProfile(); pp.applicationDate = dtApplicationDate.Value; pp.applicationStatus = int.Parse(cf.GetComboID(cmbApplicantStatus).ToString()); pp.applicationType = int.Parse(cf.GetComboID(cmbApplicationType).ToString()); pp.Lastname = tbLastName.Text; pp.Firstname = tbFirstName.Text; pp.Middlename = tbMiddleName.Text; pp.suffix = int.Parse(cf.GetComboID(cmbSuffix).ToString()); pp.EmailAddress = tbEmailAddress.Text; pp.CivilStaus = int.Parse(cf.GetComboID(cmbCivilStatus).ToString()); pp.Gender = int.Parse(cf.GetComboID(cmbGender).ToString()); pp.Nationality = int.Parse(cf.GetComboID(cmbNationality).ToString()); pp.BirthDate = dtpBirthday.Value; pp.BirthPlace = tbBirthPlace.Text; pp.MobileNumber1 = tbMobilePhone1.Text; pp.MobileNumber2 = tbMobilePhone2.Text; pp.MobileNumber3 = tbMobilePhone3.Text; pp.PhoneNumber = tbPhoneNumber.Text; pp.Religion = int.Parse(cf.GetComboID(cmbReligion).ToString()); pp.Height = tbHeight.Text; pp.Weight = tbWeight.Text; pp.BloodType = int.Parse(cf.GetComboID(cmbBloodType).ToString()); pp.Marriage_Date = dtpMarriageDate.Value; pp.Marriage_Place = tbMarriagePlace.Text; pp.Present_Address_brgy = tbPreAdd_Brgy.Text; pp.Present_Address_city = tbPreAdd_City.Text; pp.Present_Address_street = tbPreAdd_Street.Text; pp.Present_Address_postal = tbPreAdd_Postal.Text; pp.Permanent_Address_brgy = tbPerAdd_Brgy.Text; pp.Permanent_Address_city = tbPerAdd_City.Text; pp.Permanent_Address_street = tbPerAdd_Street.Text; pp.Permanent_Address_postal = tbPerAdd_Postal.Text; pp.PhoneNumber = tbPhoneNumber.Text; PersonalProfile.Add(pp); if (PersonalProfile.Count > 0) { if (tbLastName.Text == string.Empty || tbFirstName.Text == string.Empty || tb_ID.Text == "0") { MessageBox.Show("Error: Cannot save information. Please check your entry", "Save Applicant Information Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!cf.checkID(int.Parse(tb_ID.Text))) { if (!cf.SaveApplicant(PersonalProfile, "Add")) { MessageBox.Show("Error: Cannot save information. Please check your entry", "Save Applicant Information Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Application Information successfully Saved.", "Done Save information", MessageBoxButtons.OK, MessageBoxIcon.Information); cf.frm = this; cf.ControlObjects(false, groupBox2); LoadAllCombos(); BtnEntry(false); ClearTextbox(); } } else { if (!cf.SaveApplicant(PersonalProfile, "Edit")) { MessageBox.Show("Error: Cannot save information. Please check your entry", "Save Applicant Information Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Application Information successfully Saved.", "Done Save information", MessageBoxButtons.OK, MessageBoxIcon.Information); cf.frm = this; cf.ControlObjects(false, groupBox2); LoadAllCombos(); BtnEntry(false); ClearTextbox(); } } } } }
private async void ShowNext() { try { View.HideKeyboard(); if (CurrentPage < 5) { CurrentPage += 1; } var personalProfileTemp = DataHelper.RetrieveFromUserPref <PersonalProfile>("PERSONAL_STEP"); if (personalProfileTemp != null) { mPersonalProfileLocal = personalProfileTemp; } if (CurrentPage == 2) { mPersonalProfileLocal.FirstName = FirstName; mPersonalProfileLocal.LastName = LastName; mPersonalProfileLocal.DOB = DOB; mPersonalProfileLocal.Mobile = MobileNumber; mPersonalProfileLocal.BulidingNo = UnitNumber; mPersonalProfileLocal.Street = StreetName; mPersonalProfileLocal.PostCode = PostCode; mPersonalProfileLocal.State = State; mPersonalProfileLocal.NOK = NOK; mPersonalProfileLocal.NOKPhone = NOKPhone; PersonalProfileValidator validatorPersonalProfile = new PersonalProfileValidator(); var result = validatorPersonalProfile.Validate(mPersonalProfileLocal); if (!result.IsValid) { CurrentPage -= 1; var firstError = result.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } View.PanToPage(CurrentPage); HightlightStep(true, true, false, false); if (personalProfileTemp != null) { mPersonalProfileLocal.ProfileCompletionStep = personalProfileTemp.ProfileCompletionStep; } else { mPersonalProfileLocal.ProfileCompletionStep = ProfileCompletionStep.PPStep1; } } else if (CurrentPage == 3) { CertValidator validatorConstructionCard = new CertValidator(); var result = validatorConstructionCard.Validate(ConstructionCardItem); if (!result.IsValid) { CurrentPage -= 1; var firstError = result.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } View.PanToPage(CurrentPage); HightlightStep(true, true, true, false); if (personalProfileTemp != null) { if (personalProfileTemp.Certs.Count > 0) { mPersonalProfileLocal.ProfileCompletionStep = personalProfileTemp.ProfileCompletionStep; mPersonalProfileLocal.Certs[0] = ConstructionCardItem.CertItem; } else { mPersonalProfileLocal.ProfileCompletionStep = ProfileCompletionStep.PPStep2; mPersonalProfileLocal.Certs.Add(ConstructionCardItem.CertItem); } } else { mPersonalProfileLocal.ProfileCompletionStep = ProfileCompletionStep.PPStep2; mPersonalProfileLocal.Certs.Add(ConstructionCardItem.CertItem); } } else if (CurrentPage == 4) { CertValidator validatorTraceLicense = new CertValidator(); var result = validatorTraceLicense.Validate(TraceLicenseItem); if (!result.IsValid) { CurrentPage -= 1; var firstError = result.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } View.PanToPage(CurrentPage); HightlightStep(true, true, true, true); if (personalProfileTemp != null) { if (personalProfileTemp.Certs.Count > 1) { mPersonalProfileLocal.ProfileCompletionStep = personalProfileTemp.ProfileCompletionStep; mPersonalProfileLocal.Certs[1] = TraceLicenseItem.CertItem; } else { mPersonalProfileLocal.ProfileCompletionStep = ProfileCompletionStep.PPStep3; mPersonalProfileLocal.Certs.Add(TraceLicenseItem.CertItem); } } else { mPersonalProfileLocal.ProfileCompletionStep = ProfileCompletionStep.PPStep3; mPersonalProfileLocal.Certs.Add(TraceLicenseItem.CertItem); } } DataHelper.SaveToUserPref(mPersonalProfileLocal, "PERSONAL_STEP"); if (CurrentPage == 5) // Done button { CertValidator validatorIncomeInsuredCert = new CertValidator(); var result4 = validatorIncomeInsuredCert.Validate(IncomeInsured); if (!result4.IsValid) { var firstError = result4.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } CertValidator validatorFirstAidCert = new CertValidator(); var result5 = validatorFirstAidCert.Validate(FirstAidCertified); if (!result5.IsValid) { var firstError = result5.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } for (int i = 0; i < OperationalCerts.Count; i++) { CertValidator validatorOperationalCert = new CertValidator(); var result3 = validatorOperationalCert.Validate(OperationalCerts[i]); if (!result3.IsValid) { var firstError = result3.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); return; } } if (IsVerify == false) { mMessageboxService.ShowToast("Please verify this information is true"); View.ScrollToBottom(); return; } mPlatformService.ShowNetworkIndicator(); mProgressDialogService.ShowProgressDialog(); while (!Mvx.Resolve <ITaskManagementService>().IsAllTaskDone()) { int numOfImages = Mvx.Resolve <ITaskManagementService>().NumberOfTasksRunning(); if (numOfImages > 0) { string uploadStr = numOfImages + (numOfImages > 1 ? " images " : " image ") + "processing"; mProgressDialogService.ShowProgressDialog(uploadStr); } else { mProgressDialogService.ShowProgressDialog(""); } await Task.Delay(150); } Debug.WriteLine("upload all image is done"); if (Mvx.Resolve <ITaskManagementService>().IsAllTaskDone()) { UserProfile.PersonalProfile.FirstName = FirstName; UserProfile.PersonalProfile.LastName = LastName; UserProfile.PersonalProfile.DOB = DOB; UserProfile.PersonalProfile.Mobile = MobileNumber; UserProfile.PersonalProfile.BulidingNo = UnitNumber; UserProfile.PersonalProfile.Street = StreetName; UserProfile.PersonalProfile.State = State; UserProfile.PersonalProfile.NOK = NOK; UserProfile.PersonalProfile.NOKPhone = NOKPhone; UserProfile.PersonalProfile.PostCode = PostCode; if (IsTickFirstAid != true) { FirstAidCertified.CertItem.Document = null; FirstAidCertified.CertItem.Expiry = null; } if (IsTickIncomeInsured != true) { IncomeInsured.CertItem.Document = null; IncomeInsured.CertItem.Expiry = null; } UserProfile.PersonalProfile.Certs[0] = ConstructionCardItem.CertItem; UserProfile.PersonalProfile.Certs[1] = TraceLicenseItem.CertItem; UserProfile.PersonalProfile.Certs[2] = IncomeInsured.CertItem; UserProfile.PersonalProfile.Certs[3] = FirstAidCertified.CertItem; UserProfile.PersonalProfile.Certs[4] = GSTRegistered.CertItem; UserProfile.PersonalProfile.Certs[6] = PublicLiablityCert.CertItem; for (int k = 0; k < OperationalCerts.Count; k++) { UserProfile.PersonalProfile.Certs.Add(OperationalCerts[k].CertItem); } UserProfile.PersonalProfile.StatementAgree = DateTime.Now; UserProfile.PersonalProfile.ProfileCompletionStep = ProfileCompletionStep.PPComplete; var response = await mApiService.CreatePersonalProfile(UserProfile.PersonalProfile); mPlatformService.HideNetworkIndicator(); mProgressDialogService.HideProgressDialog(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { mCacheService.IsShowProfileView = true; Mvx.Resolve <ITrackingService>().SendEvent("Personal Profile completed"); View.ShowPopupFinish(); } else { RefreshListOperationalCert(); if (!string.IsNullOrEmpty(response.ErrorData)) { string errorData = response.ErrorData; ErrorLoginResponse err = JsonConvert.DeserializeObject <ErrorLoginResponse>(errorData); mMessageboxService.ShowToast(err.Description); } } } } } catch (Exception ex) { #if DEBUG RefreshListOperationalCert(); mMessageboxService.Show("Error", ex.Message); #endif } }
public PerfilPersonalController(PersonalProfile getPersonalProfile, PostPersonalProfile postPersonalProfile) { _getPersonalProfile = getPersonalProfile; _postPersonalProfile = postPersonalProfile; }
/// <summary> /// Add a personal profile to the current machine /// </summary> /// <param name="Profile">Profile to add.</param> public void Add(PersonalProfile Profile) { }
public int SavePersonalPrfile(PersonalProfile profile) { return(_repository.Create(profile)); }