void GetCurrentProject() { int projectIdFromQueryString; if (Request.QueryString["ProjectId"] != null && Int32.TryParse((string)Request.QueryString["ProjectId"], out projectIdFromQueryString)) { CurrentProject = Project.GetProjectById(projectIdFromQueryString); } }
public abstract bool UpdateProject(Project projectToUpdate);
protected void SaveButton_Click(object obj, EventArgs args) { if (Page.IsValid == false) return; Project newProject; if (CurrentProject != null) { newProject = Project.GetProjectById(CurrentProject.Id); } else newProject = new Project(Page.User.Identity.Name, Page.User.Identity.Name, ProjectName.Text); newProject.Name = ProjectName.Text; newProject.CompletionDate = Convert.ToDateTime(CompletionDate.Text); newProject.Description = Description.Text; newProject.EstimateDuration = Convert.ToDecimal(Duration.Text); newProject.ManagerUserName = Managers.SelectedItem.Value; if (!newProject.Save()) { ErrorMessage.Text = "There was an error. Please fix it and try it again."; } UpdateProjectMembers(newProject.Id); string strUrl = "Project_Details.aspx?ProjectId=" + newProject.Id.ToString(); Response.Redirect(strUrl); }
public abstract int CreateNewProject(Project newProject);