Пример #1
0
		public Home ()
		{
			var database = new ProjectDetailsDatabase ();
			//((App)Application.Current).UserEmail - use this for email thats logged in
			//DisplayAlert ("Trial", "The user logged in is:" + ,  "Ok");
			StartUp ();
		}
Пример #2
0
        public Project(int ID)
        {
            InitializeComponent ();
            var projectDetailsTable = new ProjectDetailsDatabase ();
            ProjectDetails pd = projectDetailsTable.GetItemWithId (ID);

            this.BindingContext = pd;
            DisplayAlert (pd.Title, pd.Information, pd.FirstName);
            this.SetBinding (TitleProperty, "Title");
        }
Пример #3
0
		public void setupDatabaseFeed(){
			var database = new ProjectDetailsDatabase ();
			var databaseItems = sortByTags ();
		
			int current = NewsCounter;
			// TODO add more posts on scroll down, havent figured out how to do the scrolled event thing yet.
			foreach (ProjectDetails item in databaseItems) {
				if (current+9 >= NewsCounter) {
					NewsCounter++;

					Grid g = post.createNewsPost (item);
					g.Children.Add (readMoreButton(item.id), 1, 2, 2, 3);

					NewsSection.Children.Add (g);
				} else {
					break;
				}
			}
		}
Пример #4
0
		public List<ProjectDetails> sortByTags(){
			var database = new ProjectDetailsDatabase ();
			List<string> tags = new List<string> ();

			foreach (string tagName in tlist.tagChecked.Keys) {
				bool isChecked;
				tlist.tagChecked.TryGetValue (tagName, out isChecked);
				if(isChecked){
					tags.Add (tagName);
				}
			}

			// If tags are selected then get items that contain at least one tag else get all items
			if (tags.Count > 0) {
				return database.GetItemsWithTags (tags).OrderByDescending (x => x.TimeStamp).ToList();;
			} else {
				return database.GetItems ().OrderByDescending (x => x.TimeStamp).ToList();
			}
		}
Пример #5
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");}
		}