Exemple #1
0
        protected override void AttachChildControls()
        {
            int num;
            int num2;

            PageTitle.AddSiteNameTitle("砍价活动");
            this.rpMyMemberList = (VshopTemplatedRepeater)this.FindControl("rpBargainList");
            this.hiddTotal      = (HtmlInputHidden)this.FindControl("hiddTotal");
            this.hiddPageIndex  = (HtmlInputHidden)this.FindControl("hiddPageIndex");
            if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
            {
                num = 1;
            }
            if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
            {
                num2 = 10;
            }
            int          num3  = Globals.RequestQueryNum("status");
            BargainQuery query = new BargainQuery {
                Type      = num3.ToString(),
                PageSize  = num2,
                PageIndex = num
            };
            int           total       = BargainHelper.GetTotal(query);
            DbQueryResult bargainList = BargainHelper.GetBargainList(query);

            this.hiddTotal.Value           = ((DataTable)bargainList.Data).Rows.Count.ToString();
            this.hiddPageIndex.Value       = num.ToString();
            this.rpMyMemberList.DataSource = bargainList.Data;
            this.rpMyMemberList.DataBind();
        }
Exemple #2
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("砍价活动");
            this.rpMyMemberList = (VshopTemplatedRepeater)this.FindControl("rpBargainList");
            this.hiddTotal      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal");
            this.hiddPageIndex  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddPageIndex");
            int pageIndex;

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize;

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 10;
            }
            int          num          = Globals.RequestQueryNum("status");
            BargainQuery bargainQuery = new BargainQuery();

            bargainQuery.Type      = num.ToString();
            bargainQuery.PageSize  = pageSize;
            bargainQuery.PageIndex = pageIndex;
            int           total       = BargainHelper.GetTotal(bargainQuery);
            DbQueryResult bargainList = BargainHelper.GetBargainList(bargainQuery);

            this.hiddTotal.Value           = ((DataTable)bargainList.Data).Rows.Count.ToString();
            this.hiddPageIndex.Value       = pageIndex.ToString();
            this.rpMyMemberList.DataSource = bargainList.Data;
            this.rpMyMemberList.DataBind();
        }
Exemple #3
0
        public int GetTotal(BargainQuery query)
        {
            DbQueryResult dbQueryResult = new DbQueryResult();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" IsDelete=0 ");
            if (!string.IsNullOrEmpty(query.ProductName))
            {
                stringBuilder.AppendFormat(" AND ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(query.ProductName));
            }
            if (!string.IsNullOrEmpty(query.Title))
            {
                stringBuilder.AppendFormat(" AND Title LIKE '%{0}%'", DataHelper.CleanSearchString(query.Title));
            }
            string type = query.Type;

            if (type != null)
            {
                if (!(type == "0"))
                {
                    if (!(type == "1"))
                    {
                        if (!(type == "2"))
                        {
                            if (type == "3")
                            {
                                stringBuilder.AppendFormat(" AND bargainstatus='未开始' ", new object[0]);
                            }
                        }
                        else
                        {
                            stringBuilder.AppendFormat(" AND bargainstatus='已结束' ", new object[0]);
                        }
                    }
                    else
                    {
                        stringBuilder.AppendFormat(" AND bargainstatus='进行中'", new object[0]);
                    }
                }
            }
            string query2 = string.Format(" SELECT count(*) FROM vw_Hishop_BargainList where {0}", stringBuilder.ToString());

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query2);
            int result = 0;

            if (this.database.ExecuteScalar(sqlStringCommand) != null)
            {
                result = int.Parse(this.database.ExecuteScalar(sqlStringCommand).ToString());
            }
            return(result);
        }
