protected void ProjectView(Project p) { Company c = CompanyUtil.GetCompany(p.CompanyId); List <User> users = UserUtil.GetUsersByCompany(c.CompanyId); projectNode += "<h2><a href='Projects.aspx'>Projects</a> > " + p.Name + "</h2><div id=\"project-top-div\"><div class=\"project-info\"><div id=\"project-top\"><div class=\"project-item\">"; projectNode += "<i class=\"huge circular building icon\"></i><h3>" + c.CompanyName + "</h3></div><div class=\"project-item\">"; projectNode += "<i class=\"huge circular user icon\"></i><h3>" + UserUtil.GetCoach(p.CoachId).FullName + "</h3></div>"; projectNode += "<div class=\"project-item\"><i class=\"huge circular money icon\"></i>"; projectNode += "<h3>Funding Source</h3></div></div></div>"; projectNode += "<div id=\"more-project-info\"><div class=\"ui accordion\"><div class=\"title\"><i class=\"dropdown icon\"></i>Company Contact"; projectNode += "</div><div class=\"content\">"; foreach (User i in users) { projectNode += "<p>" + i.FullName + " | " + i.Email + "</p><br>"; } projectNode += "</div></div><div class=\"ui accordion\"><div class=\"title\"><i class=\"dropdown icon\"></i>Project Notes</div>"; projectNode += "<div class=\"content\"><p class=\"transition hidden\">" + p.Notes + "</p></div></div></div></div></div>"; projectNode += "<script>$('.ui.accordion').accordion();</script>"; projectNode += "<div class=\"wrapper\"><ol class=\"ProgressBar\">"; try { foreach (WorkflowComponent com in WorkflowComponentUtil.GetWorkflowComponents(p.WorkflowId)) { Form form = FormUtil.GetProjectFormByTemplate(com.FormID, p.ProjectId); projectNode += "<li class=\"ProgressBar-step\" id=\"li" + com.WFComponentID + "\">"; projectNode += "<svg class=\"ProgressBar-icon\"></svg><a href='Forms.aspx?pfid=" + form.FormId + "'><span class=\"ProgressBar-stepLabel\">" + com.ComponentTitle + "</a></span>"; projectNode += "<div class=\"li-dropdown\" id=\"li-drop" + com.WFComponentID + "\">"; projectNode += "<div class=\"workflow-form\"><i class=\"big inbox icon\"></i><h3>" + form.FormName + "</h3></div></div></li>"; } } catch (Exception e) { } projectNode += "</ol></div>"; projectViewer.InnerHtml += projectNode; }
protected void MakeUserTable() { List <User> users = UserUtil.GetUsers(); UserTable.InnerHtml = ""; var userTable = ""; userTable += "<table class=\"ui orange table\"><thead><tr><th>Name</th><th>Email</th><th>Company</th><th>Role</th></tr></thead>"; userTable += "<tbody>"; foreach (User user in users) { if (user.UserId != -1 && user.UserId != -2) { Company company = CompanyUtil.GetCompany(user.CompanyId); Role role = RoleUtil.GetRole(user.RoleId); userTable += "<tr onclick=\"EditUser('" + user.FirstName + "','" + user.LastName + "','" + role.RoleName + "'," + role.RoleId + "," + user.UserId + ")\">" + "<td>" + user.FullName + "</td><td>" + user.Email + "</td><td>" + company.CompanyName + "</td><td>" + role.RoleName + "</td></tr>"; } } userTable += "</tbody></table>"; UserTable.InnerHtml += userTable; }
protected void ProjectFileDownloader_Click(object sender, EventArgs e) { if (Request.QueryString["pid"] != null) { int projId = int.Parse(Request.QueryString["pid"]); Project p = ProjectUtil.GetProject(projId); Company c = CompanyUtil.GetCompany(p.CompanyId); WorkflowModel w = WorkflowUtil.GetWorkflow(p.WorkflowId); List <WorkflowComponent> workflowComponents = WorkflowComponentUtil.GetWorkflowComponents(w.WorkflowId); string zipPath = String.Format("{0} - {1} - {2}.zip", w.WorkflowName, p.Name, CompanyUtil.GetCompanyName(p.CompanyId)); //delete the zip if it exists if (File.Exists(zipPath)) { File.Delete(zipPath); } using (ZipArchive zip = ZipFile.Open(zipPath, ZipArchiveMode.Create)) { //for each form get the file foreach (WorkflowComponent wc in workflowComponents) { Form f = FormUtil.GetProjectFormByTemplate(wc.FormID, projId); if (f.FilePath.Length > 0) { string fileType = f.FilePath.Split('.')[1]; string fileName = string.Format("{0} {1} Attachment.{2}", CompanyUtil.GetCompanyName(p.CompanyId), f.FormName, fileType); zip.CreateEntryFromFile(f.FilePath, fileName); } string pdfName = string.Format("{0} - {1} - {2}.pdf", w.WorkflowName, f.FormName, c.CompanyName); string pdfPath = string.Format("./PDFGen/{0}", pdfName); zip.CreateEntryFromFile(pdfPath, pdfName); } } SendFile(zipPath); } }