コード例 #1
0
        private void PublishUnpublish(long id, AvrTreeElementType type, bool isPublish)
        {
            switch (type)
            {
            case AvrTreeElementType.Query:
                using (var service = new Query_DB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            case AvrTreeElementType.Layout:
                using (var service = new WebLayoutDB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            case AvrTreeElementType.Folder:
                using (var service = new Folder_DB())
                {
                    service.PublishUnpublish(id, isPublish);
                }
                break;

            default:
                throw new AvrException("Unsupported AvrTreeElementType " + type);
            }
        }
コード例 #2
0
        public static long GetGlobalId(long id, AvrTreeElementType type)
        {
            using (var manager = DbManagerFactory.Factory.Create())
            {
                switch (type)
                {
                case AvrTreeElementType.Layout:
                    var layoutAccessor = AvrLayoutLookup.Accessor.Instance(null);
                    var layoutLookup   = layoutAccessor.SelectLookupList(manager, id, null);
                    var foundLayout    = layoutLookup.SingleOrDefault();
                    if (foundLayout == null)
                    {
                        throw new AvrException(string.Format("Could not find Layout with ID {0} to unpublish", id));
                    }

                    if (!foundLayout.idfsGlobalLayout.HasValue)
                    {
                        throw new AvrException(string.Format("Could not unpublish non-published Layout with ID {0}", id));
                    }

                    return(foundLayout.idfsGlobalLayout.Value);

                case AvrTreeElementType.Folder:
                    var folderAccessor = AvrFolderLookup.Accessor.Instance(null);
                    var folderLookup   = folderAccessor.SelectLookupList(manager, id, null);
                    var foundFolder    = folderLookup.SingleOrDefault();
                    if (foundFolder == null)
                    {
                        throw new AvrException(string.Format("Could not find Folder with ID {0} to unpublish", id));
                    }

                    if (!foundFolder.idfsGlobalFolder.HasValue)
                    {
                        throw new AvrException(string.Format("Could not unpublish non-published Folder with ID {0}", id));
                    }

                    return(foundFolder.idfsGlobalFolder.Value);

                case AvrTreeElementType.Query:
                    var queryAccessor = AvrQueryLookup.Accessor.Instance(null);
                    var queryLookup   = queryAccessor.SelectLookupList(manager, id);
                    var foundQuery    = queryLookup.SingleOrDefault();
                    if (foundQuery == null)
                    {
                        throw new AvrException(string.Format("Could not find Query with ID {0} to unpublish", id));
                    }

                    if (!foundQuery.idfsGlobalQuery.HasValue)
                    {
                        throw new AvrException(string.Format("Could not unpublish non-published Query with ID {0}", id));
                    }

                    return(foundQuery.idfsGlobalQuery.Value);

                default:
                    throw new AvrException("Unsupported AvrTreeElementType " + type);
                }
            }
        }
コード例 #3
0
 public AvrTreeElement
     (long id, long?parentID, long?globalID, AvrTreeElementType elementType, long queryID, string defaultName,
     string nationalName, string description, bool readOnly, bool shared = false, string descriptionEnglish = "",
     long idDescription = -1, string layoutAuthor = "", bool isUseArchiveData = false)
 {
     ID                 = id;
     ParentID           = parentID;
     GlobalID           = globalID;
     QueryID            = queryID;
     ElementType        = elementType;
     DefaultName        = defaultName;
     NationalName       = nationalName;
     DescriptionID      = idDescription;
     Description        = description;
     DescriptionEnglish = descriptionEnglish;
     IsPublished        = ReadOnly = readOnly;
     IsShared           = shared;
     LayoutAuthor       = layoutAuthor;
     IsUseArchiveData   = isUseArchiveData;
 }
コード例 #4
0
        private void GetPublishParams
            (bool isPublish, AvrTreeElementType type, out string spName, out string inputParamName, out string outputParamName,
            out EventType eventType)
        {
            outputParamName = null;
            switch (type)
            {
            case AvrTreeElementType.Layout:
                if (isPublish)
                {
                    spName          = "spAsLayoutPublish";
                    inputParamName  = "@idflLayout";
                    outputParamName = "@idfsLayout";
                    eventType       = EventType.AVRLayoutPublishedLocal;
                }
                else
                {
                    spName          = "spAsLayoutUnpublish";
                    inputParamName  = "@idfsLayout";
                    outputParamName = "@idflLayout";
                    eventType       = EventType.AVRLayoutUnpublishedLocal;
                }
                break;

            case AvrTreeElementType.Folder:
                if (isPublish)
                {
                    spName          = "spAsFolderPublish";
                    inputParamName  = "@idflLayoutFolder";
                    outputParamName = "@idfsLayoutFolder";
                    eventType       = EventType.AVRLayoutFolderPublishedLocal;
                }
                else
                {
                    spName          = "spAsFolderUnpublish";
                    inputParamName  = "@idfsLayoutFolder";
                    outputParamName = "@idflLayoutFolder";
                    eventType       = EventType.AVRLayoutFolderUnpublishedLocal;
                }
                break;

            case AvrTreeElementType.Query:
                if (isPublish)
                {
                    spName          = "spAsQueryPublish";
                    inputParamName  = "@idflQuery";
                    outputParamName = "@idfsQuery";
                    eventType       = EventType.AVRQueryPublishedLocal;
                }
                else
                {
                    spName          = "spAsQueryUnpublish";
                    inputParamName  = "@idfsQuery";
                    outputParamName = "@idflQuery";
                    eventType       = EventType.AVRQueryUnpublishedLocal;
                }
                break;

            default:
                throw new AvrException("Unsupported AvrTreeElementType " + type);
            }
        }
コード例 #5
0
 public QueryLayoutDeleteCommand(object sender, long objectId, AvrTreeElementType objectType) : base(sender)
 {
     m_ObjectId   = objectId;
     m_ObjectType = objectType;
 }