public RelationshipEventsController(
     CrmSecurity crmSecurity,
     DaoFactory daoFactory,
     ApiContext apiContext,
     MessageTarget messageTarget,
     MessageService messageService,
     FileWrapperHelper fileWrapperHelper,
     ASC.Files.Core.Data.DaoFactory filesDaoFactory,
     FileUploader fileUploader,
     SecurityContext securityContext,
     NotifyClient notifyClient,
     FilesSettingsHelper filesSettingsHelper,
     IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _apiContext          = apiContext;
     _messageTarget       = messageTarget;
     _messageService      = messageService;
     _fileWrapperHelper   = fileWrapperHelper;
     _filesDaoFactory     = filesDaoFactory;
     _fileUploader        = fileUploader;
     _securityContext     = securityContext;
     _notifyClient        = notifyClient;
     _filesSettingsHelper = filesSettingsHelper;
 }
Esempio n. 2
0
 public InvoiceDao(
     DbContextManager <CrmDbContext> dbContextManager,
     TenantManager tenantManager,
     SecurityContext securityContext,
     FactoryIndexerInvoice factoryIndexer,
     IOptionsMonitor <ILog> logger,
     ICache ascCache,
     SettingsManager settingsManager,
     InvoiceSetting invoiceSetting,
     InvoiceFormattedData invoiceFormattedData,
     CrmSecurity crmSecurity,
     TenantUtil tenantUtil,
     IMapper mapper)
     : base(dbContextManager,
            tenantManager,
            securityContext,
            logger,
            ascCache,
            mapper)
 {
     _factoryIndexer       = factoryIndexer;
     _settingsManager      = settingsManager;
     _invoiceSetting       = invoiceSetting;
     _invoiceFormattedData = invoiceFormattedData;
     _crmSecurity          = crmSecurity;
     _tenantUtil           = tenantUtil;
 }
Esempio n. 3
0
 public SearchDao(DbContextManager <CrmDbContext> dbContextManager,
                  TenantManager tenantManager,
                  DaoFactory daoFactory,
                  SecurityContext securityContext,
                  CrmSecurity crmSecurity,
                  TenantUtil tenantUtil,
                  PathProvider pathProvider,
                  FactoryIndexerTask tasksDtoIndexer,
                  FactoryIndexerInvoice invoicesDtoIndexer,
                  IOptionsMonitor <ILog> logger,
                  ICache ascCache,
                  WebImageSupplier webImageSupplier,
                  BundleSearch bundleSearch,
                  IMapper mapper
                  ) :
     base(dbContextManager,
          tenantManager,
          securityContext,
          logger,
          ascCache,
          mapper)
 {
     _daoFactory            = daoFactory;
     _factoryIndexerTask    = tasksDtoIndexer;
     _factoryIndexerInvoice = invoicesDtoIndexer;
     _crmSecurity           = crmSecurity;
     _tenantUtil            = tenantUtil;
     _pathProvider          = pathProvider;
     _webImageSupplier      = webImageSupplier;
     _bundleSearch          = bundleSearch;
 }
        public ImportDataOperation(Global global,
                                   TenantManager tenantManager,
                                   IOptionsMonitor <ILog> logger,
                                   UserManager userManager,
                                   CrmSecurity crmSecurity,
                                   NotifyClient notifyClient,
                                   SettingsManager settingsManager,
                                   CurrencyProvider currencyProvider,
                                   DaoFactory daoFactory,
                                   SecurityContext securityContext
                                   )
        {
            _userManager = userManager;

            _securityContext = securityContext;
            _dataStore       = global.GetStore();

            _tenantManager = tenantManager;
            _tenantID      = tenantManager.GetCurrentTenant().TenantId;
            _author        = _securityContext.CurrentAccount;

            _notifyClient = notifyClient;

            Id = String.Format("{0}_{1}", _tenantID, (int)_entityType);

            _log = logger.Get("ASC.CRM");

            _crmSecurity      = crmSecurity;
            _settingsManager  = settingsManager;
            _currencyProvider = currencyProvider;
            _daoFactory       = daoFactory;
        }
