Ejemplo n.º 1
0
        internal static EntityObject GetById <T>(int id)
            where T : EntityObject
        {
            if (typeof(T) == typeof(Article))
            {
                return(ArticleRepository.GetById(id));
            }

            if (typeof(T) == typeof(Site))
            {
                return(SiteRepository.GetById(id));
            }

            if (typeof(T) == typeof(Content))
            {
                return(ContentRepository.GetById(id));
            }

            if (typeof(T) == typeof(Field))
            {
                return(FieldRepository.GetById(id));
            }

            throw new Exception("Unsupported entity object type");
        }
Ejemplo n.º 2
0
        public static IEnumerable <BackendActionStatus> ResolveStatusesForField(this IEnumerable <BackendActionStatus> statuses, int entityId)
        {
            var field = FieldRepository.GetById(entityId);

            if (field != null)
            {
                if (field.TypeId != FieldTypeCodes.DynamicImage)
                {
                    var dynStatus = statuses.SingleOrDefault(s => s.Code == ActionCode.RecreateDynamicImages);
                    if (dynStatus != null)
                    {
                        dynStatus.Visible = false;
                    }
                }

                if (field.TypeId == FieldTypeCodes.DynamicImage || field.TypeId == FieldTypeCodes.M2ORelation)
                {
                    var applyStatus = statuses.SingleOrDefault(s => s.Code == ActionCode.ApplyFieldDefaultValue);
                    if (applyStatus != null)
                    {
                        applyStatus.Visible = false;
                    }
                }
            }

            return(statuses);
        }
Ejemplo n.º 3
0
        public void FilterEmployeeTest()
        {
            EmployeeRepository employeeRepository = new EmployeeRepository(new VitalityDatabase());
            CollegeRepository  collegeRepository  = new CollegeRepository(new VitalityDatabase());
            Employee           employee           = new Employee();
            College            college            = new College();
            FieldRepository    fieldRepository    = new FieldRepository(new VitalityDatabase());
            Field field = new Field();

            field.Name = "Yazılım";

            fieldRepository.Insert(field);


            college.Name       = "9 Eylül";
            employee.FirstName = "Aybars";
            employee.LastName  = "Agacabuga";

            collegeRepository.Insert(college);
            employee.CollegeId = college.Id;
            employee.FieldId   = field.Id;


            employeeRepository.Insert(employee);

            var fieldList = employeeRepository.GetListByFilter(x => x.College.Name == "9 Eylül").ToList();

            // var name = fieldList[0].College.Name;
            //   Assert.IsTrue(name == "9 Eylül");
        }
Ejemplo n.º 4
0
        private static ArticleInitListResult InitList(int contentId, bool isArchive, bool?boundToExternal)
        {
            var result  = new ArticleInitListResult();
            var content = ContentRepository.GetById(contentId);

            if (content == null)
            {
                throw new Exception(string.Format(ContentStrings.ContentNotFound, contentId));
            }

            result.IsVirtual   = content.IsVirtual;
            result.PageSize    = content.PageSize;
            result.ContentName = content.Name;
            result.IsUpdatable = content.IsUpdatable;

            var titleField = FieldRepository.GetTitleField(contentId);

            result.TitleFieldName     = titleField == null ? FieldName.ContentItemId : titleField.FormName;
            result.DisplayFields      = FieldRepository.GetList(contentId, true);
            result.IsAddNewAccessable = !isArchive && SecurityRepository.IsActionAccessible(ActionCode.AddNewArticle) && SecurityRepository.IsEntityAccessible(EntityTypeCode.Content, contentId, ActionTypeCode.Update);
            result.IsArticleChangingActionsAllowed = content.IsArticleChangingActionsAllowed(boundToExternal);
            result.ContentDisableChangingActions   = content.DisableChangingActions;

            return(result);
        }
