public ActionResult Index()
        {
            IntegralMallPageModel integralMallPageModel = new IntegralMallPageModel()
            {
                CouponPageSize = 6
            };
            PageModel <CouponInfo> integralCoupons = couponser.GetIntegralCoupons(1, integralMallPageModel.CouponPageSize);

            integralMallPageModel.CouponList    = integralCoupons.Models.ToList();
            integralMallPageModel.CouponTotal   = integralCoupons.Total;
            integralMallPageModel.CouponMaxPage = GetMaxPage(integralMallPageModel.CouponTotal, integralMallPageModel.CouponPageSize);
            integralMallPageModel.GiftPageSize  = 12;
            GiftQuery giftQuery = new GiftQuery()
            {
                skey     = "",
                status   = new GiftInfo.GiftSalesStatus?(GiftInfo.GiftSalesStatus.Normal),
                PageSize = integralMallPageModel.GiftPageSize,
                PageNo   = 1
            };
            PageModel <GiftModel> gifts = giftser.GetGifts(giftQuery);

            integralMallPageModel.GiftList    = gifts.Models.ToList();
            integralMallPageModel.GiftTotal   = gifts.Total;
            integralMallPageModel.GiftMaxPage = GetMaxPage(integralMallPageModel.GiftTotal, integralMallPageModel.GiftPageSize);
            return(View(integralMallPageModel));
        }
 public void LoadGift()
 {
     if (!string.IsNullOrEmpty(this.context.Request["PageSize"]) && !string.IsNullOrEmpty(this.context.Request["CurrentPage"]))
     {
         int       pageSize  = int.Parse(this.context.Request["PageSize"]);
         int       pageIndex = int.Parse(this.context.Request["CurrentPage"]);
         GiftQuery giftQuery = new GiftQuery();
         giftQuery.IsOnline       = true;
         giftQuery.Page.PageSize  = pageSize;
         giftQuery.Page.PageIndex = pageIndex;
         giftQuery.Page.SortBy    = "GiftId";
         giftQuery.Page.SortOrder = SortAction.Desc;
         DbQueryResult gifts = GiftHelper.GetGifts(giftQuery);
         DataTable     data  = gifts.Data;
         string        str   = "{\"totalCount\":\"" + gifts.TotalRecords + "\",\"data\":[";
         string        text  = "";
         for (int i = 0; i < data.Rows.Count; i++)
         {
             if (text != "")
             {
                 text += ",";
             }
             text = text + "{\"GiftId\":\"" + data.Rows[i]["GiftId"] + "\",\"Name\":\"" + data.Rows[i]["Name"] + "\",\"NeedPoint\":\"" + data.Rows[i]["NeedPoint"] + "\",\"ThumbnailUrl180\":\"" + Globals.GetImageServerUrl("http://", data.Rows[i]["ThumbnailUrl180"].ToNullString()) + "\"}";
         }
         str += text;
         str += "]}";
         this.context.Response.Write(str);
     }
 }
Exemple #3
0
        public void GetList(HttpContext context)
        {
            int num  = 1;
            int num2 = 10;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            GiftQuery giftQuery = new GiftQuery();

            giftQuery.Name           = context.Request["Name"];
            giftQuery.IsPromotion    = base.GetBoolParam(context, "IsPromotion", false).Value;
            giftQuery.Page.PageIndex = num;
            giftQuery.Page.PageSize  = num2;
            giftQuery.Page.SortBy    = "GiftId";
            giftQuery.Page.SortOrder = SortAction.Desc;
            DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(giftQuery);
            string s = base.SerializeObjectToJson(dataList);

            context.Response.Write(s);
            context.Response.End();
        }
        public JsonResult GiftList(int page, int rows = 12)
        {
            GiftQuery query = new GiftQuery();

            query.skey     = "";
            query.status   = GiftInfo.GiftSalesStatus.Normal;
            query.PageSize = rows;
            query.PageNo   = page;
            ObsoletePageModel <GiftModel> gifts = _iGiftService.GetGifts(query);
            List <GiftModel> datalist           = gifts.Models.ToList();
            var result = datalist.Select(d => new
            {
                Id            = d.Id,
                GiftName      = d.GiftName,
                NeedIntegral  = d.NeedIntegral,
                LimtQuantity  = d.LimtQuantity,
                StockQuantity = d.StockQuantity,
                EndDate       = d.EndDate,
                NeedGrade     = d.NeedGrade,
                SumSales      = d.SumSales,
                SalesStatus   = d.SalesStatus,
                ImagePath     = d.ImagePath,
                GiftValue     = d.GiftValue,
                ShowImagePath = Core.HimallIO.GetProductSizeImage(d.ShowImagePath, 1, (int)ImageSize.Size_350),
                NeedGradeName = d.NeedGradeName
            }).ToList();

            return(Json(result));
        }
