Пример #1
0
        public ConfigurationServiceResponse PublishNotificationInfo(string groupName = null)
        {
            IDictionary <string, object> parameters = null;
            var systemUserConnection = UserConnection.AppConnection.SystemUserConnection;
            var response             = new ConfigurationServiceResponse();

            if (!string.IsNullOrEmpty(groupName))
            {
                parameters = new Dictionary <string, object>();
                parameters.Add("type", "byGroup");
                parameters.Add("typeParameter", groupName);
            }
            try {
                NotificationInfoRunner runner = ClassFactory.ForceGet <NotificationInfoRunner>(
                    typeof(NotificationInfoRunner).AssemblyQualifiedName,
                    new ConstructorArgument("userConnection", systemUserConnection),
                    new ConstructorArgument("parameters", parameters));
                runner.Run();
            }
            catch (Exception ex) {
                response.SetErrorInfo(ex);
            }

            return(response);
        }
Пример #2
0
        public ConfigurationServiceResponse InstallFromStorage(string source)
        {
            var response = new ConfigurationServiceResponse();

            try {
                if (!CheckLicense(source))
                {
                    throw new LicException();
                }
                bool canExecuteOperation = GetInstallPackageRights();
                if (!canExecuteOperation)
                {
                    throw new SecurityException(
                              string.Format(
                                  new LocalizableString("Terrasoft.Core", "DBSecurityEngine.Exception.Admin.UnitCannotExecuteAdminOperation"),
                                  "CanManageSolution"));
                }
                InstallStorage(source);
                WorkspaceBuilder        workspaceBuilder = WorkspaceBuilderUtility.CreateWorkspaceBuilder(UserConnection.AppConnection);
                CompilerErrorCollection compilerErrors   = workspaceBuilder.Build(UserConnection.Workspace);
                if (GetIsError(compilerErrors))
                {
                    throw new Exception(new LocalizableString("Terrasoft.WebApp", "CompilationErrors.Caption"));
                }
                WorkspaceUtilities.ForceGetCustomPackageUId(UserConnection);
            } catch (Exception exception) {
                response.Exception = exception;
            }
            return(response);
        }
        public ConfigurationServiceResponse PublishMessage(string className, Dictionary <string, string> fieldsData)
        {
            ConfigurationServiceResponse response = new ConfigurationServiceResponse();

            try {
                InternalPublishMessage(className, fieldsData);
            } catch (Exception ex) {
                response.Exception = ex;
            }
            return(response);
        }
Пример #4
0
        public ConfigurationServiceResponse SubscribeUser(Guid entityId, Guid entitySchemaUId)
        {
            var response = new ConfigurationServiceResponse();

            try {
                InnerSubscribeUser(SysAdminUnitId, entityId, entitySchemaUId);
            } catch (Exception e) {
                response.Exception = e;
            }
            return(response);
        }
        public ConfigurationServiceResponse MultiLinkEntity(string entityName, string[] recordsId, string parameters = null, string filtersConfig = null)
        {
            var response = new ConfigurationServiceResponse();

            try {
                ValidateParameters(entityName, recordsId, filtersConfig);
                MultiOperationHelper.MultiLinkEntity(entityName, recordsId, parameters, filtersConfig);
            }
            catch (Exception ex) {
                response.Exception = ex;
            }
            return(response);
        }
Пример #6
0
        public ConfigurationServiceResponse SaveBulkEmailHyperlinks(SaveBulkEmailHyperlinkRequest request)
        {
            var response = new ConfigurationServiceResponse();

            try {
                var repository = ClassFactory.Get <BulkEmailHyperlinkRepository>(
                    new ConstructorArgument("userConnection", UserConnection));
                repository.SaveBulkEmailHyperlinks(request.BulkEmailId, request.Hyperlinks);
            } catch (Exception e) {
                MailingUtilities.Log.ErrorFormat(
                    "[BulkEmailTemplateService.SaveBulkEmailHyperlinks]: Error while saving hyperlinks", e);
                throw;
            }
            return(response);
        }
Пример #7
0
        public string Install(string name, string source)
        {
            ConfigurationServiceResponse response = InstallFromStorage(source);

            if (!response.Success)
            {
                string errorCode = response.ErrorInfo.ErrorCode;
                if (errorCode.Equals(typeof(SecurityException).Name))
                {
                    return("denied");
                }
                return("failed");
            }
            return("success");
        }
Пример #8
0
        public ConfigurationServiceResponse SubscribeContact(Guid contactId, Guid entityId, Guid entitySchemaUId)
        {
            var response = new ConfigurationServiceResponse();

            object[]             contactIds    = new object[] { contactId };
            CoreEntityCollection sysAdminUnits = GetSysAdminUnits(contactIds);

            try {
                foreach (SysAdminUnit sysAdminUnit in sysAdminUnits)
                {
                    InnerSubscribeUser(sysAdminUnit.Id, entityId, entitySchemaUId);
                    break;
                }
            } catch (Exception e) {
                response.Exception = e;
            }
            return(response);
        }