예제 #1
0
        protected override void AttachChildControls()
        {
            int num;
            int num2;
            int num3;

            PageTitle.AddSiteNameTitle("我的奖品");
            this.rptList       = (VshopTemplatedRepeater)this.FindControl("rptList");
            this.txtTotal      = (HtmlInputHidden)this.FindControl("txtTotal");
            this.txtShowTabNum = (HtmlInputHidden)this.FindControl("txtShowTabNum");
            this.litShipTo     = (Literal)this.FindControl("litShipTo");
            this.litCellPhone  = (Literal)this.FindControl("litCellPhone");
            this.litAddress    = (Literal)this.FindControl("litAddress");
            this.rptAddress    = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();

            //if (CS$<>9__CachedAnonymousMethodDelegate3 == null)
            //{
            //    CS$<>9__CachedAnonymousMethodDelegate3 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__0);
            //}
            //this.rptAddress.DataSource = Enumerable.OrderBy<ShippingAddressInfo, bool>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate3);
            //this.rptAddress.DataBind();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            this.litAddAddress = (Literal)this.FindControl("litAddAddress");
            this.selectShipTo  = (HtmlInputHidden)this.FindControl("selectShipTo");
            //if (CS$<>9__CachedAnonymousMethodDelegate4 == null)
            //{
            //    CS$<>9__CachedAnonymousMethodDelegate4 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__1);
            //}
            //ShippingAddressInfo info = Enumerable.FirstOrDefault<ShippingAddressInfo>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate4);
            ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault);

            if (info == null)
            {
                info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null;
            }
            if (info != null)
            {
                this.litShipTo.Text    = info.ShipTo;
                this.litCellPhone.Text = info.CellPhone;
                this.litAddress.Text   = info.Address;
                this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'";
            string str = Globals.RequestQueryStr("ShowTab");

            if (string.IsNullOrEmpty(str))
            {
                str = "0";
            }
            PrizesDeliveQuery entity = new PrizesDeliveQuery();

            if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
            {
                num = 1;
            }
            if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
            {
                num2 = 20;
            }
            string extendLimits = "";

            if (str == "0")
            {
                string str3 = DateTime.Now.ToString("yyyy-MM-dd");
                extendLimits = " and (status in(0,1,2) or playtime>'" + str3 + "') ";
            }
            else
            {
                extendLimits = " and (status=3 or status=4)";
            }
            this.txtShowTabNum.Value = str;
            entity.Status            = -1;
            entity.SortBy            = "LogId";
            entity.SortOrder         = SortAction.Desc;
            entity.PageIndex         = num;
            entity.PrizeType         = -1;
            entity.PageSize          = num2;
            entity.UserId            = Globals.GetCurrentMemberUserId();
            Globals.EntityCoding(entity, true);
            DbQueryResult result = GameHelper.GetPrizesDeliveryList(entity, extendLimits, "*");

            this.rptList.ItemDataBound += new RepeaterItemEventHandler(this.refriendscircle_ItemDataBound);
            this.CouponList.Clear();
            string    str4 = "";
            DataTable data = (DataTable)result.Data;

            if ((data != null) && (data.Rows.Count > 1))
            {
                for (num3 = 0; num3 < data.Rows.Count; num3++)
                {
                    if ((data.Rows[num3]["GiveCouponId"] != DBNull.Value) && (data.Rows[num3]["GiveCouponId"].ToString() != ""))
                    {
                        str4 = str4 + "," + data.Rows[num3]["GiveCouponId"].ToString();
                    }
                }
            }
            if (str4.Length > 1)
            {
                DataTable couponsListByIds = CouponHelper.GetCouponsListByIds(Array.ConvertAll <string, int>(str4.Remove(0, 1).Split(new char[] { ',' }), s => int.Parse(s)));
                if ((couponsListByIds != null) && (couponsListByIds.Rows.Count > 0))
                {
                    for (num3 = 0; num3 < couponsListByIds.Rows.Count; num3++)
                    {
                        int key = (int)couponsListByIds.Rows[num3]["CouponId"];
                        if (!this.CouponList.ContainsKey(key))
                        {
                            this.CouponList.Add(key, couponsListByIds.Rows[num3]["CouponName"].ToString() + "[面值" + couponsListByIds.Rows[num3]["CouponValue"].ToString() + "元]");
                        }
                    }
                }
            }
            this.rptList.DataSource = result.Data;
            this.rptList.DataBind();
            this.txtTotal.SetWhenIsNotNull(result.TotalRecords.ToString());
        }
