Пример #1
0
        private void FillCollectionServices()
        {
            var backupCollectionService = CollectionServices;
            var collectionServices      = new GroupContentList {
                IsTop = true
            };

            try
            {
                var categories = BaseAPI.getGroups();
                AttractionInfo[] attractions;
                if (categories.IsNullOrEmpty())
                {
                    Log.Debug("Категории не найдены! Все аттракционы будут загружены в корневую группу.");
                    attractions = BaseAPI.getAttractionsFromGroup(new AttractionGroupInfo());
                    if (attractions.IsNullOrEmpty())
                    {
                        return;
                    }
                    collectionServices.AddRange(attractions.OrderBy(i => i.Number).Select(attraction => new ParkService(attraction)));
                }
                else
                {
                    var list = new List <IGroupContentItem>();
                    var sb   = new StringBuilder();
                    foreach (var category in categories)
                    {
                        attractions = BaseAPI.getAttractionsFromGroup(category);
                        if (category.Type == 0)
                        {
                            list.AddRange(attractions.OrderBy(i => i.Number).Select(attraction => new ParkService(attraction)));
                        }
                        else
                        {
                            list.Add(new CategoryService(category, attractions));
                        }

                        foreach (var a in attractions)
                        {
                            sb.AppendLine("Аттракцион {0} добавлен в группу {1}".F(a.DisplayName, category.Title));
                        }
                    }
                    Log.Debug(sb);

                    collectionServices.AddRange(list.OrderBy(i => i.Number));
                }
            }
            catch (Exception e)
            {
                Log.Fatal("Во время обновления списка аттракционов/категорий произошло исключение!", e);
                collectionServices = backupCollectionService;
            }


            CollectionServices = collectionServices;
            OnPropertyChanged(() => CollectionServices);
        }
Пример #2
0
        public CategoryService(AttractionGroupInfo group, IEnumerable <AttractionInfo> attractions)
        {
            if (group.Type == 0)
            {
                return;
            }
            Info = group;

            SubItemsCollection = new GroupContentList();
            SubItemsCollection.AddRange(attractions.OrderBy(i => i.Number).Select(attraction => new ParkService(attraction)));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // string currentPageFileName = new FileInfo(this.Request.Url.AbsolutePath).Name;
                var PermMgr = new PermissionManager(Session);

                if (PermMgr.IsAdmin || PermMgr.CanManageTestBatches)
                {
                    //from.Text = ErecruitHelper.GetDateStringFromDateX(DateTime.Now);
                    //to.Text = ErecruitHelper.GetDateStringFromDateX(DateTime.Now);
                    if (!IsPostBack)
                    {
                        //var l = Enum.GetValues(typeof(ErecruitHelper.BatchGroupsR)).Cast<ErecruitHelper.BatchGroupsR>().ToList();
                        //var bg = l.Select(a => new
                        //{
                        //    Id = a.ToString(),
                        //    Name = a.ToString()

                        //}).Distinct().OrderBy(s => s.Name).ToList();
                        //bgrp.DataSource = bg;
                        // bgrp.DataBind();
                        var tn    = long.Parse(SessionHelper.GetTenantID(Session));
                        var cands = new List <object> {
                            new { ID = "ALL", Name = "ALL" }
                        };
                        using (QuizBookDbEntities1 _db = new QuizBookDbEntities1())
                        {
                            var batches = _db.T_Batch.Where(x => x.TenantId == tn && x.IsActive.Value).Select(x => new
                            {
                                ID   = x.Id,
                                Name = x.Name
                            }).OrderByDescending(x => x.ID);
                            GroupContentList.DataSource = batches.ToList();
                            GroupContentList.DataBind();
                        }
                    }
                }
                else
                {
                    Response.Redirect("NoPermission.aspx", false);
                }
            }
            catch (Exception ex)
            {
                ErecruitHelper.SetErrorData(ex, Session);
                Response.Redirect("ErrorPage.aspx", false);
            }
        }
Пример #4
0
        internal static GroupSearchResult Search(String query, GroupContentList searchScope)
        {
            foreach (var item in searchScope)
            {
                if (CheckGroupContentListEq(query, item))
                {
                    return(new GroupSearchResult(item, searchScope));
                }
                if (item.SubItemsCollection.IsNullOrEmpty())
                {
                    continue;
                }

                var result = Search(query, item.SubItemsCollection);
                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }
Пример #5
0
 public GroupSearchResult(IGroupContentItem result, GroupContentList group)
 {
     Result = result;
     Group  = group;
 }
        private void GChangeState(string selectedGroup)
        {
            switch (selectedGroup)
            {
            case ErecruitHelper.BGSR.ALL:

                var cands = new List <object> {
                    new { ID = "ALL", Name = "ALL" }
                };
                GroupContentList.DataSource = cands;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGSR.BATCHES:
                var cands1 = _db.T_Batch.OrderBy(x => x.Name).Select(a => new
                {
                    ID   = a.Id,
                    Name = a.Name.ToUpper()
                }).ToList();
                GroupContentList.DataSource = cands1;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGS.BRANCH:
                var candsx = _db.branch_tab.OrderBy(x => x.branch_name).Select(a => new
                {
                    ID   = a.id,
                    Name = a.branch_name
                }).ToList();
                GroupContentList.DataSource = candsx;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGS.DIVISION:

                var cands2 = _db.division_tab.OrderBy(x => x.DIV_NAME).Select(a => new
                {
                    ID   = a.DIV_CODE,
                    Name = a.DIV_NAME
                }).ToList();
                GroupContentList.DataSource = cands2;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGS.GRADE:

                var cands3 = _db.grade_tab.OrderBy(x => x.GRADE_LEVEL).Select(a => new
                {
                    ID   = a.GRADE_CODE,
                    Name = a.GRADE_LEVEL
                }).ToList();
                GroupContentList.DataSource = cands3;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGS.BANK:

                var cands4 = _db.region_tab.OrderBy(x => x.region_name).Select(a => new
                {
                    ID   = a.region_code,
                    Name = a.region_name
                }).ToList();
                GroupContentList.DataSource = cands4;
                GroupContentList.DataBind();
                break;

            case ErecruitHelper.BGS.DIRECTORATE:
                //Clear Existing

                var cands5 = _db.sector_tab.OrderBy(x => x.SECTOR_NAME).Select(a => new
                {
                    ID   = a.SECTOR_CODE,
                    Name = a.SECTOR_NAME
                }).ToList();
                GroupContentList.DataSource = cands5;
                GroupContentList.DataBind();

                break;
            }
        }