Exemple #5
0
        public DbQueryResult GetGifts(GiftQuery query)
        {
            string text = $"[Name] LIKE '%{DataHelper.CleanSearchString(query.Name)}%'";

            if (query.IsPromotion)
            {
                text += " AND IsPromotion = 1";
            }
            if (query.IsOnline)
            {
                text += " AND NeedPoint > 0";
            }
            if (!string.IsNullOrEmpty(query.FilterGiftIds))
            {
                text += $" and GiftId not in ({query.FilterGiftIds})";
            }
            Pagination page = query.Page;

            if (query.IsOnline)
            {
                text       += " AND IsPointExchange = 1";
                page.SortBy = " NeedPoint ASC,GiftId";
            }
            return(DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Hishop_Gifts", "GiftId", text, "*"));
        }
Exemple #6
0
        private void GetList(HttpContext context)
        {
            GiftQuery dataQuery = this.GetDataQuery(context);
            DataGridViewModel <Dictionary <string, object> > listSplittinDraws = this.GetListSplittinDraws(dataQuery);
            string s = base.SerializeObjectToJson(listSplittinDraws);

            context.Response.Write(s);
            context.Response.End();
        }
Exemple #7
0
        private void GetGiftsList(HttpContext context)
        {
            GiftQuery giftsQuery = this.GetGiftsQuery(context);
            DataGridViewModel <Dictionary <string, object> > giftses = this.GetGiftses(giftsQuery);
            string s = base.SerializeObjectToJson(giftses);

            context.Response.Write(s);
            context.Response.End();
        }
Exemple #8
0
        private GiftQuery GetGiftsQuery(HttpContext context)
        {
            GiftQuery giftQuery = new GiftQuery();

            giftQuery.Name           = base.GetParameter(context, "Name", true);
            giftQuery.Page.PageSize  = base.CurrentPageSize;
            giftQuery.Page.PageIndex = base.CurrentPageIndex;
            Globals.EntityCoding(giftQuery, true);
            return(giftQuery);
        }
Exemple #9
0
        private DataGridViewModel <Dictionary <string, object> > GetGiftses(GiftQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult gifts = OrderHelper.GetGifts(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(gifts.Data);
                dataGridViewModel.total = gifts.TotalRecords;
            }
            return(dataGridViewModel);
        }
        public IList <GiftInfo> GetGiftList(GiftQuery query)
        {
            IList <GiftInfo> result           = null;
            string           query2           = $"SELECT * FROM Hishop_Gifts WHERE [Name] LIKE '%{DataHelper.CleanSearchString(query.Name)}%'";
            DbCommand        sqlStringCommand = base.database.GetSqlStringCommand(query2);

            using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ReaderToList <GiftInfo>(objReader);
            }
            return(result);
        }
        public DbQueryResult GetGifts(GiftQuery query)
        {
            string filter = null;

            if (!string.IsNullOrEmpty(query.Name))
            {
                filter = $"[Name] LIKE '%{DataHelper.CleanSearchString(query.Name)}%'";
            }
            Pagination page = query.Page;

            return(DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Hishop_Gifts", "GiftId", filter, "*"));
        }
Exemple #12
0
        private void BindGift()
        {
            GiftQuery giftQuery = new GiftQuery();

            giftQuery.Page.PageIndex = this.pager.PageIndex;
            giftQuery.Page.PageSize  = this.pager.PageSize;
            DbQueryResult onlineGifts = ProductBrowser.GetOnlineGifts(giftQuery);

            this.rptGifts.DataSource = onlineGifts.Data;
            this.rptGifts.DataBind();
            this.pager.TotalRecords = onlineGifts.TotalRecords;
        }
Exemple #13
0
        private GiftQuery GetDataQuery(HttpContext context)
        {
            GiftQuery giftQuery = new GiftQuery();

            giftQuery.Name           = base.GetParameter(context, "Name", true);
            giftQuery.FilterGiftIds  = base.GetParameter(context, "FilterGiftIds", true);
            giftQuery.IsPromotion    = true;
            giftQuery.Page.PageSize  = base.CurrentPageSize;
            giftQuery.Page.PageIndex = base.CurrentPageIndex;
            giftQuery.Page.SortBy    = "GiftId";
            giftQuery.Page.SortOrder = SortAction.Desc;
            return(giftQuery);
        }
Exemple #14
0
        private void BindGifts()
        {
            GiftQuery query = new GiftQuery();

            query.Page.PageSize  = 10;
            query.Page.PageIndex = pager.PageIndex;
            query.Name           = txtSearchText.Text.Trim();
            DbQueryResult gifts = OrderHelper.GetGifts(query);

            dlstGifts.DataSource = gifts.Data;
            dlstGifts.DataBind();
            pager.TotalRecords = gifts.TotalRecords;
        }
Exemple #15
0
        private void BindGifts()
        {
            GiftQuery query = new GiftQuery();

            query.Page.PageSize  = 10;
            query.Page.PageIndex = this.pager.PageIndex;
            query.Name           = this.txtSearchText.Text.Trim();
            DbQueryResult gifts = SubsiteSalesHelper.GetGifts(query);

            this.dlstGifts.DataSource = gifts.Data;
            this.dlstGifts.DataBind();
            this.pager.TotalRecords = gifts.TotalRecords;
        }
Exemple #16
0
        public JsonResult List(GiftInfo.GiftSalesStatus?status, string skey, int rows, int page)
        {
            GiftQuery giftQuery = new GiftQuery()
            {
                skey     = skey,
                status   = status,
                PageSize = rows,
                PageNo   = page
            };
            PageModel <GiftModel> gifts = giftser.GetGifts(giftQuery);
            List <GiftModel>      list  = gifts.Models.ToList();

            return(Json(new { rows = list, total = gifts.Total }));
        }
        public JsonResult List(GiftInfo.GiftSalesStatus?status, string skey, int rows, int page)
        {
            GiftQuery query = new GiftQuery();

            query.skey     = skey;
            query.status   = status;
            query.PageSize = rows;
            query.PageNo   = page;
            var datalist = _iGiftService.GetGifts(query);
            var data     = datalist.Models.ToList();
            var result   = new { rows = data, total = datalist.Total };

            return(Json(result));
        }
Exemple #18
0
        public IList <GiftInfo> GetGiftList(GiftQuery query)
        {
            IList <GiftInfo> list             = new List <GiftInfo>();
            string           query2           = string.Format("SELECT * FROM Ecshop_Gifts WHERE [Name] LIKE '%{0}%'", DataHelper.CleanSearchString(query.Name));
            DbCommand        sqlStringCommand = this.database.GetSqlStringCommand(query2);

            using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    list.Add(DataMapper.PopulateGift(dataReader));
                }
            }
            return(list);
        }
