protected void loadProject(long projectid) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectid); project_title.Text = project.PROJECT_TITLE; contact_name.Text = project.CONTACT_NAME; contact_num.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; allocated_slots.Text = project.RECOMMENDED_SIZE.ToString(); //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications IList<ProjectApplication> pendingApplications = new List<ProjectApplication>(); foreach (ProjectApplication application in project.APPLICATIONS) { if (application.APPLICATION_STATUS == APPLICATION_STATUS.PENDING) pendingApplications.Add(application); } num_applications.Text = pendingApplications.Count.ToString(); Session["applications"] = pendingApplications; project_application_list.DataSource = Session["applications"]; project_application_list.DataBind(); category_list.DataSource = categories; category_list.DataBind(); //enable Apply button apply_button.Enabled = true; //If project has already been assigned, show a disabled overlay and the project members ProjectAssignment projectAssignment = null; if (project.ASSIGNED_TEAMS != null && project.ASSIGNED_TEAMS.Count > 0) projectAssignment = project.ASSIGNED_TEAMS.First(); //Because it is many-to-many, we use only the first result and assume that it will always have 1 team if (projectAssignment != null) { assigned_project_panel.Visible = true; IList<Student> projectMembers = new List<Student>(); Team assignedTeam = projectAssignment.TEAM; foreach (TeamAssignment assignment in assignedTeam.TEAM_ASSIGNMENT) { Student member = assignment.STUDENT; projectMembers.Add(member); } assigned_project_members.DataSource = projectMembers; assigned_project_members.DataBind(); apply_button.Enabled = false; } else { assigned_project_panel.Visible = false; } //get project documents FileModule fileModule = new FileModule(); ProjectDocument projectDocument = fileModule.getProjectDocumentByProjectId(project.PROJECT_ID); if (projectDocument != null) { project_document_link.NavigateUrl = "#"; string escapedPath = projectDocument.PROJECTFILE_PATH.Replace("\\","/"); project_document_link.Attributes.Add("onclick", "window.open(\"../../" + escapedPath + "\",\"_blank\",\"menubar=no,height=600,width=800\");"); project_document.Text = projectDocument.PROJECTFILE_NAME; project_document.Visible = true; } else { project_document_link.Attributes.Clear(); project_document.Visible = false; } }
protected void approve_project(object sender, EventArgs e) { long convertedProjectid; ProjectModule projectModule = new ProjectModule(); try { if (!Int64.TryParse(project_id.Value, out convertedProjectid)) throw new Exception("Cannot find project ID, please contact administrator."); Project project = projectModule.getProjectById(convertedProjectid); //set all inputted variables into the Project object //Only set fields that could be changed in the frontend screen project.PROJECT_TITLE = project_title.Text; project.CONTACT_NAME = contact_name.Text; project.CONTACT_NUMBER = contact_number.Text; project.CONTACT_EMAIL = contact_email.Text; project.PROJECT_REQUIREMENTS = project_requirements.Text; project.UC_REMARKS = uc_comments.Text; int convertedAllocatedSize; if (!Int32.TryParse(allocated_size.Text, out convertedAllocatedSize)) throw new Exception("Invalid allocated size entered"); project.ALLOCATED_SIZE = convertedAllocatedSize; int convertedRecommendedSize; if (!Int32.TryParse(allocated_size.Text, out convertedRecommendedSize)) throw new Exception("Invalid recommended size entered"); project.RECOMMENDED_SIZE = convertedRecommendedSize; long convertedUCId; if (!Int64.TryParse(Session["userid"].ToString(), out convertedUCId)) throw new Exception("Cannot find user ID, please contact administrator."); projectModule.approveProject(project, convertedUCId); //Success Messenger.setMessage(approve_project_message, "Project is approved! An email notification has been sent to the project owner.", LEVEL.SUCCESS); okButton.Visible = true; proceedButton.Visible = false; } catch (EmailSendException esex) { Messenger.setMessage(approve_project_message, "Project is approved but email is not sent successfully: "+esex.Message, LEVEL.WARNING); okButton.Visible = true; proceedButton.Visible = false; } catch (Exception ex) { Messenger.setMessage(approve_project_message, ex.Message, LEVEL.DANGER); proceedButton.Visible = true; okButton.Visible = false; } finally { approve_project_popup.Show(); //project_details_panel.Update(); approve_button_panel.Update(); } }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; recommended_size.Text = project.RECOMMENDED_SIZE.ToString(); allocated_size.Text = project.ALLOCATED_SIZE.ToString(); //already set to the same value as recommended size //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications category_list.DataSource = categories; category_list.DataBind(); //enable Apply button approve_button.Enabled = true; reject_button.Enabled = true; }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; allocated_slots.Text = project.RECOMMENDED_SIZE.ToString(); //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications (only pending) IList<ProjectApplication> pendingApplications = new List<ProjectApplication>(); foreach (ProjectApplication application in project.APPLICATIONS) { if (application.APPLICATION_STATUS == APPLICATION_STATUS.PENDING) pendingApplications.Add(application); } num_applications.Text = pendingApplications.Count.ToString(); Session["applications"] = pendingApplications; project_application_list.DataSource = Session["applications"]; project_application_list.DataBind(); category_list.DataSource = categories; category_list.DataBind(); //enable Apply button assign_button.Enabled = true; //If project has already been assigned, show a disabled overlay and the project members ProjectAssignment projectAssignment = null; //Clear all selected applications from other projects selected_applications.Value = ""; if(project.ASSIGNED_TEAMS != null && project.ASSIGNED_TEAMS.Count > 0) projectAssignment = project.ASSIGNED_TEAMS.First(); //Because it is many-to-many, we use only the first result and assume that it will always have 1 team if (projectAssignment != null) { assigned_project_panel.Visible = true; IList<Student> projectMembers = new List<Student>(); Team assignedTeam = projectAssignment.TEAM; foreach (TeamAssignment assignment in assignedTeam.TEAM_ASSIGNMENT) { Student member = assignment.STUDENT; projectMembers.Add(member); } assigned_project_members.DataSource = projectMembers; assigned_project_members.DataBind(); assign_button.Enabled = false; } else { assigned_project_panel.Visible = false; } }