Пример #1
0
        public virtual ActionResult City(string urlName)
        {
            City city;

            if (urlName == null)
            {
                var cityTC = UserSettingsService.CityTC;
                if (cityTC == null || cityTC == Cities.Moscow)
                {
                    return(Redirect(MainMenu.Urls.Locations));
                }
                city = CityService.GetByPK(cityTC);
            }
            else
            {
                city = CityService.GetAll().ByUrlName(urlName);
            }
            if (city == null)
            {
                return(Redirect(MainMenu.Urls.Locations));
            }
            var model =
                new CityVM {
                City      = city,
                Complexes = ComplexService.GetAll().ByCity(city.City_TC).ToList(),
                Locations = SimplePageService.GetAll().BySysName(SimplePages.Locations),
                Cities    = CityService.GetAll()
                            .Where(c => c.City_TC != city.City_TC).ToList(),
                Groups = GroupService.GetPlannedAndNotBegin().Where(x => x.WebinarExists).Take(20).ToList()
            };

            return(View(model));
        }
Пример #2
0
        public virtual ActionResult Complex(string urlName)
        {
            ComplexService.LoadWith(b => b.Load(x => x.BranchOffice, x => x.Admin).And <BranchOffice>(x => x.City));
            var complex = ComplexService.GetAll().ByUrlName(urlName);

            if (complex == null)
            {
                return(null);
            }
            if (complex.Complex_TC == Cities.Complexes.Partners)
            {
                return(Redirect(SimplePages.FullUrls.Partners));
            }
            if (!complex.IsPublished)
            {
                return(RedirectToAction(() => City(complex.BranchOffice.City.UrlName)));
            }
            var responses = ResponseService.GetAll()
                            .IsActive().Where(x => x.Complex_TC == complex.Complex_TC)
                            .OrderByDescending(x => x.UpdateDate).ToList();
            var otherComplexes = ComplexService.GetAll(x => x.IsPublished &&
                                                       x.UrlName != urlName).ToList();
            var model = new ComplexVM
            {
                Complex         = complex,
                OtherComplexes  = otherComplexes,
                Responses       = responses,
                NearestGroupSet = GroupService.GetNearestGroups(complex),
                GeoLocation     = Cities.Complexes.GeoLocations.GetValueOrDefault(complex.Complex_TC)
            };

            return(MView(Views.Locations.Complex, model));
        }
Пример #3
0
 private void InitDictionary(GroupFilter filter)
 {
     filter           = filter ?? new GroupFilter();
     filter.DayShifts = DayShiftService.GetAll().ToList();
     filter.Complexes = ComplexService.List().Select(x => x.Value).Where(c => c.IsPublished).ToList();
     filter.Sections  = SectionService.GetSectionsTree();
     filter.Employees = EmployeeService.GetAllTrainers();
 }
Пример #4
0
        private void AddControlCenter(SimplePageVM model)
        {
            var graduates =
                model.EntityWithTags.FirstOrDefault(x =>
                                                    x.Entity.As <SimplePage>().SysName == SimplePages.Graduates);

            if (graduates == null)
            {
                return;
            }
            var privatePerson = new List <SimplePage> {
                new SimplePage {
                    UrlName = SimplePages.Urls.SuccessStories, Title = "Истории успеха"
                },
                new SimplePage {
                    UrlName = SimplePages.Urls.Responses, Title = "Отзывы"
                },
                new SimplePage {
                    UrlName = SimplePages.Urls.Works, Title = "Работы выпускников"
                },
            };

            foreach (var simplePage in privatePerson)
            {
                simplePage.UrlName = "client/privateperson/"
                                     + simplePage.UrlName;
            }

            graduates.List.InsertRange(0, privatePerson.Cast <IEntityCommonInfo>());

            var locations =
                model.EntityWithTags.FirstOrDefault(x =>
                                                    x.Entity.As <SimplePage>().SysName == SimplePages.Locations);

            if (locations == null)
            {
                return;
            }
            var city =
                CityService.GetAll().First(c => c.City_TC == Cities.Moscow).As <IEntityCommonInfo>();
            var entityes = _.List(city).AddFluent(ComplexService.List()
                                                  .Select(x => x.Value).Where(x => x.IsPublished));

            locations.List = entityes;
        }
Пример #5
0
        public ActionResult Details(int?newsID, string title)
        {
            if (newsID == null)
            {
                return(null);
            }
            var news = NewsService.GetByPK(newsID);

            if (news == null || !news.IsActive)
            {
                return(null);
            }
            var currentTitle = Linguistics.UrlTranslite(news.Title);

            if (title != currentTitle)
            {
                return(new RedirectResult(Url
                                          .Action <SiteNewsController>(
                                              c => c.Details(newsID, currentTitle)), true));
            }

            GroupRepository.LoadWith(x => x.GroupCalc);
            var seminar = GroupRepository.GetAll()
                          .SeminarsFilter()
                          .OrderByDescending(x => x.DateBeg)
                          .FirstOrDefault(x => x.UrlName == "/news/" + newsID);

            if (seminar != null)
            {
                seminar.Complex = seminar.Complex_TC.GetOrDefault(x => ComplexService.List()[x]);
            }
            var model =
                new NewsVM
            {
                News    = news,
                Seminar = seminar
            };

            return(MView(Views.SiteNews.Details, model));
        }
Пример #6
0
 private List <Complex> GetComplexes()
 {
     return(ComplexService.GetAll(x => x.IsPublished).ToList());
 }