Exemple #19
0
        public DbQueryResult GetGifts(GiftQuery query)
        {
            string text = string.Format("[Name] LIKE '%{0}%'", DataHelper.CleanSearchString(query.Name));

            if (query.IsPromotion)
            {
                text += " AND IsPromotion = 1";
            }
            if (query.IsOnline)
            {
                text += " AND NeedPoint > 0";
            }
            Pagination page = query.Page;

            return(DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Ecshop_Gifts", "GiftId", text, "*"));
        }
Exemple #20
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(GiftQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult gifts = GiftHelper.GetGifts(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(gifts.Data);
                dataGridViewModel.total = gifts.TotalRecords;
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                    row["ThumbnailUrl40"] = base.GetImageOrDefaultImage(row["ThumbnailUrl40"], base.CurrentSiteSetting.DefaultProductImage);
                }
            }
            return(dataGridViewModel);
        }
        public JsonResult GiftList(int page, int rows = 12)
        {
            GiftQuery giftQuery = new GiftQuery()
            {
                skey     = "",
                status   = new GiftInfo.GiftSalesStatus?(GiftInfo.GiftSalesStatus.Normal),
                PageSize = rows,
                PageNo   = page
            };
            PageModel <GiftModel> gifts = giftser.GetGifts(giftQuery);
            var list = (
                from d in gifts.Models.ToList()
                select new { Id = d.Id, GiftName = d.GiftName, NeedIntegral = d.NeedIntegral, LimtQuantity = d.LimtQuantity, StockQuantity = d.StockQuantity, EndDate = d.EndDate, NeedGrade = d.NeedGrade, SumSales = d.SumSales, SalesStatus = d.SalesStatus, ImagePath = d.ImagePath, GiftValue = d.GiftValue, ShowImagePath = d.ShowImagePath, NeedGradeName = d.NeedGradeName }).ToList();

            return(Json(list));
        }