Esempio n. 5
0
 public DealDao(DbContextManager <CrmDbContext> dbContextManager,
                TenantManager tenantManager,
                SecurityContext securityContext,
                CrmSecurity crmSecurity,
                FactoryIndexerDeal factoryIndexer,
                FilesIntegration filesIntegration,
                TenantUtil tenantUtil,
                AuthorizationManager authorizationManager,
                IOptionsMonitor <ILog> logger,
                ICache ascCache,
                IMapper mapper,
                BundleSearch bundleSearch) :
     base(dbContextManager,
          tenantManager,
          securityContext,
          logger,
          ascCache,
          mapper)
 {
     _crmSecurity          = crmSecurity;
     _factoryIndexer       = factoryIndexer;
     _filesIntegration     = filesIntegration;
     _bundleSearch         = bundleSearch;
     _mapper               = mapper;
     _tenantUtil           = tenantUtil;
     _authorizationManager = authorizationManager;
 }
 public InvoiceTaxDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                                   EmployeeWraperHelper employeeWraperHelper,
                                   CrmSecurity crmSecurity)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _crmSecurity          = crmSecurity;
 }
Esempio n. 7
0
 public BaseApiController(DaoFactory daoFactory,
                          CrmSecurity crmSecurity,
                          IMapper mapper)
 {
     _daoFactory  = daoFactory;
     _crmSecurity = crmSecurity;
     _mapper      = mapper;
 }
Esempio n. 8
0
        public TaskTemplateController(CrmSecurity crmSecurity,
                                      DaoFactory daoFactory,
                                      EmployeeWraperHelper employeeWraperHelper,
                                      IMapper mapper)
            : base(daoFactory, crmSecurity, mapper)

        {
            _employeeWraperHelper = employeeWraperHelper;
        }
Esempio n. 9
0
 public CasesDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                              EmployeeWraperHelper employeeWraperHelper,
                              CrmSecurity crmSecurity,
                              DaoFactory daoFactory)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _CRMSecurity          = crmSecurity;
     _daoFactory           = daoFactory;
 }
Esempio n. 10
0
 public ListItemsController(CrmSecurity crmSecurity,
                            DaoFactory daoFactory,
                            MessageTarget messageTarget,
                            MessageService messageService,
                            IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _messageTarget  = messageTarget;
     _messageService = messageService;
 }
Esempio n. 11
0
 public TaskDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                             EmployeeWraperHelper employeeWraperHelper,
                             CrmSecurity crmSecurity,
                             DaoFactory daoFactory,
                             EntityDtoHelper entityDtoHelper)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _crmSecurity          = crmSecurity;
     _daoFactory           = daoFactory;
     _entityDtoHelper      = entityDtoHelper;
 }
Esempio n. 12
0
 public OpportunityDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                                    EmployeeWraperHelper employeeWraperHelper,
                                    CrmSecurity crmSecurity,
                                    DaoFactory daoFactory,
                                    CurrencyProvider currencyProvider)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _crmSecurity          = crmSecurity;
     _daoFactory           = daoFactory;
     _currencyProvider     = currencyProvider;
 }
Esempio n. 13
0
 public TagsController(CrmSecurity crmSecurity,
                       DaoFactory daoFactory,
                       ApiContext apiContext,
                       MessageTarget messageTarget,
                       MessageService messageService,
                       IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _apiContext     = apiContext;
     _messageTarget  = messageTarget;
     _messageService = messageService;
 }
