Example #1
0
		private async void insertItem(ProjectDetails item){
			//CurrentPlatform.Init();
			try{
				await MobileService.GetTable<ProjectDetails>().InsertAsync(item);

			}catch (Exception e){
				DisplayAlert ("ERROR", e.ToString(), "Done");
			}
		}
Example #2
0
        /** Create a news post grid layout
         * 	Post: Grid - the news post grid layout
        **/
        public Grid createNewsPost(ProjectDetails project)
        {
            string infoText = project.Information;
            string footerText = project.HasTags;

            // Create the grid
            Grid grid = createFeedGridMain ();
            grid.Padding = new Thickness (10);

            // Create the labels
            Label info = createFeedLabel (infoText, 14);
            Label tagFooter = createFeedLabel (footerText, 12);
            tagFooter.VerticalOptions = LayoutOptions.EndAndExpand;

            // Add children
            grid.Children.Add (createInnerGrid(project.FirstName + " " + project.LastName, project.TimeStamp),0, 2, 0, 1);
            grid.Children.Add (info, 0, 2, 1, 2);
            grid.Children.Add (tagFooter, 0, 1, 2, 3);

            return grid;
        }
Example #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");}
		}