예제 #2
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("我的奖品");
            this.rptList       = (VshopTemplatedRepeater)this.FindControl("rptList");
            this.txtTotal      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");
            this.txtShowTabNum = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtShowTabNum");
            this.litShipTo     = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone  = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress    = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.rptAddress    = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");
            this.selectShipTo  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'";
            string text = Globals.RequestQueryStr("ShowTab");

            if (string.IsNullOrEmpty(text))
            {
                text = "0";
            }
            PrizesDeliveQuery prizesDeliveQuery = new PrizesDeliveQuery();
            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 = 20;
            }
            string extendLimits;

            if (text == "0")
            {
                string str = System.DateTime.Now.ToString("yyyy-MM-dd");
                extendLimits = " and (status in(0,1,2) or playtime>'" + str + "') ";
            }
            else
            {
                extendLimits = " and (status=3 or status=4)";
            }
            this.txtShowTabNum.Value    = text;
            prizesDeliveQuery.Status    = -1;
            prizesDeliveQuery.SortBy    = "LogId";
            prizesDeliveQuery.SortOrder = SortAction.Desc;
            prizesDeliveQuery.PageIndex = pageIndex;
            prizesDeliveQuery.PrizeType = -1;
            prizesDeliveQuery.PageSize  = pageSize;
            prizesDeliveQuery.UserId    = Globals.GetCurrentMemberUserId();
            Globals.EntityCoding(prizesDeliveQuery, true);
            DbQueryResult prizesDeliveryList = GameHelper.GetPrizesDeliveryList(prizesDeliveQuery, extendLimits, "*");

            this.rptList.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.refriendscircle_ItemDataBound);
            this.CouponList.Clear();
            string    text2     = "";
            DataTable dataTable = (DataTable)prizesDeliveryList.Data;

            if (dataTable != null && dataTable.Rows.Count > 1)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    if (dataTable.Rows[i]["GiveCouponId"] != System.DBNull.Value && dataTable.Rows[i]["GiveCouponId"].ToString() != "")
                    {
                        text2 = text2 + "," + dataTable.Rows[i]["GiveCouponId"].ToString();
                    }
                }
            }
            if (text2.Length > 1)
            {
                text2 = text2.Remove(0, 1);
                int[] couponId = System.Array.ConvertAll <string, int>(text2.Split(new char[]
                {
                    ','
                }), (string s) => int.Parse(s));
                DataTable couponsListByIds = CouponHelper.GetCouponsListByIds(couponId);
                if (couponsListByIds != null && couponsListByIds.Rows.Count > 0)
                {
                    for (int i = 0; i < couponsListByIds.Rows.Count; i++)
                    {
                        int key = (int)couponsListByIds.Rows[i]["CouponId"];
                        if (!this.CouponList.ContainsKey(key))
                        {
                            this.CouponList.Add(key, couponsListByIds.Rows[i]["CouponName"].ToString() + "[面值" + couponsListByIds.Rows[i]["CouponValue"].ToString() + "元]");
                        }
                    }
                }
            }
            this.rptList.DataSource = prizesDeliveryList.Data;
            this.rptList.DataBind();
            this.txtTotal.SetWhenIsNotNull(prizesDeliveryList.TotalRecords.ToString());
        }