private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken token = (DataEntityToken)this.EntityToken;

            IMethodBasedFunctionInfo methodBasedFunctionInfo = (IMethodBasedFunctionInfo)token.Data;

            if (DataFacade.WillDeleteSucceed(methodBasedFunctionInfo))
            {
                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

                DataFacade.Delete(token.Data);

                int count =
                    (from info in DataFacade.GetData <IMethodBasedFunctionInfo>()
                     where info.Namespace == methodBasedFunctionInfo.Namespace
                     select info).Count();

                if (count == 0)
                {
                    RefreshFunctionTree();
                }
                else
                {
                    treeRefresher.PostRefreshMesseges();
                }
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorMessage")
                    );
            }
        }
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IVisualFunction visualFunction = (IVisualFunction)dataEntityToken.Data;

            DataFacade.Delete <IVisualFunction>(visualFunction);

            int count =
                (from info in DataFacade.GetData <IVisualFunction>()
                 where info.Namespace == visualFunction.Namespace
                 select info).Count();


            if (count == 0)
            {
                RefreshFunctionTree();
            }
            else
            {
                deleteTreeRefresher.PostRefreshMesseges();
            }
        }
Ejemplo n.º 3
0
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IUser user = (IUser)dataEntityToken.Data;

            if (DataFacade.WillDeleteSucceed(user))
            {
                UserPerspectiveFacade.DeleteAll(user.Username);

                DataFacade.Delete(user);

                LoggingService.LogVerbose("UserManagement", String.Format("C1 Console user '{0}' deleted by '{1}'.", user.Username, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);

                deleteTreeRefresher.PostRefreshMesseges();
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteUserWorkflow.CascadeDeleteErrorMessage")
                    );
            }
        }
Ejemplo n.º 4
0
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            ISystemActiveLocale systemActiveLocale = this.GetDataItemFromEntityToken <ISystemActiveLocale>();

            var cultureName = systemActiveLocale.CultureName;

            var consolesToBeUpdated =
                (from consoleInformation in DataFacade.GetData <IUserConsoleInformation>()
                 join userSettings in DataFacade.GetData <IUserSettings>()
                 on consoleInformation.Username equals userSettings.Username
                 where userSettings.CurrentActiveLocaleCultureName == cultureName ||
                 userSettings.ForeignLocaleCultureName == cultureName
                 select consoleInformation.ConsoleId).ToList();

            LocalizationFacade.RemoveLocale(cultureName);

            foreach (var consoleId in consolesToBeUpdated)
            {
                ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), consoleId);
            }

            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem {
                Name = "LocalesUpdated", Value = ""
            }, null);

            SelectElement(new LocalizationElementProviderRootEntityToken());

            deleteTreeRefresher.PostRefreshMesseges();
        }
Ejemplo n.º 5
0
        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);
            DataEntityToken     token         = (DataEntityToken)this.EntityToken;

            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())
            {
                IMediaFileFolder folder = DataFacade.GetDataFromDataSourceId(token.DataSourceId, false) as IMediaFileFolder;

                // Media folder may already be deleted at this point
                if (folder != null)
                {
                    if (!DataFacade.WillDeleteSucceed(folder))
                    {
                        this.ShowMessage(
                            DialogType.Error,
                            StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorTitle"),
                            StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFolderWorkflow.CascadeDeleteErrorMessage")
                            );

                        return;
                    }

                    DataFacade.Delete(folder);
                }

                transactionScope.Complete();
            }

            treeRefresher.PostRefreshMesseges();
        }
        private void finalizeCodeActivity_DeleteFunction_ExecuteCode(object sender, EventArgs e)
        {
            IInlineFunction function = GetDataItemFromEntityToken <IInlineFunction>();

            if (DataFacade.WillDeleteSucceed(function))
            {
                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

                using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())
                {
                    DataFacade.Delete <IInlineFunctionAssemblyReference>(f => f.Function == function.Id);
                    DataFacade.Delete <IParameter>(f => f.OwnerId == function.Id);

                    function.DeleteFunctionCode();

                    DataFacade.Delete(function);

                    transactionScope.Complete();
                }

                treeRefresher.PostRefreshMesseges();
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.MethodBasedFunctionProviderElementProvider", "CascadeDeleteErrorMessage")
                    );
            }
        }
        private void finalizeCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IUserGroup userGroup = (IUserGroup)dataEntityToken.Data;

            DataFacade.Delete(userGroup);

            LoggingService.LogVerbose("UserManagement", String.Format("C1 Console user group '{0}' deleted by '{1}'.", userGroup.Name, UserValidationFacade.GetUsername()), LoggingService.Category.Audit);

            deleteTreeRefresher.PostRefreshMesseges();
        }
Ejemplo n.º 8
0
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            ISystemActiveLocale systemActiveLocale = this.GetDataItemFromEntityToken <ISystemActiveLocale>();

            LocalizationFacade.RemoveLocale(systemActiveLocale.CultureName);

            ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), null);
            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem {
                Name = "LocalesUpdated", Value = ""
            }, null);

            deleteTreeRefresher.PostRefreshMesseges();
        }
