// Submit Button was pressed for either a new project or rename a project protected void SubmitProjectButton_Click(object sender, EventArgs e) { using (SliceOfPieClient.Service.SliceOfPieServiceClient serv = new SliceOfPieClient.Service.SliceOfPieServiceClient()) { if (activeProject != null) { //rename project if (SubmitProjectButton.Text.CompareTo("Submit") == 0) { activeProject.Title = NewProjectNameBox.Text; serv.SaveProjectOnServer(activeProject, WelcomeForm.active); UpdateProjects(); UpdateTreeView(activeProject.Id); DynamicPanelInvisible(); DynamicProjectPanelInvisible(); } //Create new Project else if (SubmitProjectButton.Text.CompareTo("Enter") == 0) { // Empty list for the users the document is shared with List <User> l = new List <User>(); Project p = new Project(NewProjectNameBox.Text, WelcomeForm.active, l); serv.SaveProjectOnServer(p, WelcomeForm.active); } // Rename a single document else if (SubmitProjectButton.Text.CompareTo("Rename") == 0) { activeDoc.Title = NewProjectNameBox.Text; serv.SaveDocumentOnServer(activeProject, activeDoc, WelcomeForm.active); UpdateProjects(); UpdateTreeView(activeProject.Id); DynamicPanelInvisible(); DynamicProjectPanelInvisible(); } // Everything turns invisble again and the view is updated UpdateProjects(); TreeView1.ExpandAll(); } } DynamicPanelInvisible(); DynamicProjectPanelInvisible(); }
// The user submitted a username to share the project with protected void SubmitUserButton_Click(object sender, EventArgs e) { using (SliceOfPieClient.Service.SliceOfPieServiceClient serv = new SliceOfPieClient.Service.SliceOfPieServiceClient()) { if (activeProject != null) { // creates a new user and adds it to the activeProject and calls the UpdateProject method User u = new User(UserNameBox.Text); activeProject.SharedWith.Add(u); serv.SaveProjectOnServer(activeProject, WelcomeForm.active); } DynamicPanelInvisible(); DynamicProjectPanelInvisible(); } }