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(); } }