Example #1
0
        public HomePageData HomePageData()
        {
            HomePageData data = new HomePageData();
            // 熱門
            var p = db.OrderDetails.GroupBy(n => n.ProductID.ToString()).OrderByDescending(n => n.Count())
                    .Select(n => new { n.Key, item = n.ToList() }).ToList().Take(20);

            var daypupp = db.OrderDetails.AsEnumerable().Where(n => n.CreateDate.Value.ToShortDateString() == DateTime.Now.ToShortDateString())
                          .GroupBy(n => n.ProductID.ToString()).OrderByDescending(n => n.Count())
                          .Select(n => new { n.Key, item = n.ToList() }).ToList().Take(3);

            //歷史熱門
            foreach (var item in p)
            {
                data.Popular.Add(new ProductsModels
                {
                    PID         = item.Key,
                    PName       = item.item.First().Product.ProductName,
                    CompanyName = item.item.First().Product.Supplier.SupplierName,
                    UnitPrice   = item.item.First().UnitPrice
                });
            }
            //今日熱銷
            foreach (var item in daypupp)
            {
                data.DayPopular.Add(new ProductsModels
                {
                    PID   = item.Key,
                    PName = item.item.First().Product.ProductName,
                });
            }
            //最新
            data.NEWs = db.Products.OrderByDescending(m => m.ProductInDate).Select(m => new ProductsModels
            {
                PID         = m.ProductID.ToString(),
                PName       = m.ProductName,
                CompanyName = m.Supplier.SupplierName,
                UnitPrice   = m.UnitPrice
            }).Take(20).ToList();

            //隨機
            data.Ramdom = db.ProductEvaluations.OrderBy(n => Guid.NewGuid()).Select(n => new RamdomProducts
            {
                PID         = n.ProductID.ToString(),
                PName       = n.Product.ProductName,
                CompanyName = n.Product.Supplier.SupplierName,
                UnitPrice   = n.Product.UnitPrice,
                Comment     = n.Comment,
                Grade       = n.Grade.ToString()
            }).Take(6).ToList();
            return(data);
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HomePageData = await _context.HomeData.FirstOrDefaultAsync(m => m.ID == id);

            if (HomePageData == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #3
0
        /**
         * 100 - Perfomance and concerts
         * 101 - Arts$Theatre
         * 102 - Sports
         * 103 - Movie
         * 104 - Workshop and classes
         * 105 - Food
         * 106 - Nature and Parks
         * 107- Parties and NightLife
         * 108 - Attractions
         * 109 - Fashion**/
        public async Task <string> GetHomepageTopSellingEvents(decimal latitude, decimal longitude)
        {
            int miles = 250;
            //List<EventSubinfo> Homepagedata = new List<EventSubinfo>();
            HomePageData homePageData = new HomePageData();

            var Event             = new EventRespositoryv2();
            var Perfomanceconcert = Event.PopularByCategory(latitude, longitude, 0, 4, 100, 230);
            var ArtTheatre        = Event.PopularByCategory(latitude, longitude, 0, 4, 101, 230);
            var Sports            = Event.PopularByCategory(latitude, longitude, 0, 4, 102, 230);
            var Workshopclasses   = Event.PopularByCategory(latitude, longitude, 0, 4, 104, 230);

            var homepagedata = await Task.WhenAll(Perfomanceconcert, ArtTheatre, Sports, Workshopclasses);

            return(JsonConvert.SerializeObject(homepagedata));
        }
Example #4
0
        /// <summary>
        /// 保存病案首页内容
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public string SaveMedicalCaseFile(Stream stream)
        {
            HomePageData data = new HomePageData();

            data.PageName     = "病案首页";
            data.homePageData = StreamToBytes(stream); stream.Close();
            data.workId       = LoginUserInfo.WorkId;
            Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
            {
                request.AddData(data);
            });
            ServiceResponseData retdata = InvokeWcfService("EMRMongoDB.Service", "HomePageStoreController", "SaveMedicalCase", requestAction);

            if (retdata.GetData <bool>(0))
            {
                return(retdata.GetData <string>(1));
            }
            return(null);
        }
Example #5
0
        public static void Initialize(Context context)
        {
            context.Database.EnsureCreated();


            if (!context.Products.Any())
            {
                var product = new Product();
                context.Products.Add(product);
            }
            if (!context.HomeData.Any())
            {
                var data = new HomePageData()
                {
                    TagLine   = "The new standard in < Salt Artifacts >",
                    MainIntro = "At Xtenders We produce best salt products from pure Hamalyian Salt Extracted from Pakistans BIGGEST salt mines"
                };
                context.HomeData.Add(data);
            }
            context.SaveChanges();
        }
Example #6
0
        public StreamReader GetMedicalCaseFile(int patlistid, out Emr_CaseRecord caseRecord)
        {
            caseRecord = new Emr_CaseRecord();
            Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
            {
                request.AddData(patlistid);
            });
            ServiceResponseData   retdata = InvokeWcfService("EMRDocProject.Service", "HomePageController", "GetCaseRecord", requestAction);
            List <Emr_CaseRecord> list    = retdata.GetData <List <Emr_CaseRecord> >(0);

            if (list.Count > 0)
            {
                caseRecord    = list[0];
                requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(list[0].MongoCaseID);
                });
                retdata = InvokeWcfService("EMRMongoDB.Service", "HomePageStoreController", "GetMedicalCase", requestAction);
                if (retdata.GetData <bool>(0))
                {
                    HomePageData data = retdata.GetData <HomePageData>(1);
                    if (data == null || data.homePageData == null)
                    {
                        return(null);
                    }
                    else
                    {
                        return(BytesToStream(data.homePageData));
                    }
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
        public ActionResult Index(HomePageData homePageData)
        {
            homePageData.FilterParameters = boardGameFilterService.GetAllFilterParameters();

            homePageData.RecommendedBoardGames = boardGamesService
                                                 .GetFourRecommendedBoardGames()
                                                 .Select(bg => new BoardGame()
            {
                BoardGameId            = bg.BoardGameId,
                Name                   = bg.Name,
                Image                  = bg.Image,
                GameTimeInMinutes      = bg.GameTimeInMinutes,
                MinPlayerCount         = bg.MinPlayerCount,
                MaxPlayerCount         = bg.MaxPlayerCount,
                MinimumAge             = bg.MinimumAge,
                BoardGameCategoryName  = bg.BoardGameCategory.Name,
                BoardGamePublisherName = bg.BoardGamePublisher.Name,
                BoardGameStateName     = bg.BoardGameState.Name,
                Content                = bg.Content,
                Description            = bg.Description,
                Quantity               = bg.Quantity,
                RentalCostPerDay       = bg.RentalCostPerDay,
                ImagePath              = bg.ImagePath,
                DetailsImagePath       = bg.DetailsImagePath
            });

            homePageData.FristThreeBoardGameNote = boardGameNoteService.GetFristThreeBoardGameNote()
                                                   .Select(bgn => new BoardGameNote()
            {
                BoardGameId     = bgn.BoardGameId,
                Author          = bgn.Author,
                BoardGameNoteId = bgn.BoardGameNoteId,
                Content         = bgn.Content
            });

            return(View(homePageData));
        }
 internal static void ResetData()
 {
     Logger.Clear();
     HomePage.data     = new HomePageData();
     HomePage.topPanel = new TopPanel();
 }
 public HomePageController()
 {
     _homePageServices = new HomePageServices();
     _homePageData     = new HomePageData();
     _freeLancerData   = new FreelancerData();
 }
Example #10
0
 public IActionResult OnGet()
 {
     this.homePageData = _context.HomeData.First();
     return(Page());
 }
 public HomePageViewModel()
 {
     this.HomePageTilesList = HomePageData.CreateHomePageTileList();
 }