예제 #1
0
        private ActivateActionLink(IPortalContext portalContext, int languageCode, ActivateAction action, bool enabled = true,
                                   UrlBuilder url = null, string portalName = null)
            : base(
                portalContext, languageCode, action, LinkActionType.Activate, enabled, url, portalName, DefaultButtonLabel,
                DefaultButtonTooltip)
        {
            Modal = new ViewActivateModal();

            if (url == null)
            {
                URL = EntityListFunctions.BuildControllerActionUrl("Activate", "EntityAction",
                                                                   new { area = "Portal", __portalScopeId__ = portalContext.Website.Id });
            }
        }
예제 #2
0
        public ActivateActionLink(IPortalContext portalContext, GridMetadata gridMetadata, int languageCode,
                                  ActivateAction action, bool enabled = true, UrlBuilder url = null, string portalName = null)
            : this(portalContext, languageCode, action, enabled, url, portalName)
        {
            if (gridMetadata.ActivateDialog == null)
            {
                return;
            }

            Modal.CloseButtonCssClass   = gridMetadata.ActivateDialog.CloseButtonCssClass;
            Modal.CloseButtonText       = gridMetadata.ActivateDialog.CloseButtonText.GetLocalizedString(languageCode);
            Modal.CssClass              = gridMetadata.ActivateDialog.CssClass;
            Modal.DismissButtonSrText   = gridMetadata.ActivateDialog.DismissButtonSrText.GetLocalizedString(languageCode);
            Modal.PrimaryButtonCssClass = gridMetadata.ActivateDialog.PrimaryButtonCssClass;
            Modal.PrimaryButtonText     = gridMetadata.ActivateDialog.PrimaryButtonText.GetLocalizedString(languageCode);
            Modal.Size          = gridMetadata.ActivateDialog.Size;
            Modal.Title         = gridMetadata.ActivateDialog.Title.GetLocalizedString(languageCode);
            Modal.TitleCssClass = gridMetadata.ActivateDialog.TitleCssClass;
        }
예제 #3
0
        /// <summary>
        /// Removes the structure from the database.
        /// </summary>
        private void ObjectOnDelete(IObjectContainer container)
        {
            try
            {
                for (int i = 0; i < byteBuffers.Count; i++)
                {
                    IUpdateAction activateIndividualBufferAction = new ActivateAction(byteBuffers[i], 1);
                    IUpdateAction deleteIndividualBufferAction   = new DeleteAction(byteBuffers[i]);
                    IUpdateAction clearIndividualBufferAction    = new DeactivateAction(byteBuffers[i], 1);
                    DatabaseManager.Instance.PerformDataUpdate(activateIndividualBufferAction,
                                                               deleteIndividualBufferAction,
                                                               clearIndividualBufferAction);
                }

                IUpdateAction deleteListOfBuffers = new DeleteAction(byteBuffers);
                IUpdateAction clearListOfBuffers  = new DeactivateAction(byteBuffers, 1);
                DatabaseManager.Instance.PerformDataUpdate(deleteListOfBuffers, clearListOfBuffers);
            }

            catch (DatabaseException) { }
        }
예제 #4
0
        /// <summary>
        /// Writes a file to disc, reading it from the list fo buffers.
        /// </summary>
        /// <param name="completePath">The complete path to the file</param>
        public void WriteFileToDisc(string completePath)
        {
            int    splitPosition = completePath.LastIndexOf(Path.DirectorySeparatorChar);
            string folderRoot    = completePath.Substring(0, splitPosition);

            try
            {
                if (Directory.Exists(folderRoot) == false)
                {
                    Directory.CreateDirectory(folderRoot);
                }

                FileInfo info = new FileInfo(completePath);

                using (FileStream stream = info.OpenWrite())
                {
                    IUpdateAction getByteBuffersAction = new ActivateAction(byteBuffers, 1);
                    DatabaseManager.Instance.PerformDataUpdate(getByteBuffersAction);

                    for (int i = 0; i < byteBuffers.Count; i++)
                    {
                        IUpdateAction getIndividualBufferAction = new ActivateAction(byteBuffers[i], 1);
                        DatabaseManager.Instance.PerformDataUpdate(getIndividualBufferAction);

                        stream.Write(byteBuffers[i].Buffer, 0, byteBuffers[i].Buffer.Length);

                        IUpdateAction clearIndividualBufferAction = new DeactivateAction(byteBuffers[i], 1);
                        DatabaseManager.Instance.PerformDataUpdate(clearIndividualBufferAction);
                    }
                }
            }

            catch (Exception ex)
            {
                throw new DiscAccessException(String.Format("{0}{1}{2}",
                                                            "Could not write the file \"",
                                                            completePath,
                                                            "\" to disc."), ex);
            }
        }