Esempio n. 14
0
 public CurrencyRatesController(CrmSecurity crmSecurity,
                                DaoFactory daoFactory,
                                MessageService messageService,
                                SettingsManager settingsManager,
                                Global global,
                                CurrencyProvider currencyProvider,
                                IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _messageService   = messageService;
     _settingsManager  = settingsManager;
     _global           = global;
     _currencyProvider = currencyProvider;
 }
 public ContactDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                                EmployeeWraperHelper employeeWraperHelper,
                                CrmSecurity crmSecurity,
                                CurrencyProvider currencyProvider,
                                PathProvider pathProvider,
                                DaoFactory daoFactory)
 {
     _apiDateTimeHelper = apiDateTimeHelper;
     _employeeDtoHelper = employeeWraperHelper;
     _crmSecurity       = crmSecurity;
     _currencyProvider  = currencyProvider;
     _pathProvider      = pathProvider;
     _daoFactory        = daoFactory;
 }
 public InvoiceItemDtoTypeConverter(ApiDateTimeHelper apiDateTimeHelper,
                                    EmployeeWraperHelper employeeWraperHelper,
                                    CrmSecurity crmSecurity,
                                    SettingsManager settingsManager,
                                    CurrencyProvider currencyProvider,
                                    DaoFactory daoFactory)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _crmSecurity          = crmSecurity;
     _settingsManager      = settingsManager;
     _currencyProvider     = currencyProvider;
     _daoFactory           = daoFactory;
 }
 public RelationshipEventDtoTypeConverter(
     ApiDateTimeHelper apiDateTimeHelper,
     EmployeeWraperHelper employeeWraperHelper,
     FileWrapperHelper fileWrapperHelper,
     CrmSecurity crmSecurity,
     DaoFactory daoFactory,
     EntityDtoHelper entityDtoHelper)
 {
     _apiDateTimeHelper    = apiDateTimeHelper;
     _employeeWraperHelper = employeeWraperHelper;
     _crmSecurity          = crmSecurity;
     _daoFactory           = daoFactory;
     _fileWrapperHelper    = fileWrapperHelper;
     _entityDtoHelper      = entityDtoHelper;
 }
Esempio n. 18
0
 public ListItemDao(
     CrmSecurity crmSecurity,
     DbContextManager <CrmDbContext> dbContextManager,
     TenantManager tenantManager,
     SecurityContext securityContext,
     IOptionsMonitor <ILog> logger,
     ICache ascCache,
     IMapper mapper)
     : base(dbContextManager,
            tenantManager,
            securityContext,
            logger,
            ascCache,
            mapper)
 {
 }
Esempio n. 19
0
 public TasksController(CrmSecurity crmSecurity,
                        DaoFactory daoFactory,
                        ApiContext apiContext,
                        MessageTarget messageTarget,
                        MessageService messageService,
                        NotifyClient notifyClient,
                        IMapper mapper,
                        FactoryIndexerCase factoryIndexerCase)
     : base(daoFactory, crmSecurity, mapper)
 {
     _apiContext     = apiContext;
     _messageTarget  = messageTarget;
     _messageService = messageService;
     _notifyClient   = notifyClient;
     _mapper         = mapper;
 }
Esempio n. 20
0
 public InvoiceItemDao(
     DbContextManager <CrmDbContext> dbContextManager,
     TenantManager tenantManager,
     SecurityContext securityContext,
     CrmSecurity crmSecurity,
     IOptionsMonitor <ILog> logger,
     ICache ascCache,
     IMapper mapper
     ) : base(dbContextManager,
              tenantManager,
              securityContext,
              logger,
              ascCache,
              mapper)
 {
     _crmSecurity = crmSecurity;
 }
Esempio n. 21
0
 public ReportsController(CrmSecurity crmSecurity,
                          DaoFactory daoFactory,
                          SettingsManager settingsManager,
                          Global global,
                          ReportHelper reportHelper,
                          FileWrapperHelper fileWrapperHelper,
                          DocbuilderReportsUtilityHelper docbuilderReportsUtilityHelper,
                          IMapper mapper
                          )
     : base(daoFactory, crmSecurity, mapper)
 {
     _settingsManager   = settingsManager;
     _global            = global;
     _reportHelper      = reportHelper;
     _fileWrapperHelper = fileWrapperHelper;
     _docbuilderReportsUtilityHelper = docbuilderReportsUtilityHelper;
 }
