public FileUploadResult ProcessUpload(HttpContext context) { var fileUploadResult = new FileUploadResult(); if (!ProgressFileUploader.HasFilesToUpload(context)) { return(fileUploadResult); } var file = new ProgressFileUploader.FileToUpload(context); String assignedPath; Global.GetStore().SaveTemp("temp", out assignedPath, file.InputStream); file.InputStream.Position = 0; var jObject = ImportFromCSV.GetInfo(file.InputStream, context.Request["importSettings"]); jObject.Add("assignedPath", assignedPath); fileUploadResult.Success = true; fileUploadResult.Data = Convert.ToBase64String(Encoding.UTF8.GetBytes(jObject.ToString())); return(fileUploadResult); }
public FileUploadResult ProcessUpload(HttpContext context) { var fileUploadResult = new FileUploadResult(); if (!ProgressFileUploader.HasFilesToUpload(context)) { return(fileUploadResult); } var file = new ProgressFileUploader.FileToUpload(context); String assignedPath; Global.GetStore().SaveTemp("temp", out assignedPath, file.InputStream); file.InputStream.Position = 0; var jObject = ImportFromCSV.GetInfo(file.InputStream); jObject.Add("assignedPath", assignedPath); fileUploadResult.Success = true; fileUploadResult.Data = jObject.ToString(); return(fileUploadResult); }
public IProgressItem GetStatus(string entityType) { EntityType entityTypeObj; if (string.IsNullOrEmpty(entityType)) { throw new ArgumentException(); } switch (entityType.ToLower()) { case "contact": entityTypeObj = EntityType.Contact; break; case "opportunity": entityTypeObj = EntityType.Opportunity; break; case "case": entityTypeObj = EntityType.Case; break; case "task": entityTypeObj = EntityType.Task; break; default: throw new ArgumentException(); } return(ImportFromCSV.GetStatus(entityTypeObj)); }
public void StartImport(EntityType entityType, String CSVFileURI, String importSettingsJSON) { ImportFromCSV.Start(entityType, CSVFileURI, importSettingsJSON); AdminLog.PostAction("CRM: started import operation of type \"{0}\" with settings {1}>", entityType, importSettingsJSON); var action = GetMessageAction(entityType); MessageService.Send(HttpContext.Current.Request, action); }
public String GetSampleRow(String CSVFileURI, int indexRow, String jsonSettings) { if (String.IsNullOrEmpty(CSVFileURI) || indexRow < 0) { throw new ArgumentException(); } if (!Global.GetStore().IsFile("temp", CSVFileURI)) { throw new ArgumentException(); } var CSVFileStream = Global.GetStore().GetReadStream("temp", CSVFileURI); return(ImportFromCSV.GetRow(CSVFileStream, indexRow, jsonSettings)); }
public String GetPreviewImportData(String CSVFileURI, int companyNameColumnIndex, int firstNameColumnIndex, int lastNameColumnIndex) { if (String.IsNullOrEmpty(CSVFileURI)) { throw new ArgumentException(); } if (!Global.GetStore().IsFile("temp", CSVFileURI)) { throw new ArgumentException(); } var CSVFileStream = Global.GetStore().GetReadStream("temp", CSVFileURI); return(ImportFromCSV.GetFoundedContacts(CSVFileStream, companyNameColumnIndex, firstNameColumnIndex, lastNameColumnIndex)); }
public UtilsController(CrmSecurity crmSecurity, DaoFactory daoFactory, MessageService messageService, SettingsManager settingsManager, CurrencyProvider currencyProvider, InvoiceSetting invoiceSetting, ImportFromCSVManager importFromCSVManager, OrganisationLogoManager organisationLogoManager, Global global, ImportFromCSV importFromCSV, ExportToCsv exportToCsv, IMapper mapper) : base(daoFactory, crmSecurity, mapper) { _messageService = messageService; _currencyProvider = currencyProvider; _settingsManager = settingsManager; _invoiceSetting = invoiceSetting; _importFromCSVManager = importFromCSVManager; _organisationLogoManager = organisationLogoManager; _global = global; _importFromCSV = importFromCSV; _exportToCsv = exportToCsv; }
public async Task Invoke(HttpContext context, WebItemSecurity webItemSecurity, CrmSecurity crmSecurity, Global global, ImportFromCSV importFromCSV) { if (!webItemSecurity.IsAvailableForMe(ProductEntryPoint.ID)) { throw crmSecurity.CreateSecurityException(); } var fileUploadResult = new FileUploadResult(); if (context.Request.Form.Files.Count == 0) { await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult)); } var fileName = context.Request.Form.Files[0].FileName; var contentLength = context.Request.Form.Files[0].Length; String assignedPath; global.GetStore().SaveTemp("temp", out assignedPath, context.Request.Form.Files[0].OpenReadStream()); var jObject = importFromCSV.GetInfo(context.Request.Form.Files[0].OpenReadStream(), context.Request.Form["importSettings"]); var jsonDocumentAsDictionary = JsonSerializer.Deserialize <Dictionary <string, string> >(jObject.ToString()); jsonDocumentAsDictionary.Add("assignedPath", assignedPath); fileUploadResult.Success = true; fileUploadResult.Data = Global.EncodeTo64(JsonSerializer.Serialize(jsonDocumentAsDictionary)); await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult)); }
public void StartImport(EntityType entityType, String CSVFileURI, String importSettingsJSON) { ImportFromCSV.Start(entityType, CSVFileURI, importSettingsJSON); AdminLog.PostAction("CRM: started import operation of type \"{0}\" with settings {1}>", entityType, importSettingsJSON); }
public IProgressItem GetStatus(EntityType entityType) { return(ImportFromCSV.GetStatus(entityType)); }
public void StartImport(EntityType entityType, String CSVFileURI, String importSettingsJSON) { ImportFromCSV.Start(entityType, CSVFileURI, importSettingsJSON); }
public IProgressItem GetStatus() { return(ImportFromCSV.GetStatus()); }
public void StartImport(String CSVFileURI, String importSettingsJSON) { ImportFromCSV.Start(CSVFileURI, importSettingsJSON); }