Exemple #22
0
        public JsonResult GetList(int pageno = 1, int pagesize = 10)
        {
            GiftQuery query = new GiftQuery();

            query.skey     = "";
            query.status   = GiftInfo.GiftSalesStatus.Normal;
            query.PageSize = pagesize;
            query.PageNo   = pageno;
            QueryPageModel <GiftModel> gifts = _iGiftService.GetGifts(query);
            var data = gifts.Models.ToList();

            foreach (var item in data)
            {
                item.DefaultShowImage = HimallIO.GetRomoteImagePath(item.GetImage(ImageSize.Size_350));
            }
            var result = SuccessResult <List <GiftModel> >(data: data);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemple #23
0
 private void BindData()
 {
     GiftQuery query = new GiftQuery {
         Name = this.giftName,
         IsPromotion = this.isPromotion
     };
     query.Page.PageSize = this.pager.PageSize;
     query.Page.PageIndex = this.pager.PageIndex;
     query.Page.SortBy = this.grdGift.SortOrderBy;
     if (this.grdGift.SortOrder.ToLower() == "desc")
     {
         query.Page.SortOrder = SortAction.Desc;
     }
     DbQueryResult gifts = GiftHelper.GetGifts(query);
     this.grdGift.DataSource = gifts.Data;
     this.grdGift.DataBind();
     this.pager.TotalRecords = gifts.TotalRecords;
     this.pager1.TotalRecords = gifts.TotalRecords;
 }
Exemple #24
0
        public ActionResult Detail(long id)
        {
            GiftDetailPageModel giftDetailPageModel = new GiftDetailPageModel()
            {
                GiftData = giftser.GetById(id)
            };

            if (giftDetailPageModel.GiftData == null)
            {
                throw new HimallException("Gift information invalid!");
            }
            int       num       = 10;
            GiftQuery giftQuery = new GiftQuery()
            {
                skey     = "",
                status   = new GiftInfo.GiftSalesStatus?(GiftInfo.GiftSalesStatus.Normal),
                PageSize = num,
                PageNo   = 1,
                Sort     = GiftQuery.GiftSortEnum.SalesNumber,
                IsAsc    = false
            };
            PageModel <GiftModel> gifts = giftser.GetGifts(giftQuery);

            giftDetailPageModel.HotGifts   = gifts.Models.ToList();
            giftDetailPageModel.GiftCanBuy = true;
            if (giftDetailPageModel.GiftCanBuy && giftDetailPageModel.GiftData.GetSalesStatus != GiftInfo.GiftSalesStatus.Normal)
            {
                giftDetailPageModel.GiftCanBuy = false;
            }
            if (giftDetailPageModel.GiftCanBuy && giftDetailPageModel.GiftData.StockQuantity < 1)
            {
                giftDetailPageModel.GiftCanBuy = false;
            }
            if (giftDetailPageModel.GiftCanBuy && giftDetailPageModel.GiftData.NeedIntegral < 1)
            {
                giftDetailPageModel.GiftCanBuy = false;
            }
            if (giftDetailPageModel.GiftCanBuy && base.CurrentUser != null && giftDetailPageModel.GiftData.LimtQuantity > 0 && orderser.GetOwnBuyQuantity(base.CurrentUser.Id, id) >= giftDetailPageModel.GiftData.LimtQuantity)
            {
                giftDetailPageModel.GiftCanBuy = false;
            }
            return(View(giftDetailPageModel));
        }
Exemple #25
0
        void BindData()
        {
            GiftQuery query = new GiftQuery();

            query.Name           = Globals.HtmlEncode(giftName);
            query.Page.PageSize  = pager.PageSize;
            query.Page.PageIndex = pager.PageIndex;
            query.Page.SortBy    = grdGift.SortOrderBy;
            if (grdGift.SortOrder.ToLower() == "desc")
            {
                query.Page.SortOrder = SortAction.Desc;
            }
            DbQueryResult abstroGiftsById = SubsiteGiftHelper.GetAbstroGiftsById(query);

            grdGift.DataSource = abstroGiftsById.Data;
            grdGift.DataBind();
            pager.TotalRecords  = abstroGiftsById.TotalRecords;
            pager1.TotalRecords = abstroGiftsById.TotalRecords;
        }
Exemple #26
0
        private void BindData()
        {
            GiftQuery query = new GiftQuery();

            query.Name           = giftName;
            query.Page.PageSize  = pager.PageSize;
            query.Page.PageIndex = pager.PageIndex;
            query.Page.SortBy    = grdGift.SortOrderBy;
            if (grdGift.SortOrder.ToLower() == "desc")
            {
                query.Page.SortOrder = SortAction.Desc;
            }
            DbQueryResult gifts = GiftHelper.GetGifts(query);

            grdGift.DataSource = gifts.Data;
            grdGift.DataBind();
            pager.TotalRecords  = gifts.TotalRecords;
            pager1.TotalRecords = gifts.TotalRecords;
        }
Exemple #27
0
        private void BindData()
        {
            GiftQuery giftQuery = new GiftQuery();

            giftQuery.Name           = Globals.HtmlEncode(this.giftName);
            giftQuery.Page.PageSize  = this.pager.PageSize;
            giftQuery.Page.PageIndex = this.pager.PageIndex;
            giftQuery.Page.SortBy    = this.grdGift.SortOrderBy;
            if (this.grdGift.SortOrder.ToLower() == "desc")
            {
                giftQuery.Page.SortOrder = SortAction.Desc;
            }
            DbQueryResult gifts = SubsiteGiftHelper.GetGifts(giftQuery);

            this.grdGift.DataSource = gifts.Data;
            this.grdGift.DataBind();
            this.pager.TotalRecords  = gifts.TotalRecords;
            this.pager1.TotalRecords = gifts.TotalRecords;
        }
Exemple #28
0
        /// <summary>
        /// 绑定TOP类控件
        /// </summary>
        private void BindGiftTop(Control c)
        {
            //声明变量
            object dtGiftTop = null;

            //找到控件后,获取对应的数据集
            string topName = c.ID.Substring(c.ID.IndexOf("_") + 1);

            switch (topName)
            {
            case "Hot":
                dtGiftTop = ProductBrowser.GetGifts(4);
                break;

            case "All":
                GiftQuery query = new GiftQuery
                {
                    Page = new Pagination {
                        PageSize  = this.pager.PageSize,
                        PageIndex = this.pager.PageIndex,
                        SortBy    = "Giftid",
                        SortOrder = SortAction.Desc
                    }
                };
                dtGiftTop = ProductBrowser.GetGifts(query).Data;
                break;

            default:
                //dtProductTop = ProductBrowser.GetHomeProductTop(3, pt);
                break;
            }

            //数据集处理
            switch (SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            default:
                break;
            }
            //绑定
            (c as VshopTemplatedRepeater).DataSource = dtGiftTop;
            (c as VshopTemplatedRepeater).DataBind();
        }
        /// <summary>
        /// 积分商城
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            IntegralMallPageModel result = new IntegralMallPageModel();

            //Logo
            ViewBag.Logo = SiteSettings.Logo;

            //优惠券数据
            result.CouponPageSize = 6;
            QueryPageModel <Entities.CouponInfo> coupons = _iCouponService.GetIntegralCoupons(1, result.CouponPageSize);

            result.CouponList    = coupons.Models.ToList();
            result.CouponTotal   = coupons.Total;
            result.CouponMaxPage = GetMaxPage(result.CouponTotal, result.CouponPageSize);

            //礼品数据
            result.GiftPageSize = 12;
            GiftQuery query = new GiftQuery();

            query.skey     = "";
            query.status   = GiftInfo.GiftSalesStatus.Normal;
            query.PageSize = result.GiftPageSize;
            query.PageNo   = 1;
            QueryPageModel <GiftModel> gifts = _iGiftService.GetGifts(query);

            result.GiftList    = gifts.Models.ToList();
            result.GiftTotal   = gifts.Total;
            result.GiftMaxPage = GetMaxPage(result.GiftTotal, result.GiftPageSize);

            if (CurrentUser != null)
            {
                //登录后处理会员积分
                var userInte  = MemberIntegralApplication.GetMemberIntegral(CurrentUser.Id);
                var userGrade = MemberGradeApplication.GetMemberGradeByUserIntegral(userInte.HistoryIntegrals);
                result.MemberAvailableIntegrals = userInte.AvailableIntegrals;
                result.MemberGradeName          = userGrade.GradeName;
            }
            ViewBag.Keyword = SiteSettings.Keyword;

            return(View(result));
        }
Exemple #30
0
        public object GetList(int pageNo = 1, int pageSize = 10)
        {
            //礼品数据
            GiftQuery query = new GiftQuery();

            query.skey     = "";
            query.status   = Mall.Entities.GiftInfo.GiftSalesStatus.Normal;
            query.PageSize = pageSize;
            query.PageNo   = pageNo;
            QueryPageModel <GiftModel> gifts = GiftApplication.GetGifts(query);
            var list = gifts.Models.ToList();

            foreach (var item in list)
            {
                item.DefaultShowImage = MallIO.GetRomoteImagePath(item.GetImage(ImageSize.Size_350));
            }
            return(Json(new
            {
                Gifts = list,
                Total = gifts.Total,
                MaxPage = GetMaxPage(gifts.Total, pageSize)
            }));
        }