Exemple #4
0
        private void BindData()
        {
            BargainQuery bargainQuery = new BargainQuery();

            bargainQuery.ProductName = this.productName;
            bargainQuery.Title       = this.title;
            bargainQuery.Type        = this.type;
            bargainQuery.PageSize    = this.pager.PageSize;
            bargainQuery.PageIndex   = this.pager.PageIndex;
            this.pager.TotalRecords  = BargainHelper.GetTotal(bargainQuery);
            DbQueryResult bargainList = BargainHelper.GetBargainList(bargainQuery);

            this.grdBargainList.DataSource = bargainList.Data;
            this.grdBargainList.DataBind();
        }
        private void BindData()
        {
            BargainQuery query = new BargainQuery {
                ProductName = this.productName,
                Title       = this.title,
                Type        = this.type,
                PageSize    = this.pager.PageSize,
                PageIndex   = this.pager.PageIndex
            };

            this.pager.TotalRecords = BargainHelper.GetTotal(query);
            DbQueryResult bargainList = BargainHelper.GetBargainList(query);

            this.grdBargainList.DataSource = bargainList.Data;
            this.grdBargainList.DataBind();
        }
Exemple #6
0
        public DbQueryResult GetMyBargainList(BargainQuery query)
        {
            new DbQueryResult();
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat(" IsDelete=0 AND bargainstatus='{0}' ", "进行中");
            if (query.Status > 0)
            {
                builder.AppendFormat("AND bargainDetialID in (select bargainDetialID from Hishop_HelpBargainDetial where UserId={0})", query.UserId);
                builder.AppendFormat("and userid!={0}", query.UserId);
            }
            else
            {
                builder.AppendFormat(" AND UserId={0}", query.UserId);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_MyBargainList", "Id", builder.ToString(), "*"));
        }
Exemple #7
0
        public int GetTotal(BargainQuery query)
        {
            string str2;

            new DbQueryResult();
            StringBuilder builder = new StringBuilder();

            builder.Append(" IsDelete=0 ");
            if (!string.IsNullOrEmpty(query.ProductName))
            {
                builder.AppendFormat(" AND ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(query.ProductName));
            }
            if (!string.IsNullOrEmpty(query.Title))
            {
                builder.AppendFormat(" AND Title LIKE '%{0}%'", DataHelper.CleanSearchString(query.Title));
            }
            if (((str2 = query.Type) != null) && (str2 != "0"))
            {
                if (!(str2 == "1"))
                {
                    if (str2 == "2")
                    {
                        builder.AppendFormat(" AND bargainstatus='已结束' ", new object[0]);
                    }
                    else if (str2 == "3")
                    {
                        builder.AppendFormat(" AND bargainstatus='未开始' ", new object[0]);
                    }
                }
                else
                {
                    builder.AppendFormat(" AND bargainstatus='进行中'", new object[0]);
                }
            }
            string    str = string.Format(" SELECT count(*) FROM vw_Hishop_BargainList where {0}", builder.ToString());
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);
            int       num = 0;

            if (this.database.ExecuteScalar(sqlStringCommand) != null)
            {
                num = int.Parse(this.database.ExecuteScalar(sqlStringCommand).ToString());
            }
            return(num);
        }
Exemple #8
0
        public DbQueryResult GetBargainList(BargainQuery query)
        {
            DbQueryResult dbQueryResult = new DbQueryResult();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" IsDelete=0 and SaleStatus=1");
            if (!string.IsNullOrEmpty(query.ProductName))
            {
                stringBuilder.AppendFormat(" AND ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(query.ProductName));
            }
            if (!string.IsNullOrEmpty(query.Title))
            {
                stringBuilder.AppendFormat(" AND Title LIKE '%{0}%'", DataHelper.CleanSearchString(query.Title));
            }
            string type = query.Type;

            if (type != null)
            {
                if (!(type == "0"))
                {
                    if (!(type == "1"))
                    {
                        if (!(type == "2"))
                        {
                            if (type == "3")
                            {
                                stringBuilder.AppendFormat(" AND bargainstatus='未开始' ", new object[0]);
                            }
                        }
                        else
                        {
                            stringBuilder.AppendFormat(" AND bargainstatus='已结束' ", new object[0]);
                        }
                    }
                    else
                    {
                        stringBuilder.AppendFormat(" AND bargainstatus='进行中'", new object[0]);
                    }
                }
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_BargainList", "Id", stringBuilder.ToString(), "*"));
        }
Exemple #9
0
        public ActionResult Management()
        {
            BargainQuery queryall = new BargainQuery()
            {
                ShopId = long.Parse(base.CurrentSellerManager.ShopId.ToString()),
            };
            int barginbillcount = ServiceHelper.Create <IMargainBillService>().GetBargain <MargainBill>(queryall).Total;

            ViewBag.barginbillcount = barginbillcount;

            BargainQuery querynoreply = new BargainQuery()
            {
                ShopId     = long.Parse(base.CurrentSellerManager.ShopId.ToString()),
                BillStatus = EnumBillStatus.SubmitBargain,
            };
            int barginbillnoreplycount = ServiceHelper.Create <IMargainBillService>().GetBargain <MargainBill>(querynoreply).Total;

            ViewBag.barginbillnoreplycount = barginbillnoreplycount;

            return(View());
        }
Exemple #10
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("我的砍价");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                int num;
                int num2;
                this.rpMyBargainList = (VshopTemplatedRepeater)this.FindControl("rpMyBargainList");
                this.hiddTotal       = (HtmlInputHidden)this.FindControl("hiddTotal");
                this.hiddPageIndex   = (HtmlInputHidden)this.FindControl("hiddPageIndex");
                if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
                {
                    num = 1;
                }
                if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
                {
                    num2 = 10;
                }
                int num3 = 0;
                if (!int.TryParse(this.Page.Request.QueryString["status"], out num3))
                {
                    num3 = 0;
                }
                BargainQuery query = new BargainQuery {
                    PageSize  = num2,
                    PageIndex = num,
                    UserId    = currentMember.UserId,
                    Status    = num3
                };
                DbQueryResult myBargainList = BargainHelper.GetMyBargainList(query);
                this.hiddTotal.Value            = ((DataTable)myBargainList.Data).Rows.Count.ToString();
                this.hiddPageIndex.Value        = num.ToString();
                this.rpMyBargainList.DataSource = myBargainList.Data;
                this.rpMyBargainList.DataBind();
            }
        }
