コード例 #1
0
        public ActionResult CourseInfo()
        {
            var courseTCs = GroupService.GetAll().PlannedAndNotBegin().NotSpecial().NotSeminars()
                            //.Where(x => x.DateBeg < DateTime.Now.AddDays(14))
                            .Where(x => x.PrintAnnounce)
                            .OrderBy(x => x.DateBeg)
                            .Select(g => g.Course_TC)
                            .ToList();

            var courseSources = Repository.GetAll(x => courseTCs.Contains(x.Course_TC))
                                .Select(c => new {
                c.Course_TC,
                c.UrlName,
                c.Name,
                c.AnnounceDescription
            }).ToList().OrderBy(x => courseTCs.IndexOf(x.Course_TC));
            var courses = EnumMap <Course>(courseSources).ToList();
            var model   = new JsTableVM {
                Title   = "Курсы",
                Columns = { { "", null }, { "Код", null }, { "Курс", null }, { "Анонс", null }, { "Отзывы", null } },
                Rows    = courses.Select(x => _.List(
                                             (object)Images.Entity(x),
                                             x.Course_TC,
                                             Html.CourseLinkAnchor(x.UrlName, x.Name).AbsoluteHref(),
                                             x.AnnounceDescription,
                                             ResponseService.GetAllForCourse(x.Course_TC).Count()
                                             ))
            };

            return(View(ViewNames.JsTable, model));
        }
コード例 #2
0
        public ActionResult TagsReport(string id)
        {
            var courseTCs = StringUtils.SafeSplit(id);

            var courses = Repository.GetAll(x => courseTCs.Contains(x.Course_TC)).ToList();

            var model = new JsTableVM {
                Title   = "Привязки курсов",
                Columns = { { "Код",                 null },
                            { "Название",            null },
                            { "Новый",               null },
                            { "Привязки",            null },
                            { "Количество привязок", null } },
                Rows = courses.Select(x => {
                    var courseTags = GetCourseTagLinks(x);
                    return(_.List(
                               (object)x.Course_TC,
                               Html.CourseLinkAnchor(x).AbsoluteHref(),
                               x.IsNew ? "да" : "нет",
                               courseTags.JoinWith("<br/>"),
                               courseTags.Count));
                })
            };

            return(View(ViewNames.JsTable, model));
        }
コード例 #3
0
        public ActionResult CourseNewVersions()
        {
            var courses = CourseEntityService.GetNewVersionCourses();
            var model   = new JsTableVM {
                Title   = "Новые версии курсов",
                Columns = { { "Код", null }, { "Есть группы", null }, { "Старый код", null } },
                Rows    = courses.Select(x => _.List(
                                             CourseLink(x.Item1),
                                             CmsHtmls.CheckIcon(x.Item2),
                                             CourseLink(x.Item3)
                                             ))
            };

            return(View(ViewNames.JsTable, model));
        }
コード例 #4
0
ファイル: OrderEntityController.cs プロジェクト: dKluev/Site
        public ActionResult BeelineData(DateTime?start, DateTime?end)
        {
            start = start ?? new DateTime(2010, 2, 1);

            var promocode = "b07f53d";

            end = end.Value.AddDays(1);
            var orderDetails = OrderDetailService.GetAll().Where(od => od.CreateDate > start &&
                                                                 od.CreateDate < end && od.Order.PromoCode == promocode &&
                                                                 od.Order.CustomerType == OrderCustomerType.PrivatePerson &&
                                                                 od.Order.UserID != null);
            var regCount = orderDetails.Select(x => x.Order.UserID).Distinct().Count();

            ViewData["RegCount"] = regCount;

            var orderDetailsForReport = orderDetails.Where(od =>
                                                           od.Order.PaymentType_TC != null).Select(x => new {
                x.Order.User.SecondName,
                x.Order.User.FirstName,
                x.Order.User.LastName,
                x.Course_TC,
                x.Price,
                x.CreateDate
            }).Distinct().ToList().GroupBy(x => new {
                x.SecondName, x.FirstName, x.LastName, x.Course_TC
            }).Select(x => new {
                x.Key.SecondName, x.Key.FirstName, x.Key.LastName, x.Key.Course_TC,
                Price      = x.Select(y => y.Price).Max(),
                CreateDate = x.Select(y => y.CreateDate).Max(),
            });
            var model = new JsTableVM {
                Title   = "",
                Columns = { { "Фамилия", null }, { "Имя", null }, { "Отчество", null }, { "Курс", null }, { "Цена", null },
                            { "Дата",    null } },
                Rows = orderDetailsForReport.Select(x => _.List <object>(
                                                        x.LastName,
                                                        x.FirstName,
                                                        x.SecondName,
                                                        x.Course_TC,
                                                        x.Price.MoneyString(),
                                                        x.CreateDate.DefaultString()))
            };

            return(View(model));
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: dKluev/Site
 public ActionResult Competitors(int?phraseId)
 {
     if (phraseId.HasValue)
     {
         var positions = YandexParser.GetSavedPositions().Where(x => x.PhraseId == phraseId);
         var model     = new JsTableVM {
             Title   = Phrases.ForCompetitors[phraseId.Value - 1],
             Columns = { { "Дата", "date-rus" }, { "1", null }, { "2", null }, { "3", null } },
             Rows    = positions.Select(x => {
                 var sites = x.Sites.Split(',');
                 return(_.List <object>(
                            x.Date.ToString("dd.MM.yy HH:mm"),
                            sites.ElementAtOrDefault(0),
                            sites.ElementAtOrDefault(1),
                            sites.ElementAtOrDefault(2)));
             })
         };
         return(View(ViewNames.JsTable, model));
     }
     return(View());
 }
コード例 #6
0
        private ActionResult CourseTableByCourses(string title, List <Course> courses)
        {
            var courseTCs = courses.Select(x => x.Course_TC).ToList();
            var groups    =
                GroupService.GetAll().PlannedAndNotBegin()
                .Where(x => x.DateBeg < DateTime.Today.AddMonths(6) &&
                       courseTCs.Contains(x.Course_TC)).GroupBy(x => x.Course_TC)
                .Select(x => new {
                x.Key, Count = x.Count()
            })
                .ToDictionary(x => x.Key, x => x.Count);
            var model = new JsTableVM {
                Title   = title,
                Columns = { { "Код", null }, { "Название", null }, { "Группы", null } },
                Rows    = courses.Select(x => _.List(
                                             CourseLink(x.Course_TC),
                                             Html.CourseLinkAnchor(x.UrlName, x.WebName).AbsoluteHref(),
                                             groups.GetValueOrDefault(x.Course_TC)
                                             ))
            };

            return(View(ViewNames.JsTable, model));
        }
コード例 #7
0
ファイル: HomeController.cs プロジェクト: dKluev/Site
        public ActionResult SeCompetitors()
        {
            var db    = YandexParser.GetYandexCompetitorDB();
            var model = new JsTableVM {
                Columns = { { "Дата",    "date-rus" },
                            { "Фраза",   null       },
                            { "Директ",  null       },
                            { "Яндекс",  null       },
                            { "AdWords", null       },
                            { "Google",  null       } },
                Title = "Конкуренты",
                Rows  = db.Items.Select(x => _.List <object>(
                                            x.Date.ToString("dd.MM.yy"),
                                            Phrases.YandexCompetitors[x.PhraseId],
                                            x.Direct.JoinWith("<br/>"),
                                            GetList(x.YandexSearch),
                                            x.AdWords.JoinWith("<br/>"),
                                            GetList(x.GoogleSearch)
                                            ))
            };

            return(View(ViewNames.JsTable, model));
        }