Ejemplo n.º 5
0
        public List <FieldValue> LoadFieldValues(bool forArticle = false)
        {
            if (Article == null)
            {
                return(null);
            }

            List <FieldValue> result;

            if (Id == CurrentVersionId)
            {
                result = Article.FieldValues;
            }
            else
            {
                if (_versionRowData.Value == null)
                {
                    throw new Exception(string.Format(ArticleStrings.ArticleVersionNotFoundForArticle, Id, ArticleId));
                }

                var fields = FieldRepository.GetFullList(Article.DisplayContentId);
                result = Article.GetFieldValues(_versionRowData.Value, fields, Article, Id);
            }

            ProcessFieldValues(result, forArticle);
            LoadAggregateArticles(result, forArticle);
            _fieldValues = result;

            return(result);
        }
Ejemplo n.º 6
0
        private static string GetArticleTitle(long contentItemId, decimal contentId)
        {
            var displayFields = ContentRepository.GetDisplayFields((int)contentId, true);

            var r = displayFields.Select(x =>
            {
                var relatedField        = x.RelationId != null ? FieldRepository.GetById(x.RelationId.Value) : null;
                var relatedRelatedField = relatedField?.RelationId != null ? FieldRepository.GetById(relatedField.RelationId.Value) : null;
                return(new
                {
                    Field = x,
                    RelatedField = relatedField,
                    RelatedRelatedField = relatedRelatedField
                });
            })
                    .OrderBy(x => x.Field.Order)
                    .FirstOrDefault();

            using (var scope = new QPConnectionScope())
            {
                return(Common.GetArticleTitle(scope.DbConnection,
                                              contentItemId,
                                              contentId,
                                              r?.Field?.Name, r?.RelatedField?.Name, r?.RelatedField?.ContentId, r?.RelatedRelatedField?.Name, r?.RelatedRelatedField?.ContentId));
            }
        }
Ejemplo n.º 7
0
        public static FieldCopyResult Copy(int id, int?forceId, int?forceLinkId, int[] forceVirtualFieldIds, int[] forceChildFieldIds, int[] forceChildLinkIds)
        {
            var result = new FieldCopyResult();
            var field  = FieldRepository.GetById(id);

            if (field == null)
            {
                throw new Exception(string.Format(FieldStrings.FieldNotFound, id));
            }

            if (!field.Content.Site.IsUpdatable || !field.IsAccessible(ActionTypeCode.Read))
            {
                result.Message = MessageResult.Error(ContentStrings.CannotCopyBecauseOfSecurity);
                return(result);
            }

            switch (field.ExactType)
            {
            case FieldExactTypes.M2ORelation:
                result.Message = MessageResult.Error(FieldStrings.UnableToCopyM2O);
                break;

            case FieldExactTypes.Classifier:
                result.Message = MessageResult.Error(FieldStrings.UnableToCopyClassifier);
                break;

            default:
                if (field.ExactType == FieldExactTypes.O2MRelation && field.Aggregated)
                {
                    result.Message = MessageResult.Error(FieldStrings.UnableToCopyAggregator);
                }
                else
                {
                    if (forceId.HasValue)
                    {
                        field.ForceId = forceId.Value;
                    }

                    field.ForceVirtualFieldIds = forceVirtualFieldIds;
                    if (field.ContentLink != null && forceLinkId.HasValue)
                    {
                        field.ContentLink.ForceLinkId = forceLinkId.Value;
                    }

                    field.ForceChildFieldIds = forceChildFieldIds;
                    field.ForceChildLinkIds  = forceChildLinkIds;
                    field.LoadVeBindings();

                    var resultField = FieldRepository.Copy(field);
                    result.Id              = resultField.Id;
                    result.LinkId          = resultField.LinkId;
                    result.VirtualFieldIds = resultField.NewVirtualFieldIds;
                    result.ChildFieldIds   = resultField.ResultChildFieldIds;
                    result.ChildLinkIds    = resultField.ResultChildLinkIds;
                }
                break;
            }

            return(result);
        }