Exemple #11
0
        public PageModel <MargainBill> GetBargain <Tout>(BargainQuery bargainQuery)
        {
            IQueryable <MargainBill> platform = context.MargainBill.AsQueryable <MargainBill>();

            if (bargainQuery.StartDate.HasValue)
            {
                DateTime value = bargainQuery.StartDate.Value;
                platform =
                    from d in platform
                    where d.CreateDate >= value
                    select d;
            }
            if (bargainQuery.EndDate.HasValue)
            {
                DateTime dateTime  = bargainQuery.EndDate.Value;
                DateTime dateTime1 = dateTime.AddDays(1).AddSeconds(-1);
                platform =
                    from d in platform
                    where d.CreateDate <= dateTime1
                    select d;
            }
            if (bargainQuery.ShopId.HasValue)
            {
                platform = from item in platform
                           where item.ShopId == bargainQuery.ShopId
                           select item;
            }

            if (!string.IsNullOrWhiteSpace(bargainQuery.BillNo))
            {
                platform = from item in platform
                           where item.BillNo == bargainQuery.BillNo
                           select item;
            }

            if (bargainQuery.BillStatus.HasValue)
            {
                platform = from item in platform
                           where item.BillStatus == bargainQuery.BillStatus
                           select item;
            }
            //筛选掉已删除的询盘
            platform = from item in platform
                       where item.BillStatus != EnumBillStatus.BargainDelete
                       select item;

            int num = platform.Count();

            platform = platform.GetPage(out num, bargainQuery.PageNo, bargainQuery.PageSize);
            foreach (MargainBill list in platform.ToList())
            {
                UserMemberInfo memberInfo = context.UserMemberInfo.FirstOrDefault((UserMemberInfo m) => m.Id.Equals(list.MemberId));
                list.MemberName = memberInfo.UserName;
                ChemCloud_Dictionaries dictionaryInfo = context.ChemCloud_Dictionaries.FirstOrDefault((ChemCloud_Dictionaries m) => m.DictionaryTypeId == 1 && m.DValue == list.CoinType.ToString());
                list.CoinTypeName = (dictionaryInfo == null ? "" : dictionaryInfo.DKey);
            }

            return(new PageModel <MargainBill>()
            {
                Models = platform,
                Total = num
            });
        }
