예제 #1
0
 public void Initialize()
 {
     Article    = (Article)Activator.CreateInstance(typeof(Article), true);
     FieldModes = new Dictionary <int, CloningMode>();
     FieldModes.Add(FieldId, Mode);
     Article.FieldValues = new List <FieldValue>();
     BackwardFieldValues = new List <FieldValue>();
     Field = new Quantumart.QP8.BLL.Field();
 }
예제 #2
0
 public string GetRelationCondition(EntityField entityField, QP8BLL.Field qpField)
 {
     if (!String.IsNullOrWhiteSpace(entityField.RelationCondition))
     {
         return(entityField.RelationCondition);
     }
     if (!(entityField is BackwardRelationField) &&
         qpField.UseRelationCondition &&
         !String.IsNullOrWhiteSpace(qpField.RelationCondition))
     {
         return(qpField.RelationCondition);
     }
     return(null);
 }
예제 #3
0
        private string GetBackwardValue(Quantumart.QP8.BLL.Field field, int articleId, bool excludeArchive)
        {
            string res = string.Empty;

            if (field.RelationType == RelationType.ManyToMany && field.LinkId.HasValue)
            {
                res = ArticleService.GetLinkedItems(field.LinkId.Value, articleId, excludeArchive);
            }
            else if (field.RelationType == RelationType.ManyToOne || field.RelationType == RelationType.OneToMany)
            {
                res = ArticleService.GetRelatedItems(field.Id, articleId, excludeArchive);
            }

            return(res);
        }
예제 #4
0
        public T?GetCloningMode(Quantumart.QP8.BLL.Field field)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            if (FieldModes.ContainsKey(field.Id))
            {
                return(FieldModes[field.Id]);
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
        /// <exception cref="InvalidOperationException"/>
        public ArticleObject[] PreloadRelationArticles(
            EntityField entityField, HashSet <Article> visited, Dictionaries dictionaries = null)
        {
            if (entityField == null)
            {
                throw new ArgumentNullException(nameof(entityField));
            }
            if (visited == null)
            {
                throw new ArgumentNullException(nameof(visited));
            }

            QP8BLL.Field qpField = _fieldService.Read(entityField.FieldId);

            string relationCondition = GetRelationCondition(entityField, qpField);

            return(PreloadRelationArticles(entityField, relationCondition, visited, dictionaries));
        }