Ejemplo n.º 8
0
        public static IEnumerable <DataRow> CopyVirtualContents(int sourceSiteId, int destinationSiteId)
        {
            var newContents   = ContentRepository.CopyVirtualContents(sourceSiteId, destinationSiteId).ToList();
            var newContentIds = string.Join(",", newContents.Select(r => r.Field <int>("content_id_new")));

            FieldRepository.CopyContentsAttributes(sourceSiteId, destinationSiteId, newContentIds, true);

            var relBetweenAttributes = FieldRepository.GetRelationsBetweenAttributesXml(sourceSiteId, destinationSiteId, string.Empty, null, true);

            if (string.IsNullOrEmpty(newContentIds))
            {
                newContentIds = "0";
            }

            FieldRepository.UpdateAttributes(sourceSiteId, destinationSiteId, relBetweenAttributes, newContentIds);
            ContentRepository.CopyUnionContents(sourceSiteId, destinationSiteId, newContentIds);
            ContentRepository.UpdateVirtualContentAttributes(sourceSiteId, destinationSiteId);

            FieldRepository.UpdateAttributesOrder(destinationSiteId, relBetweenAttributes, newContentIds);

            ContentRepository.CopyContentsGroups(sourceSiteId, destinationSiteId);
            ContentRepository.UpdateContentGroupIds(sourceSiteId, destinationSiteId);

            var relBetweenContents = ContentRepository.GetRelationsBetweenContentsXml(sourceSiteId, destinationSiteId, string.Empty);

            ContentRepository.CopyUserQueryContents(relBetweenContents);

            ContentRepository.CopyUserQueryAttributes(relBetweenContents, relBetweenAttributes);

            return(newContents);
        }
 public HttpResponseMessage Post(HttpRequestMessage request, CreateFieldCommand command)
 {
     var repository = new FieldRepository();
     var field = new Field(command.Name, command.Description, command.DataType, command.FieldType);
     repository.AddField(field);
     return request.CreateResponse(HttpStatusCode.Created, new FieldViewModel(field));
 }
        public IEnumerable <ChildEntityPermissionListItem> List(int contentId, int?groupId, int?userId, ListCommand cmd, out int totalRecords)
        {
            using (var scope = new QPConnectionScope())
            {
                var titleField     = FieldRepository.GetTitleField(contentId);
                var titleFieldName = titleField == null ? FieldName.ContentItemId : titleField.Name;

                cmd.SortExpression = TranslateHelper.TranslateSortExpression(cmd.SortExpression);
                IEnumerable <DataRow> rows;
                totalRecords = 0;
                if (userId.HasValue)
                {
                    rows = Common.GetChildArticlePermissionsForUser(scope.DbConnection, contentId, userId.Value, titleFieldName, cmd.SortExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
                }
                else if (groupId.HasValue)
                {
                    rows = Common.GetChildArticlePermissionsForGroup(scope.DbConnection, contentId, groupId.Value, titleFieldName, cmd.SortExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
                }
                else
                {
                    throw new ArgumentNullException(nameof(groupId));
                }

                return(MapperFacade.ChildEntityPermissionListItemRowMapper.GetBizList(rows.ToList()));
            }
        }
Ejemplo n.º 11
0
        public void InsertEmployeeTest()

        {
            CollegeRepository  collegeRepository  = new CollegeRepository(new VitalityDatabase());
            FieldRepository    fieldRepository    = new FieldRepository(new VitalityDatabase());
            EmployeeRepository employeeRepository = new EmployeeRepository(new Data.Entities.VitalityDatabase());


            Employee employee = new Employee();
            Field    field    = new Field();
            College  college  = new College();

            field.Name   = "Yazılım";
            college.Name = "İstanbul Üniversitesi";

            employee.FirstName = "Aybars";
            employee.LastName  = "Agcabuga";

            fieldRepository.Insert(field);
            collegeRepository.Insert(college);

            employee.FieldId   = field.Id;
            employee.CollegeId = college.Id;



            Assert.IsTrue(employeeRepository.Insert(employee));
        }
Ejemplo n.º 12
0
        public static Field Update(Field item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (!FieldRepository.Exists(item.Id))
            {
                throw new ApplicationException(string.Format(FieldStrings.FieldNotFound, item.Id));
            }

            if (item.Content.VirtualType == VirtualType.None)
            {
                throw new ApplicationException($"Content {item.Content.Id} of field {item.Id} is not virtual.");
            }

            using (VirtualFieldRepository.LoadVirtualFieldsRelationsToMemory(item.ContentId))
            {
                var newField = ((IFieldRepository) new FieldRepository()).Update(item);
                var helper   = new VirtualContentHelper();

                helper.DropContentViews(newField.Content);
                helper.CreateContentViews(newField.Content);

                // Обновить дочерние виртуальные контенты
                helper.UpdateVirtualFields(newField);
                return(newField);
            }
        }
Ejemplo n.º 13
0
        internal static void LoadStructureCache(bool clearExternal)
        {
            ClearInternalStructureCache();
            if (clearExternal)
            {
                ClearExternalStructureCache();
            }

            if (GetSiteCache() == null)
            {
                SetSiteCache(SiteRepository.GetAll().ToDictionary(n => n.Id));
            }

            if (GetContentCache() == null)
            {
                SetContentCache(ContentRepository.GetAll().ToDictionary(n => n.Id));
            }

            IEnumerable <Field> fields = new Field[0];

            if (GetFieldCache() == null || GetContentFieldCache() == null)
            {
                fields = FieldRepository.GetAll();
            }

            if (GetFieldCache() == null)
            {
                SetFieldCache(fields.ToDictionary(n => n.Id));
            }

            if (GetStatusTypeCache() == null)
            {
                SetStatusTypeCache(StatusTypeRepository.GetAll().ToDictionary(n => n.Id));
            }

            if (GetUserCache() == null)
            {
                SetUserCache(UserRepository.GetAllUsersList().ToDictionary(n => n.Id));
            }

            if (GetContentFieldCache() == null)
            {
                var dict = new Dictionary <int, List <int> >();
                foreach (var item in fields)
                {
                    if (dict.ContainsKey(item.ContentId))
                    {
                        dict[item.ContentId].Add(item.Id);
                    }
                    else
                    {
                        dict.Add(item.ContentId, new List <int> {
                            item.Id
                        });
                    }
                }

                SetContentFieldCache(dict);
            }
        }
Ejemplo n.º 14
0
        private static Tuple <Field, Field> GetFields(int fieldId)
        {
            var field = FieldRepository.GetById(fieldId);

            if (field == null)
            {
                throw new ApplicationException(string.Format(FieldStrings.FieldNotFound, fieldId));
            }

            if (field.TypeId != FieldTypeCodes.DynamicImage)
            {
                throw new ApplicationException(string.Format(FieldStrings.FieldIsNotDynamicImage, fieldId));
            }

            if (field.BaseImageId != null)
            {
                var basefield = FieldRepository.GetById(field.BaseImageId.Value);
                if (basefield == null)
                {
                    throw new ApplicationException(string.Format(FieldStrings.FieldNotFound, field.BaseImageId.Value));
                }

                return(Tuple.Create(field, basefield));
            }

            return(null);
        }
Ejemplo n.º 15
0
 public Field Read(int id)
 {
     using (new QPConnectionScope(ConnectionString))
     {
         return(FieldRepository.GetById(id));
     }
 }
Ejemplo n.º 16
0
        public void CreateField(Guid userId, Guid fieldId, FileViewModel fileViewModel)
        {
            //string pathToAzureFile = new AzureManager()
            //                                .UploadFile(fileViewModel.InputStream);

            string pathToAzureFile = "test";
            string fileName        = Path.GetFileNameWithoutExtension(fileViewModel.FileName);
            string extension       = Path.GetExtension(fileViewModel.FileName);

            FieldRepository
            .Insert(new Field()
            {
                ParentDirectoryId = fieldId,
                Name             = fileName,
                Extension        = extension,
                Type             = FieldType.File,
                LastModifiedById = userId,
                FieldInformation = new FieldInformation()
                {
                    Size = fileViewModel.ContentLength,
                    Blob = new Blob()
                    {
                        Localisation = pathToAzureFile
                    }
                }
            });
        }
Ejemplo n.º 17
0
        public UpdateFieldDefinitionStatus UpdateField(int fieldId, string name, bool required)
        {
            FieldDefinition field = FieldRepository.Get(fieldId);

            if (Get(field.FormDefinitionID) == null)
            {
                return(UpdateFieldDefinitionStatus.NoSuchFieldDefinition);
            }

            if (!Validator.CheckName(name))
            {
                return(UpdateFieldDefinitionStatus.InvalidName);
            }

            if (!ProjectService.CanUserManage(field.FormDefinition.ProjectID))
            {
                return(UpdateFieldDefinitionStatus.PermissionDenied);
            }

            field.Name     = name;
            field.Required = required;
            FieldRepository.Update(field);
            ActivityService.FieldDefinitionUpdated(field.ID);
            return(UpdateFieldDefinitionStatus.Updated);
        }
Ejemplo n.º 18
0
 public IEnumerable <Field> List(int contentId)
 {
     using (new QPConnectionScope(ConnectionString))
     {
         return(FieldRepository.GetFullList(contentId));
     }
 }
Ejemplo n.º 19
0
 public UnitOfWork(XdContext context)
 {
     _context            = context;
     AddressInformations = new AddressInformationRepository(_context);
     AppUsers            = new AppUserRepository(_context);
     AppUserRoles        = new AppUserRoleRepository(_context);
     Contacts            = new ContactRepository(_context);
     Credentials         = new CredentialsRepository(_context);
     DbTypes             = new DbTypeRepository(_context);
     Entities            = new EntityRepository(_context);
     EntityTypes         = new EntityTypeRepository(_context);
     Fields = new FieldRepository(_context);
     FieldRequirementLevels = new FieldRequirementLevelRepository(_context);
     FieldTypes             = new FieldTypeRepository(_context);
     Forms           = new FormRepository(_context);
     FormTypes       = new FormTypeRepository(_context);
     Genders         = new GenderRepository(_context);
     MaritalStatuses = new MaritalStatusRepository(_context);
     MenuItems       = new MenuItemRepository(_context);
     Roles           = new RoleRepository(_context);
     Tabs            = new TabRepository(_context);
     Titles          = new TitleRepository(_context);
     Views           = new ViewRepository(_context);
     ViewTypes       = new ViewTypeRepository(_context);
 }
Ejemplo n.º 20
0
        public void SetCorrespondingFieldName(FormCollection collection)
        {
            NewFieldsList = new List <KeyValuePair <string, BLL.Field> >();
            UniqueAggregatedFieldsToUpdate = new Dictionary <int, string>();
            foreach (var key in collection.AllKeys.Where(s => s.StartsWith(FieldPrefix)))
            {
                if (key.StartsWith(IdPrefix))
                {
                    if (int.TryParse(key.Replace(IdPrefix, string.Empty), out var contentId))
                    {
                        UniqueAggregatedFieldsToUpdate[contentId] = collection[key];
                    }
                }
                else if (key.StartsWith(FieldPrefix))
                {
                    if (int.TryParse(key.Replace(FieldPrefix, string.Empty), out var fieldId))
                    {
                        var field = FieldRepository.GetById(fieldId);
                        if (field != null)
                        {
                            NewFieldsList.Add(new KeyValuePair <string, BLL.Field>(collection[key], field));
                        }
                    }
                }
            }

            if (int.TryParse(UniqueContentFieldId, out var uniqueFieldId))
            {
                UniqueContentField = FieldRepository.GetById(uniqueFieldId);
            }
        }
Ejemplo n.º 21
0
        private string GetFilterColumnHtml(IContentContext contentContext)
        {
            var builder = new StringBuilder();

            var fieldInfoList = FieldRepository.GetFieldInfoList(contentContext.SiteId);

            foreach (var fieldInfo in fieldInfoList)
            {
                fieldInfo.TagInfoList = TagRepository.GetTagInfoList(fieldInfo.Id, 0);
                if (fieldInfo.TagInfoList == null || fieldInfo.TagInfoList.Count == 0)
                {
                    continue;
                }

                fieldInfo.CheckedTagIds = ValueRepository.GetTagIdList(contentContext.SiteId, contentContext.ChannelId, contentContext.ContentId, fieldInfo.Id);

                if (fieldInfo.CheckedTagIds == null || fieldInfo.CheckedTagIds.Count == 0)
                {
                    continue;
                }

                var tagInfoList = fieldInfo.TagInfoList.FindAll(x => fieldInfo.CheckedTagIds.Contains(x.Id));
                if (tagInfoList.Count == 0)
                {
                    continue;
                }

                foreach (var tagInfo in tagInfoList)
                {
                    builder.Append($@"<span class=""badge badge-light"">{tagInfo.Title}</span>");
                }
            }

            return(builder.ToString());
        }
Ejemplo n.º 22
0
        public override void Startup(IService service)
        {
            PluginVersion = Version;

            var formRepository      = new FormRepository();
            var fieldRepository     = new FieldRepository();
            var fieldItemRepository = new FieldItemRepository();
            var logRepository       = new LogRepository();

            service
            .AddSiteMenu(siteId =>
            {
                var formInfoList = FormManager.GetFormInfoList(siteId, 0);
                var menus        = formInfoList.Where(formInfo => !string.IsNullOrEmpty(formInfo.Title)).Select(formInfo => new Menu
                {
                    Text = FormManager.GetFormTitle(formInfo),
                    Href = $"pages/logs.html?formId={formInfo.Id}"
                }).ToList();

                menus.Add(new Menu
                {
                    Text = "表单管理",
                    Href = "pages/forms.html"
                });
                menus.Add(new Menu
                {
                    Text = "表单模板",
                    Href = "pages/templates.html"
                });

                return(new Menu
                {
                    Text = "表单",
                    IconClass = "ion-android-list",
                    Menus = menus
                });
            })
            .AddContentMenu(contentInfo =>
            {
                var formInfo =
                    FormManager.GetFormInfoByContentId(contentInfo.SiteId, contentInfo.ChannelId, contentInfo.Id);

                var menu = new Menu
                {
                    Text = FormManager.GetFormTitle(formInfo),
                    Href = "pages/logs.html"
                };

                return(menu);
            })
            .AddDatabaseTable(formRepository.TableName, formRepository.TableColumns)
            .AddDatabaseTable(fieldRepository.TableName, fieldRepository.TableColumns)
            .AddDatabaseTable(fieldItemRepository.TableName, fieldItemRepository.TableColumns)
            .AddDatabaseTable(logRepository.TableName, logRepository.TableColumns)
            .AddStlElementParser(StlForm.ElementName, StlForm.Parse)
            ;

            service.ContentDeleteCompleted += Service_ContentDeleteCompleted;
        }
Ejemplo n.º 23
0
 public IEnumerable <ListItem> GetStringFieldsAsListItemsByContentId(int contentId)
 {
     return(FieldRepository.GetFullList(contentId).Where(f => f.TypeId == 1).Select(field => new ListItem
     {
         Text = field.Name,
         Value = field.Id.ToString()
     }).ToArray());
 }
Ejemplo n.º 24
0
        public void InsertFieldTest()
        {
            FieldRepository fieldRepository = new FieldRepository(new Data.Entities.VitalityDatabase());
            Field           field           = new Field();

            field.Name = "Deniz";
            Assert.IsTrue(fieldRepository.Insert(field));
        }
Ejemplo n.º 25
0
 public IList <int> GetParentIds(IList <int> ids, int fieldId)
 {
     using (new QPConnectionScope(ConnectionString))
     {
         var treeField = FieldRepository.GetById(fieldId);
         return(ArticleRepository.GetParentIds(ids, treeField.Id, treeField.Name));
     }
 }
Ejemplo n.º 26
0
        private string GetUserData(string template_fields, out bool conent_publish)
        {
            string user_data = string.Empty; conent_publish = false;

            using (FieldRepository field_repository = new FieldRepository())
            {
                List <dynamic> fields = field_repository.GetByIDs(template_fields);

                foreach (var item in fields)
                {
                    if (item.field_name == "content_publish")
                    {
                        conent_publish = true;
                    }

                    if (item.field_group != "Пользовательские")
                    {
                        continue;
                    }

                    string value = null;

                    switch ((string)item.field_type)
                    {
                    case "boolean":
                        value = "0";
                        break;

                    case "decimal":
                        decimal decimal_val;

                        value = value.Replace(",", ".");

                        if (!Decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal_val))
                        {
                            value = "0";
                        }
                        break;

                    case "integer":
                        int int_val;
                        if (!Int32.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out int_val))
                        {
                            value = "0";
                        }
                        break;

                        // !!! ЕСЛИ ЛИСТ - ТО ВЫБРАТЬ ПЕРВОЕ ЗНАЧЕНИЕ
                    }


                    user_data += string.Format(",{0} = {1}", item.field_name, value ?? "NULL");
                }
            }

            return(user_data);
        }