Esempio n. 22
0
 public VoipEngine(DaoFactory daoFactory,
                   CrmSecurity crmSecurity,
                   TenantUtil tenantUtil,
                   DistributedTaskQueueOptionsManager optionsManager,
                   SecurityContext securityContext,
                   IOptionsMonitor <ILog> logger,
                   TenantManager tenantManager,
                   VoipDao voipDao)
 {
     _crmSecurity     = crmSecurity;
     _tenantUtil      = tenantUtil;
     _securityContext = securityContext;
     _queue           = optionsManager.Get <QueueItem>();
     _logger          = logger.Get("ASC.CRM");
     _tenantManager   = tenantManager;
     _voipDao         = voipDao;
     _daoFactory      = daoFactory;
 }
Esempio n. 23
0
 public Global(StorageFactory storageFactory,
               SecurityContext securityContext,
               SetupInfo setupInfo,
               FilesLinkUtility filesLinkUtility,
               CrmSecurity crmSecurity,
               TenantManager tenantManager,
               SettingsManager settingsManager,
               IConfiguration configuration
               )
 {
     _storageFactory   = storageFactory;
     _filesLinkUtility = filesLinkUtility;
     _setupInfo        = setupInfo;
     _securityContext  = securityContext;
     _crmSecurity      = crmSecurity;
     _tenantID         = tenantManager.GetCurrentTenant().TenantId;
     _settingsManager  = settingsManager;
     _configuration    = configuration;
 }
Esempio n. 24
0
 public CasesController(CrmSecurity crmSecurity,
                        DaoFactory daoFactory,
                        ApiContext apiContext,
                        MessageTarget messageTarget,
                        MessageService messageService,
                        NotifyClient notifyClient,
                        SecurityContext securityContext,
                        DisplayUserSettingsHelper displayUserSettingsHelper,
                        UserManager userManager,
                        IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _apiContext                = apiContext;
     _messageTarget             = messageTarget;
     _messageService            = messageService;
     _notifyClient              = notifyClient;
     _securityContext           = securityContext;
     _displayUserSettingsHelper = displayUserSettingsHelper;
     _userManager               = userManager;
     _mapper = mapper;
 }
Esempio n. 25
0
 public RelationshipEventDao(DbContextManager <CrmDbContext> dbContextManager,
                             TenantManager tenantManager,
                             SecurityContext securityContext,
                             FilesIntegration filesIntegration,
                             FactoryIndexerEvents factoryIndexerEvents,
                             CrmSecurity crmSecurity,
                             TenantUtil tenantUtil,
                             IOptionsMonitor <ILog> logger,
                             ICache ascCache,
                             IMapper mapper
                             ) :
     base(dbContextManager,
          tenantManager,
          securityContext,
          logger,
          ascCache,
          mapper)
 {
     _filesIntegration = filesIntegration;
     _tenantUtil       = tenantUtil;
     _crmSecurity      = crmSecurity;
     _factoryIndexer   = factoryIndexerEvents;
 }
Esempio n. 26
0
 public VoIPController(CrmSecurity crmSecurity,
                       DaoFactory daoFactory,
                       Global global,
                       ContactPhotoManager contactPhotoManager,
                       StorageFactory storageFactory,
                       CommonLinkUtility commonLinkUtility,
                       SecurityContext securityContext,
                       TenantUtil tenantUtil,
                       VoipEngine voipEngine,
                       ApiContext apiContext,
                       SignalrServiceClient signalrServiceClient,
                       IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _global = global;
     _contactPhotoManager  = contactPhotoManager;
     _storageFactory       = storageFactory;
     _commonLinkUtility    = commonLinkUtility;
     _securityContext      = securityContext;
     _tenantUtil           = tenantUtil;
     _voipEngine           = voipEngine;
     _apiContext           = apiContext;
     _signalrServiceClient = signalrServiceClient;
 }
