private async Task PrepareNavigationToRegistrationPage(bool isVerification) { if (!isVerification) { VerificationCode = await _contactManager.SendVerificationCode(EmailAddress); IsVerification = (string.IsNullOrEmpty(VerificationCode)) ? false : true; IsVerificationNegation = !IsVerification; if (IsVerification) { TitleMessage = AppStrings.VerifiedEmailTitle; TitleContent = AppStrings.VerifiedEmailMsg; PlaceholderTitle = AppStrings.VerifiedEmailPlaceholder; } } else { Entity.Contact contact = new Entity.Contact { EmailAdd = ComputeEmailIfTest(EmailAddress), UserName = ComputeEmailIfTest(EmailAddress), GenderCode = "undisclosed", FirstName = "Undisclosed", LastName = "Name" }; PassingParameters.Add("CurrentContact", contact); NavigateToPageHelper(nameof(ViewNames.AccountRegistrationPage), _navigationStackService, _navigationService, PassingParameters); } }
public void TestCascadeInsert() { Entity.Applicant app = new Entity.Applicant(); app.FName = "Abebe"; app.LName = "Kebede"; Entity.Contact c = new Entity.Contact(); c.FName = "Aster"; c.LName = "Chala"; c.Address = new Entity.Address(); c.Address.Email = "*****@*****.**"; // app.Contacts.Add(c); UnitOfWork uw = new UnitOfWork(new Entity.K_12Entities()); //IApplicantService app_servie = new ApplicantService(uw.Applicants); // app_servie.Insert(app); uw.Contacts.Add(c); uw.Save(); //Entity.Applicant a2 = app_servie.Find(1); Assert.AreEqual(uw.Contacts.Find(c.ID).Address.Email, c.Address.Email); }
private void GetLogonDetailsFromRemoteDBResult(Entity.Contact clientFromRemote, bool isSuccess = true) { if (clientFromRemote != null && isSuccess) { string newPage = _keyValueCacheUtility.GetUserDefaultsKeyValue("NewPage"); _keyValueCacheUtility.RemoveKeyObject("NewPage"); _userManager.SaveNewDetails(clientFromRemote); _keyValueCacheUtility.GetUserDefaultsKeyValue("Username", clientFromRemote.UserName); _keyValueCacheUtility.GetUserDefaultsKeyValue("Password", clientFromRemote.Password); _keyValueCacheUtility.GetUserDefaultsKeyValue("WasLogin", "true"); _keyValueCacheUtility.GetUserDefaultsKeyValue("WasSignUpCompleted", "true"); _keyValueCacheUtility.GetUserDefaultsKeyValue("CurrentContactId", clientFromRemote.RemoteId.ToString()); if (string.IsNullOrEmpty(newPage)) { ChangeRootAndNavigateToPageHelper(nameof(ViewNames.HomePage), _navigationStackService, _navigationService, PassingParameters); } else { ChangeRootAndNavigateToPageHelper(newPage, _navigationStackService, _navigationService, PassingParameters); } } IsBusy = false; }
private void AddCacheKeys(Entity.Contact clientFromRemote) { _keyValueCacheUtility.GetUserDefaultsKeyValue("Username", clientFromRemote.UserName); _keyValueCacheUtility.GetUserDefaultsKeyValue("Password", clientFromRemote.Password); _keyValueCacheUtility.GetUserDefaultsKeyValue("WasLogin", "true"); _keyValueCacheUtility.GetUserDefaultsKeyValue("WasSignUpCompleted", "true"); _keyValueCacheUtility.GetUserDefaultsKeyValue("CurrentContactId", clientFromRemote.RemoteId.ToString()); }
private void SendAddEditToBackground(Entity.PostFeed postFeed, Entity.Contact contact) { PostFeedMessage postFeedMessage = new PostFeedMessage { CurrentPost = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.PostFeedK>(postFeed), CurrentUser = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.ContactK>(contact) }; MessagingCenter.Send(postFeedMessage, "AddUpdatePostFeedToHub"); //chito. added this for FAKE only because navigating to PostFeedPage after editing a post is called only after subscribing to messaging center coming from Native. AddUpdatePostFeedToHubFake(); }
private void SendAddEditToBackground(Entity.PostFeed postFeed, Entity.Contact contact) { PostFeedMessage postFeedMessage = new PostFeedMessage { CurrentPost = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.PostFeedK>(postFeed), CurrentUser = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.ContactK>(contact) }; //_eventAggregator.GetEvent<AddUpdatePostFeedToHubEventModel>().Publish(postFeedMessage); // 01-12-2018 12:06pm REYNZ: // added this for FAKE only because navigating to PostFeedPage after editing // a post is called only after subscribing to messaging center coming from // Native. AddUpdatePostFeedToHubFake(); }
public void TestRepository() { UnitOfWork uw = new UnitOfWork(new Entity.K_12Entities()); Entity.Contact c = new Entity.Contact(); c.FName = "Wende"; c.LName = "kebede"; uw.Contacts.Add(c); uw.Save(); Entity.Contact c2 = uw.Contacts.Find(c.ID); Assert.AreEqual(c.FName, c2.FName); }
public static void Add(Entity.Contact obj) { using (SqliteConnection db = new SqliteConnection(DataAccess.SQLite_Connection_String)) { db.Open(); SqliteCommand insertCommand = new SqliteCommand(); insertCommand.Connection = db; // Use parameterized query to prevent SQL injection attacks insertCommand.CommandText = "INSERT INTO Contacts VALUES (@phone, @email, @name);"; insertCommand.Parameters.AddWithValue("@phone", obj.phone); insertCommand.Parameters.AddWithValue("@email", obj.email); insertCommand.Parameters.AddWithValue("@name", obj.name); insertCommand.ExecuteReader(); db.Close(); } }
public void AddDeductOneLikeToThisPostFromLocal(Entity.PostFeed postFeed, Entity.Contact userWhoLiked) { var postToLike = _postFeedManager.GetPostFeed(postFeed.PostFeedID); if (userWhoLiked.RemoteId == CurrentContact.RemoteId) { postToLike.IsSelfSupported = !postToLike.IsSelfSupported; } var updatePostFeed = _postFeedManager.UpdatePostFeedAndPostFeedLikeToLocal(postToLike, userWhoLiked); if (postFeed.PostFeedLevel == 1) { SelectedComment = updatePostFeed; SelectedComment.NoOfSupports = updatePostFeed.NoOfSupports; } else { CurrentPostFeed = updatePostFeed; } }
private void SaveToDBAndNavigateToNextPage() { Debug.WriteLine("HOPEPH Saving receiver details from FB."); var newDetails = new Entity.Contact { Id = 0, EmailAdd = ComputeEmailIfTest(FacebookEmail), Password = "******", FirstName = FacebookFirstName, LastName = FacebookLastName, Birthdate = FacebookBirthday ?? "", FBLink = FacebookPhoto, GenderCode = FacebookGender, FBUserLink = FacebookLink, FBId = FacebookId, MobilePhone = FacebookMobileNumber, AliasName = FacebookAlias }; PassingParameters.Add("CurrentContact", newDetails); NavigateToPageHelper(nameof(ViewNames.AccountRegistrationPage), _navigationStackService, _navigationService, PassingParameters); }
private async Task NavigateSuccess(Entity.Contact clientFromRemote) { if (clientFromRemote != null) { string newPage = _keyValueCacheUtility.GetUserDefaultsKeyValue("NewPage"); _keyValueCacheUtility.RemoveKeyObject("NewPage"); _userManager.SaveNewDetails(clientFromRemote); RemoveCacheKeys(); AddCacheKeys(clientFromRemote); if (string.IsNullOrEmpty(newPage)) { await ChangeRootAndNavigateToPageHelper(nameof(MainTabbedPage) + AddPagesInTab()); } else { await ChangeRootAndNavigateToPageHelper(newPage); } } IsBusy = false; }
private void FacebookLogonCompletedFake() { var fakeEntry = AppUnityContainer.Instance.Resolve <ContactEntry>(); Entity.Contact fakeProfile = FakeData.FakeUsers.Contacts .Where(x => x.EmailAdd == fakeEntry.EmailAddress || x.MobilePhone == fakeEntry.MobilePhone).FirstOrDefault(); if (fakeProfile != null) { FacebookEmail = fakeProfile.EmailAdd; FacebookFirstName = fakeProfile.FirstName; FacebookLastName = fakeProfile.LastName; FacebookPhoto = fakeProfile.PhotoURL; FacebookBirthday = fakeProfile.Birthdate; FacebookGender = fakeProfile.GenderCode; FacebookId = fakeProfile.FBId; FacebookLink = fakeProfile.FBLink; FacebookMobileNumber = fakeProfile.MobilePhone; FacebookAlias = fakeProfile.AliasName; } else { FacebookEmail = fakeEntry.EmailAddress; FacebookFirstName = fakeEntry.FirstName; FacebookLastName = fakeEntry.LastName; FacebookPhoto = fakeEntry.PhotoURL; FacebookMobileNumber = fakeEntry.MobilePhone; } if (FromLogonPage) { GetLogonDetailsFromRemoteDBAsyncFake(); } else { SaveFacebookProfileAsyncFake(); } }
public void TestService() { UnitOfWork uw = new UnitOfWork(new Entity.K_12Entities()); IContactService cont_serv = new ContactService(uw.Contacts); Entity.Contact c = cont_serv.Find(2); Entity.Address a = new Entity.Address(); a.Email = "*****@*****.**"; c.Address = a; cont_serv.Update(c); uw.Save(); Entity.Contact c2 = cont_serv.Find(c.ID); Assert.AreEqual(c.Address.Email, c2.Address.Email); }
public StudentExtraInfoViewModel() { MedicationsList = new List <Entity.student_medication>(); MedicationsList.Add(new Entity.student_medication()); Languages = new HashSet <string>(); Contacts = new HashSet <Entity.Contact>(); Entity.Contact firstContact = new Entity.Contact(); firstContact.Address = new Entity.Address(); firstContact.Address.PhoneBooks.Add(new Entity.PhoneBook() { Type = "Mobile" }); firstContact.Address.PhoneBooks.Add(new Entity.PhoneBook() { Type = "Office" }); Contacts.Add(firstContact); }
public PostFeed UpdatePostFeedAndPostFeedLikeToLocal(Entity.PostFeed existingPostFeed, Entity.Contact userWhoLiked) { try { if (existingPostFeed.PosterId == int.Parse(_keyValueCachedUtility.GetUserDefaultsKeyValue("CurrentContactId"))) { existingPostFeed.IsSelfPosted = true; } var postFeedLikeInLocal = _postFeedRepository.GetPostFeedLikeByContactId(userWhoLiked.RemoteId, existingPostFeed.PostFeedID); existingPostFeed.NoOfSupports = (postFeedLikeInLocal == null) ? existingPostFeed.NoOfSupports + 1 : existingPostFeed.NoOfSupports - 1; if (postFeedLikeInLocal == null) { _postFeedRepository.UpdateItem(new PostFeedLike { ContactID = userWhoLiked.RemoteId, PostFeedID = existingPostFeed.PostFeedID }); } else { _postFeedRepository.DeleteTable(postFeedLikeInLocal); } _postFeedRepository.UpdateItem(existingPostFeed); _updatedPostFeedFromLocal = _postFeedRepository.GetPostFeedById(existingPostFeed.PostFeedID); // 01-11-2018 12:31pm REYNZ // since comments are not saved locally because sqlite cannot saved List, i explicitly added it before returning the updated post to the caller //existingPostFeed.Comments = postComments; _updatedPostFeedFromLocal.Comments = existingPostFeed.Comments; _updatedPostFeedFromLocal.NoOfSupports = existingPostFeed.NoOfSupports; return(_updatedPostFeedFromLocal); } catch (SQLite.SQLiteException) { return(_updatedPostFeedFromLocal); } }
public Task <int> SaveDetailsToRemoteDB(Entity.Contact item) { return(_userService.PostReceiver(item)); }
private void DeletePost(Entity.Contact posterContact, Entity.PostFeed currentPost) { currentPost.Poster = posterContact; viewModel.DeletePostFeedFromLocal(currentPost); }
private void UpdateAddPost(Entity.Contact posterContact, Entity.PostFeed currentPost) { currentPost.Poster = posterContact; currentPost.PosterProfilePhotoFB = currentPost.Poster.FBLink; viewModel.SavePostFeedToLocal(currentPost); }
public ActionResult ApplicationForm(Models.ApplicantBasicViewModel applicantData, string ButtonType) { // return PartialView("Confirmation", app); Entity.Applicant currentApplicant = GetApplicant(); if (ButtonType == "Reset") { var NewModel = new Models.ApplicantBasicViewModel(); ModelState.Clear(); return(View(NewModel)); } if (ButtonType == "Back") { Models.GradeViewModel grade = new Models.GradeViewModel(); grade.ID = SelectedGrade.ID; // grade.Grade = _unitOfWork.Grade_Infos.Find(grade.ID).Grade; return(View("GradeSelection", grade)); } if (ButtonType == "Next") { if (ModelState.IsValid) { currentApplicant.FName = applicantData.FName; //To-Do use automapper currentApplicant.MName = applicantData.MName; currentApplicant.LName = applicantData.LName; currentApplicant.DOB = applicantData.DOB; currentApplicant.Gender = applicantData.Gender; Entity.Address address = new Entity.Address(); address.Email = applicantData.Contact_Email; address.PhoneBooks.Add(new Entity.PhoneBook() { Type = "Mobile", Phone = applicantData.Contact_MobilePhone }); address.PhoneBooks.Add(new Entity.PhoneBook() { Type = "Office", Phone = applicantData.Contact_OfficePhone }); Entity.Contact contact = new Entity.Contact() { FName = applicantData.Contact_FName, MName = applicantData.Contact_MName, Address = address }; currentApplicant.Contacts.Add(contact); return(View("DocumentUpload", GetDocuments())); } } return(View()); }
private void submit_Click(object sender, RoutedEventArgs e) { if (((customId.Text == string.Empty) || (firstName.Text == string.Empty) || (lastName.Text == string.Empty) || (street.Text == string.Empty) || (city.Text == string.Empty) || (zip.Text == string.Empty) || (email.Text == string.Empty) || (name.Text == string.Empty) || (country.SelectedValue == null) || !this.marked) || (this.c != "FO" && (this.ico.Text == string.Empty || this.icDph.Text == string.Empty || this.dic.Text == string.Empty || this.name.Text == string.Empty))) { System.Windows.MessageBox.Show("Musia byť vyplnené poviné údaje"); return; } if ((customId.Text.Contains(";")) || (titlePrefix.Text.Contains(";")) || (firstName.Text.Contains(";")) || (lastName.Text.Contains(";")) || (titleSuffix.Text.Contains(";")) || (street.Text.Contains(";")) || (city.Text.Contains(";")) || (zip.Text.Contains(";")) || (email.Text.Contains(";")) || (name.Text.Contains(";")) || (mobile.Text.Contains(";")) || (ico.Text.Contains(";")) || (dic.Text.Contains(";")) || (icDph.Text.Contains(";"))) { System.Windows.MessageBox.Show("Znak ; je vyhradeni, prosím zmente vstup tak aby neobsahoval znak ; "); return; } Entity.Order order = new Entity.Order(); order.products = new List<Interface.IOrderItem>(); Entity.Company company = new Entity.Company(); company.custom_id = customId.Text.ToString(); Entity.Person person = new Entity.Person(); person.titlePrefix = titlePrefix.Text.ToString(); person.firstName = firstName.Text.ToString(); person.lastName = lastName.Text.ToString(); person.titleSuffix = titleSuffix.Text.ToString(); Entity.Address address = new Entity.Address(); address.street = street.Text.ToString(); address.city = city.Text.ToString(); address.zip = zip.Text.ToString(); address.country = country.Text.ToString() == "Vyberte krajinu" ? "SVK" : country.Text.ToString(); Entity.Contact contact = new Entity.Contact(); contact.email = email.Text.ToString(); contact.mobile = mobile.Text.ToString(); company.person = person; company.address = address; company.contact = contact; switch (this.c.ToUpper()) { case "PO": { company.corporatePerson = Interface.CorporatePerson.PO; break; } default: { company.corporatePerson = Interface.CorporatePerson.FO; break; } } if (this.c.ToUpper() != "FO") { company.name = name.Text.ToString(); company.ico = ico.Text.ToString(); company.dic = dic.Text.ToString(); company.icDph = icDph.Text.ToString(); } else company.name = company.person.getFullName(); //company.id = 1; //if (Settings.Config.getCompanies().Count > 0) // company.id = Settings.Config.getCompanies().LastOrDefault(x => x.id > 0).id + 1; //order.id = 1; //if (Settings.Config.getOrders().Count > 0) // order.id = Settings.Config.getOrders().LastOrDefault(x => x.id > 0).id + 1; order.company = company; //Settings.Config.getCompanies().Add(company); //Settings.Config.getOrders().Add(order); Settings.Config.setTempOrder(order); onCreatedOrder(new EventArgs()); }