public void SendForgotPassword(string email, string forgotHash, string userFirstName) { try { UserAccessor ua = new UserAccessor(); int userId = ua.GetUserByEmail(email).id; string forgotLink = "http://vestn.com/#splash=changePassword&userId="+userId+"&resetHash=" + forgotHash; string messageBody = "Please click the link below to reset you password: \n" + forgotLink; string greeting = userFirstName + ","; SendEmail(email, "Reset Password", greeting, messageBody); } catch (Exception ex) { logAccessor.CreateLog(DateTime.Now, "Communicaiton Manager - SendForgotPassword", ex.StackTrace); } }
public List<JsonModels.ProjectShell> GetProjectShells(int ID) { try { UserAccessor userAccessor = new UserAccessor(); List<Project> projects = reorderEngine.ReOrderProjects(userAccessor.GetUser(ID)).projects; List<JsonModels.ProjectShell> shells = new List<JsonModels.ProjectShell>(); foreach (Project p in projects) { if (p.isActive == true && p.name != "About") { JsonModels.ProjectShell ps = new JsonModels.ProjectShell(); ps.id = p.id; if (p.name != null) { ps.name = p.name; } if (p.description != null) { ps.description = p.description; } if (p.tagIds != "" && p.tagIds != null) { ps.projectTags = GetProjectTags(p.id); } if (p.coverPicture != null) { ps.coverPicture = p.coverPicture; } if (p.coverPictureThumbnail != null) { ps.coverPictureThumbnail = p.coverPictureThumbnail; } List<JsonModels.ArtifactShell> artifactShells = new List<JsonModels.ArtifactShell>(); foreach (ProjectElement pe in p.projectElements) { if (pe == null) { continue; } JsonModels.ArtifactShell aShell = new JsonModels.ArtifactShell(); aShell.id = pe.id; if (pe.title != null) { aShell.title = pe.title; } artifactShells.Add(aShell); } ps.artifacts = artifactShells; shells.Add(ps); } } return shells; } catch (Exception ex) { return null; } }
public Project CreateProject(User u, List<ProjectElement> projectElements) { Project project = pa.CreateProject(u, projectElements); UserAccessor ua = new UserAccessor(); ua.AddProjectIdToOrder(project.id, u); return project; }
public JsonModels.UploadReponse AddDocumentElement(int projectId, string description, Stream fileStream, string fileName, string userName) { Project p = pa.GetProject(projectId); BlobStorageAccessor ba = new BlobStorageAccessor(); string location = null; string[] s2 = fileName.Split('.'); string extention = s2[s2.Count() - 1].ToLower(); UserAccessor ua = new UserAccessor(); User u = ua.GetUser(userName); string fullName = u.firstName +" " + u.lastName; storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("BlobConnectionString")); queueClient = storageAccount.CreateCloudQueueClient(); queue = queueClient.GetQueueReference(messageQueueName); queue.CreateIfNotExist(); string documentText = ""; //string PDFLocation = "notset"; if (extention == "pdf") { location = ba.uploadPDF(fileStream, false).ToString(); UploadManager um = new UploadManager(); //location = um.stampThatShit(location, fullName, null); //documentText = um.ExtractText(location); } else if (extention == "doc" || extention == "docx") { location = ba.uploadDOC(fileStream, false, "."+extention).ToString(); } else if (extention == "ppt" || extention == "pptx") { location = ba.uploadUnknown(fileStream, false, extention).ToString(); } else if( extention == "xls" || extention == "xlsx") { location = ba.uploadUnknown(fileStream,false, extention).ToString(); } else if (extention == "rtf") { location = ba.uploadUnknown(fileStream, false, extention).ToString(); } else if (extention == "txt") { location = ba.uploadUnknown(fileStream, false, extention).ToString(); } else { //upload unknown file type. do this or display message Uri result = ba.uploadUnknown(fileStream, false, extention); if (result == null) { return null; } else { location = result.ToString(); } } String FileName = Guid.NewGuid().ToString(); string uniqueBlobName = string.Format("{0}{1}", FileName, ".pdf"); string docThumb = ""; if (extention == "pdf") { docThumb = location; } else { docThumb = RoleEnvironment.GetConfigurationSettingValue("storageAccountUrl").ToString()+"pdfs/" + uniqueBlobName; } ProjectElement_Document pe = new ProjectElement_Document { description = description, documentLocation = location, title = fileName, documentText = documentText, documentThumbnailLocation = docThumb }; int projectElementId = pa.AddProjectElement(p, pe); if (extention == "doc" || extention == "docx") { CloudQueueMessage message = new CloudQueueMessage(String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", location, projectElementId, "documentConversion", @"http://do.convertapi.com/Word2Pdf", 0, 0, fullName, uniqueBlobName)); queue.AddMessage(message); } else if (extention == "ppt" || extention == "pptx") { CloudQueueMessage message = new CloudQueueMessage(String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", location, projectElementId, "documentConversion", @"http://do.convertapi.com/PowerPoint2Pdf", 0, 0, "", uniqueBlobName)); queue.AddMessage(message); } else if( extention == "xls" || extention == "xlsx") { CloudQueueMessage message = new CloudQueueMessage(String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", location, projectElementId, "documentConversion", @"http://do.convertapi.com/Excel2Pdf", 0, 0, fullName, uniqueBlobName)); queue.AddMessage(message); } else if (extention == "rtf") { CloudQueueMessage message = new CloudQueueMessage(String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", location, projectElementId, "documentConversion", @"http://do.convertapi.com/RichText2Pdf", 0, 0, fullName, uniqueBlobName)); queue.AddMessage(message); } else if (extention == "txt") { CloudQueueMessage message = new CloudQueueMessage(String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", location, projectElementId, "documentConversion", @"http://do.convertapi.com/Text2Pdf", 0, 0, fullName, uniqueBlobName)); queue.AddMessage(message); } if (extention == "pdf") { return new JsonModels.UploadReponse { id = projectElementId, fileURL = location, name = fileName, artifactURL = location }; } return new JsonModels.UploadReponse { id = projectElementId, fileURL = location, artifactURL = docThumb, name = fileName }; }