Exemple #12
0
 public static int GetTotal(BargainQuery query)
 {
     return(new BargainDao().GetTotal(query));
 }
Exemple #13
0
 public static DbQueryResult GetMyBargainList(BargainQuery query)
 {
     return(new BargainDao().GetMyBargainList(query));
 }
Exemple #14
0
        public JsonResult List(DateTime?startDate, DateTime?endDate, int?BillStatus, string billno, string buyName, int page, int rows)
        {
            EnumBillStatus?nullable;
            BargainQuery   bargainQuery = new BargainQuery()
            {
                StartDate = startDate,
                EndDate   = endDate,
                // MemberName = buyName,
                UserId = base.CurrentUser.Id,
                BillNo = billno
            };
            BargainQuery bargainQuery1 = bargainQuery;
            int?         nullable1     = BillStatus;

            if (nullable1.HasValue)
            {
                nullable = new EnumBillStatus?((EnumBillStatus)nullable1.GetValueOrDefault());
            }
            else
            {
                nullable = null;
            }
            bargainQuery1.BillStatus = nullable;
            bargainQuery1.MemberName = buyName;
            bargainQuery1.ShopId     = new long?(base.CurrentSellerManager.ShopId);
            bargainQuery1.PageSize   = rows;
            bargainQuery1.PageNo     = page;
            PageModel <MargainBill>   margain = ServiceHelper.Create <IMargainBillService>().GetBargain <MargainBill>(bargainQuery1);
            IEnumerable <MargainBill> array   =
                from item in margain.Models.ToArray()
                select new MargainBill()
            {
                Id             = item.Id,
                BillNo         = item.BillNo,
                BillStatus     = item.BillStatus,
                CreateDate     = item.CreateDate,
                MemberId       = item.MemberId,
                IsDelete       = item.IsDelete,
                strCreateDate  = item.CreateDate.ToString("yyyy-MM-dd"),
                TotalAmount    = item.TotalAmount,
                DeliverType    = item.DeliverType,
                strDeliverDate = item.DeliverDate.ToString("yyyy-MM-dd HH"),
                DeliverAddress = item.DeliverAddress,
                DeliverCost    = item.DeliverCost,
                PayMode        = item.PayMode,
                MemberName     = (ServiceHelper.Create <IMemberService>().GetMember(item.MemberId).UserName) == null ? "" :
                                 (ServiceHelper.Create <IMemberService>().GetMember(item.MemberId).UserName),
                ShopId   = item.ShopId,
                ShopName = (ServiceHelper.Create <IShopService>().GetShop(item.ShopId).ShopName) == null ? "" :
                           (ServiceHelper.Create <IShopService>().GetShop(item.ShopId).ShopName),
                CoinType     = item.CoinType,
                CoinTypeName = item.CoinTypeName,
                BuyerEmail   = (ServiceHelper.Create <IMemberService>().GetMember(item.MemberId).Email) == null ? "" :
                               (ServiceHelper.Create <IMemberService>().GetMember(item.MemberId).Email),
                CASNo        = ServiceHelper.Create <IMargainBillService>().GetBillByNo(item.BillNo)._MargainBillDetail.OrderBy(q => q.Id).FirstOrDefault().CASNo,
                ProudctNum   = ServiceHelper.Create <IMargainBillService>().GetBillByNo(item.BillNo)._MargainBillDetail.OrderBy(q => q.Id).FirstOrDefault().Num,
                BuyerMessage = ServiceHelper.Create <IMargainBillService>().GetBillByNo(item.BillNo)._MargainBillDetail.OrderBy(q => q.Id).FirstOrDefault().BuyerMessage,
                MessageReply = ServiceHelper.Create <IMargainBillService>().GetBillByNo(item.BillNo)._MargainBillDetail.OrderBy(q => q.Id).FirstOrDefault().MessageReply
            };

            DataGridModel <MargainBill> dataGridModel = new DataGridModel <MargainBill>()
            {
                rows  = array,
                total = margain.Total
            };

            return(Json(dataGridModel));
        }