Ejemplo n.º 27
0
        public ActionResult Index()
        {
            using (FieldRepository field_repository = new FieldRepository())
            {
                ViewBag.items = field_repository.All();
            }

            return(View());
        }
Ejemplo n.º 28
0
        public static ListResult <SimpleDataRow> List(int contentId, int[] selectedArticleIDs, ListCommand cmd, IList <ArticleSearchQueryParam> searchQueryParams, IList <ArticleContextQueryParam> contextQueryParams, string filter, ArticleFullTextSearchQueryParser ftsParser, bool?onlyIds = null, int[] filterIds = null)
        {
            var dt     = ArticleRepository.GetList(contentId, selectedArticleIDs, cmd, searchQueryParams, contextQueryParams, filter, ftsParser, onlyIds, filterIds ?? new int[] { }, out var totalRecords).ToList();
            var result = ArticleListHelper.GetResult(dt, FieldRepository.GetList(contentId, true), onlyIds).ToList();

            return(new ListResult <SimpleDataRow> {
                Data = result, TotalRecords = totalRecords
            });
        }
Ejemplo n.º 29
0
        public static IEnumerable <Field> GetRelatedM2OFields(int contentId)
        {
            var context  = QPContext.EFContext;
            var fieldIds = (from f1 in context.FieldSet
                            join f2 in context.FieldSet on f1.Id equals f2.BackRelationId
                            where f1.ContentId == contentId && f2.ContentId != contentId
                            select(int) f2.Id).ToArray();

            return(FieldRepository.GetList(fieldIds));
        }
Ejemplo n.º 30
0
 public StudentController()
 {
     _studentRepository      = new StudentRepository();
     _fieldRepository        = new FieldRepository();
     _governateRepostiory    = new GovernateRepostiory();
     _neighborhoodRepository = new NeighborhoodRepository();
     _teacherReposiotry      = new TeacherReposiotry();
     _context = new DataContext();
     //_studentRepository = new StudentRepository(_context);
 }
Ejemplo n.º 31
0
 private void DeleteDirectory(Guid fieldId)
 {
     FieldRepository
     .Get(n => n.ParentDirectoryId == fieldId)
     .Select(n =>
     {
         n.ParentDirectoryId = null;
         return(n);
     });
 }