Beispiel #1
0
		public async void loginBtnClicked(object sender, EventArgs e){
			var database = new PersonalDB ();
			//bool accepted = database.GetEmail (emailField.text);
			// if accepted {
			string email = emailField.Text;
			bool isEmail = database.IsEmail (email);
			//await DisplayAlert(email, isEmail.ToString(), "Done");
			if (isEmail) {
				((App)Application.Current).UserEmail = email;
				await Navigation.PushModalAsync (new SideNavi ());
			} else { 
				await DisplayAlert("Error", "Your email or password is not correct.", "Done"); 
			}
		}
		public async void SubmitReg (object sender, EventArgs e)
		{
			string fn = entryFirstName.Text;
			string ln = entryLastName.Text;
			string em = entryEmail.Text;
			string pw = "password";

			if (fn != "") {
				if (ln != "") {
					if (em != "") {
						PersonalDetails pd = new PersonalDetails (fn,ln,em);
						var database = new PersonalDB ();
						database.InsertOrUpdatePersonalDetails (pd);
						AddRegistration (em, pw);

						// navigate here
						((App)Application.Current).UserEmail = em;
						await Navigation.PushModalAsync (new SideNavi ());
					}
				}
			}
		}
Beispiel #3
0
		private void saveProject (){

			if (ProjectTitle != "") {
				if (Details != "") {
					if (Expertise != "") {
						string tags = "";
						// Add tags as string
						foreach (string tagName in tlist.tagChecked.Keys) {
							bool isChecked;
							tlist.tagChecked.TryGetValue (tagName, out isChecked);
							if(isChecked){
								if (tags != "") {
									tags += "|" + tagName;
								} else {
									tags = tagName;
								}
							}
						}
						// Get personal information 
						var personalInfo = new PersonalDB ();
						PersonalDetails pd = personalInfo.GetDetails (((App)Application.Current).UserEmail);

						// Create the project table
						ProjectDetails newProject = new ProjectDetails (pd.FirstName, pd.LastName, ProjectTitle, Details, Expertise, tags, ((App)Application.Current).UserEmail);
						var database = new ProjectDetailsDatabase ();
						database.InsertOrUpdateProject (newProject);

						//insertItem (newProject);

						var notificationTable = new NotificationsTable ();
						Notification notification = new Notification {
							PosterEmail = ((App)Application.Current).UserEmail,
							Poster = pd.FirstName + " " + pd.LastName,
							Title = ProjectTitle,
							HasRead = false,
							TimeStamp = DateTime.UtcNow,
							Type = "Project",
							Source = "unread.png",
							CompositePrimaryKey = ((App)Application.Current).UserEmail + ProjectTitle,
						};

						notificationTable.InsertOrUpdate (notification);
						DisplayAlert ("Created", "The project has been created", "Ok");
						switchPage (new Home ());
					} else {errorMsg("Expertise Wanted");}
				} else {errorMsg("Details");}
			} else {errorMsg("Title");}
		}