Ejemplo n.º 9
0
        private void finalizeCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IUserGroup userGroup = (IUserGroup)dataEntityToken.Data;

            DataFacade.Delete(userGroup);

            LoggingService.LogEntry("UserManagement",
                                    $"C1 Console user group '{userGroup.Name}' deleted by '{UserValidationFacade.GetUsername()}'.",
                                    LoggingService.Category.Audit,
                                    TraceEventType.Information);

            deleteTreeRefresher.PostRefreshMesseges();
        }
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken <IPageTypeMetaDataTypeLink>();

            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            DataTypeDescriptor dataTypeDescriptor;

            if (DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId, out dataTypeDescriptor))
            {
                PageMetaDataFacade.RemoveDefinition(pageTypeMetaDataTypeLink.PageTypeId, pageTypeMetaDataTypeLink.Name);
            }

            DataFacade.Delete <IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);

            deleteTreeRefresher.PostRefreshMesseges();
        }
        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;

            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            IEnumerable <IPageTypeMetaDataTypeLink> pageTypeMetaDataTypeLinks =
                DataFacade.GetData <IPageTypeMetaDataTypeLink>().
                Where(f => f.PageTypeId == pageType.Id).
                Evaluate();

            foreach (IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink in pageTypeMetaDataTypeLinks)
            {
                PageMetaDataFacade.RemoveDefinition(pageType.Id, pageTypeMetaDataTypeLink.Name);
            }

            DataFacade.Delete <IPageType>(pageType);

            deleteTreeRefresher.PostRefreshMesseges();
        }
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken token = this.EntityToken as DataEntityToken;

            ISqlFunctionInfo sqlFunctionInfo = (ISqlFunctionInfo)token.Data;

            if (DataFacade.WillDeleteSucceed(token.Data))
            {
                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

                DataFacade.Delete(sqlFunctionInfo);

                int count =
                    (from info in DataFacade.GetData <ISqlFunctionInfo>()
                     where info.Namespace == sqlFunctionInfo.Namespace
                     select info).Count();

                if (count == 0)
                {
                    ISqlConnection sqlConnection =
                        (from connection in DataFacade.GetData <ISqlConnection>()
                         where connection.Id == sqlFunctionInfo.ConnectionId
                         select connection).Single();

                    SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();
                    specificTreeRefresher.PostRefreshMesseges(sqlConnection.GetDataEntityToken());
                }
                else
                {
                    treeRefresher.PostRefreshMesseges();
                }
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.SqlFunction", "CascadeDeleteErrorMessage")
                    );
            }
        }
Ejemplo n.º 13
0
        private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            IXsltFunction xsltFunction = (IXsltFunction)dataEntityToken.Data;

            if (DataFacade.WillDeleteSucceed <IXsltFunction>(xsltFunction))
            {
                DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);


                IFile file = IFileServices.TryGetFile <IXsltFile>(xsltFunction.XslFilePath);
                DataFacade.Delete <IParameter>(f => f.OwnerId == xsltFunction.Id);
                DataFacade.Delete <INamedFunctionCall>(f => f.XsltFunctionId == xsltFunction.Id);
                DataFacade.Delete(xsltFunction);

                DeleteFile(file);

                int count =
                    (from info in DataFacade.GetData <IXsltFunction>()
                     where info.Namespace == xsltFunction.Namespace
                     select info).Count();

                if (count == 0)
                {
                    RefreshFunctionTree();
                }
                else
                {
                    deleteTreeRefresher.PostRefreshMesseges();
                }
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.XsltBasedFunction", "DeleteXsltFunctionWorkflow.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.XsltBasedFunction", "DeleteXsltFunctionWorkflow.CascadeDeleteErrorMessage")
                    );
            }
        }
Ejemplo n.º 14
0
        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;

            try
            {
                C1File.Delete(entityToken.Path);

                treeRefresher.PostRefreshMesseges();
            }
            catch (Exception)
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "DeleteWebsiteFileWorkflow.DeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "DeleteWebsiteFileWorkflow.DeleteErrorMessage")
                    );
            }
        }
Ejemplo n.º 15
0
        private void finalizeCodeActivity_DeteleData_ExecuteCode(object sender, System.EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            IData data = ((DataEntityToken)this.EntityToken).Data;

            if (DataFacade.WillDeleteSucceed(data))
            {
                ProcessControllerFacade.FullDelete(data);

                deleteTreeRefresher.PostRefreshMesseges(true);
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeGenericDelete.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeGenericDelete.CascadeDeleteErrorMessage")
                    );
            }
        }
Ejemplo n.º 16
0
        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);
            DataEntityToken     token         = (DataEntityToken)this.EntityToken;
            IMediaFile          file          = (IMediaFile)token.Data;

            if (DataFacade.WillDeleteSucceed(file))
            {
                DataFacade.Delete(file);

                treeRefresher.PostRefreshMesseges(true);
            }
            else
            {
                this.ShowMessage(
                    DialogType.Error,
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFileWorkflow.CascadeDeleteErrorTitle"),
                    StringResourceSystemFacade.GetString("Composite.Management", "DeleteMediaFileWorkflow.CascadeDeleteErrorMessage")
                    );
            }
        }
        private void ValidateTypeExistence(object sender, ConditionalEventArgs e)
        {
            e.Result = true;

            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken <IPageTypeMetaDataTypeLink>();

            DataTypeDescriptor dataTypeDescriptor;

            if (!DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId, out dataTypeDescriptor))
            {
                e.Result = false;

                DeleteTreeRefresher deleteTreeRefresher = CreateDeleteTreeRefresher(this.EntityToken);

                DataFacade.Delete <IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);

                this.ShowMessage(
                    DialogType.Warning,
                    GetText("PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Title"),
                    GetText("PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Message"));

                deleteTreeRefresher.PostRefreshMesseges();
            }
        }
        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);

            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;

            ISqlConnection connection = (ISqlConnection)dataEntityToken.Data;

            var queries = from item in DataFacade.GetData <ISqlFunctionInfo>()
                          where item.ConnectionId == connection.Id
                          select item;

            using (TransactionScope transationScope = TransactionsFacade.CreateNewScope())
            {
                DataFacade.Delete(connection);
                foreach (ISqlFunctionInfo query in queries)
                {
                    DataFacade.Delete(query);
                }
                transationScope.Complete();
            }

            deleteTreeRefresher.PostRefreshMesseges();
        }