Esempio n. 27
0
 public DealsController(CrmSecurity crmSecurity,
                        DaoFactory daoFactory,
                        ApiContext apiContext,
                        MessageTarget messageTarget,
                        MessageService messageService,
                        NotifyClient notifyClient,
                        CurrencyProvider currencyProvider,
                        UserManager userManager,
                        EmployeeWraperHelper employeeWraperHelper,
                        DisplayUserSettingsHelper displayUserSettingsHelper,
                        SecurityContext securityContext,
                        IMapper mapper)
     : base(daoFactory, crmSecurity, mapper)
 {
     _apiContext                = apiContext;
     _messageTarget             = messageTarget;
     _messageService            = messageService;
     _notifyClient              = notifyClient;
     _currencyProvider          = currencyProvider;
     _userManager               = userManager;
     _employeeWraperHelper      = employeeWraperHelper;
     _displayUserSettingsHelper = displayUserSettingsHelper;
     _securityContext           = securityContext;
 }
        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));
        }
Esempio n. 29
0
 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 System.Threading.Tasks.Task Invoke(HttpContext context,
                                                        SetupInfo setupInfo,
                                                        CrmSecurity crmSecurity,
                                                        FileSizeComment fileSizeComment,
                                                        WebItemSecurity webItemSecurity,
                                                        MessageTarget messageTarget,
                                                        MessageService messageService,
                                                        DaoFactory daoFactory,
                                                        ContactPhotoManager contactPhotoManager)
        {
            if (!webItemSecurity.IsAvailableForMe(ProductEntryPoint.ID))
            {
                throw crmSecurity.CreateSecurityException();
            }

            context.Request.EnableBuffering();

            var contactId = Convert.ToInt32(context.Request.Form["contactID"]);

            Contact contact = null;

            if (contactId != 0)
            {
                contact = daoFactory.GetContactDao().GetByID(contactId);

                if (!crmSecurity.CanEdit(contact))
                {
                    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;

            if (String.IsNullOrEmpty(fileName) || contentLength == 0)
            {
                throw new InvalidOperationException(CRMErrorsResource.InvalidFile);
            }

            if (0 < setupInfo.MaxImageUploadSize && setupInfo.MaxImageUploadSize < contentLength)
            {
                fileUploadResult.Success = false;
                fileUploadResult.Message = fileSizeComment.GetFileImageSizeNote(CRMCommonResource.ErrorMessage_UploadFileSize, false).HtmlEncode();

                await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult));
            }

            if (FileUtility.GetFileTypeByFileName(fileName) != FileType.Image)
            {
                fileUploadResult.Success = false;
                fileUploadResult.Message = CRMJSResource.ErrorMessage_NotImageSupportFormat.HtmlEncode();

                await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult));
            }

            var uploadOnly = Convert.ToBoolean(context.Request.Form["uploadOnly"]);
            var tmpDirName = Convert.ToString(context.Request.Form["tmpDirName"]);

            try
            {
                ContactPhotoManager.PhotoData photoData;
                if (contactId != 0)
                {
                    photoData = contactPhotoManager.UploadPhoto(context.Request.Form.Files[0].OpenReadStream(), contactId, uploadOnly);
                }
                else
                {
                    if (String.IsNullOrEmpty(tmpDirName) || tmpDirName == "null")
                    {
                        tmpDirName = Guid.NewGuid().ToString();
                    }
                    photoData = contactPhotoManager.UploadPhotoToTemp(context.Request.Form.Files[0].OpenReadStream(), tmpDirName);
                }

                fileUploadResult.Success = true;
                fileUploadResult.Data    = photoData;
            }
            catch (Exception e)
            {
                fileUploadResult.Success = false;
                fileUploadResult.Message = e.Message.HtmlEncode();

                await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult));
            }

            if (contact != null)
            {
                var messageAction = contact is Company ? MessageAction.CompanyUpdatedPhoto : MessageAction.PersonUpdatedPhoto;

                messageService.Send(messageAction, messageTarget.Create(contact.ID), contact.GetTitle());
            }

            await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult));
        }