示例#1
0
        public UserRedPagerInfo GetUserRedPagerByOrderIDAndUserID(int userid, string orderid)
        {
            UserRedPagerInfo info             = new UserRedPagerInfo();
            DbCommand        sqlStringCommand = this.database.GetSqlStringCommand("select top 1 * from vshop_UserRedPager where OrderID=@OrderID and UserID=@UserID");

            this.database.AddInParameter(sqlStringCommand, "UserID", DbType.Int32, userid);
            this.database.AddInParameter(sqlStringCommand, "OrderID", DbType.String, orderid);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateUserRedPagerInfo(reader);
                }
            }
            return(info);
        }
示例#2
0
        public string CreateUserRedPager(UserRedPagerInfo userredpager)
        {
            if (this.HasGetThisRedPager(userredpager.UserID, userredpager.OrderID))
            {
                return("-1");
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("if exists(select top 1 OrderID from vshop_OrderRedPager where OrderID=@OrderID and MaxGetTimes>AlreadyGetTimes) begin Update vshop_OrderRedPager set AlreadyGetTimes=AlreadyGetTimes+1 where OrderID=@OrderID;INSERT INTO vshop_UserRedPager(Amount,UserID,OrderID,RedPagerActivityName,OrderAmountCanUse,CreateTime,ExpiryTime,IsUsed) VALUES(@Amount,@UserID,@OrderID,@RedPagerActivityName,@OrderAmountCanUse,@CreateTime,@ExpiryTime,@IsUsed); select 1 end else begin select 0 end");

            this.database.AddInParameter(sqlStringCommand, "Amount", DbType.Decimal, userredpager.Amount);
            this.database.AddInParameter(sqlStringCommand, "UserID", DbType.Int32, userredpager.UserID);
            this.database.AddInParameter(sqlStringCommand, "OrderID", DbType.String, userredpager.OrderID);
            this.database.AddInParameter(sqlStringCommand, "RedPagerActivityName", DbType.String, userredpager.RedPagerActivityName);
            this.database.AddInParameter(sqlStringCommand, "OrderAmountCanUse", DbType.Decimal, userredpager.OrderAmountCanUse);
            this.database.AddInParameter(sqlStringCommand, "CreateTime", DbType.DateTime, userredpager.CreateTime);
            this.database.AddInParameter(sqlStringCommand, "ExpiryTime", DbType.DateTime, userredpager.ExpiryTime);
            this.database.AddInParameter(sqlStringCommand, "IsUsed", DbType.Boolean, userredpager.IsUsed);
            return(this.database.ExecuteScalar(sqlStringCommand).ToString());
        }
示例#3
0
        public UserRedPagerInfo GetUserRedPagerByRedPagerID(int redpagerid)
        {
            if (redpagerid <= 0)
            {
                return(null);
            }
            UserRedPagerInfo info             = null;
            string           query            = string.Format("select * FROM vshop_UserRedPager WHERE redpagerid={0}", redpagerid);
            DbCommand        sqlStringCommand = this.database.GetSqlStringCommand(query);

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateUserRedPagerInfo(reader);
                }
            }
            return(info);
        }
示例#4
0
 public static string CreateUserRedPager(UserRedPagerInfo userredpager)
 {
     return(new UserRedPagerDao().CreateUserRedPager(userredpager));
 }
示例#5
0
        protected override void AttachChildControls()
        {
            string s    = HttpContext.Current.Request.QueryString.Get("m");
            string str2 = HttpContext.Current.Request.QueryString.Get("type");

            this.ltGetTotal                      = (Literal)this.FindControl("ltGetTotal");
            this.ltOrderAmountCanUse             = (Literal)this.FindControl("ltOrderAmountCanUse");
            this.ltExpiryTime                    = (Literal)this.FindControl("ltExpiryTime");
            this.ltRedPagerActivityName          = (Literal)this.FindControl("ltRedPagerActivityName");
            this.ltRedPagerActivityNameForOrders = (Literal)this.FindControl("ltRedPagerActivityNameForOrders");
            this.divNoLogin                      = (Panel)this.FindControl("divNoLogin");
            this.divNoNum   = (Panel)this.FindControl("divNoNum");
            this.divSuccess = (Panel)this.FindControl("divSuccess");
            this.hlinkLogin = (HyperLink)this.FindControl("hlinkLogin");
            switch (str2)
            {
            case "1":
            case "5":
            {
                int result = 0;
                int.TryParse(s, out result);
                if (result > 0)
                {
                    string           orderid = HttpContext.Current.Request.QueryString.Get("orderid");
                    UserRedPagerInfo userRedPagerByOrderIDAndUserID = UserRedPagerBrower.GetUserRedPagerByOrderIDAndUserID(result, orderid);
                    if (userRedPagerByOrderIDAndUserID != null)
                    {
                        this.ltGetTotal.Text          = userRedPagerByOrderIDAndUserID.Amount.ToString().Split(new char[] { '.' })[0];
                        this.ltOrderAmountCanUse.Text = userRedPagerByOrderIDAndUserID.OrderAmountCanUse.ToString("F2").Replace(".00", "");
                        this.ltExpiryTime.Text        = userRedPagerByOrderIDAndUserID.ExpiryTime.ToString("yyyy-M-d");
                        if (str2 == "5")
                        {
                            this.ltRedPagerActivityName.Text = "该券已经到你的钱包了</div><div class='get-red-explain'><a href='/Vshop/myredpager.aspx'>点击查看</a>";
                        }
                        else
                        {
                            this.ltRedPagerActivityName.Text = userRedPagerByOrderIDAndUserID.RedPagerActivityName ?? "";
                        }
                        this.divSuccess.Visible = true;
                    }
                }
                PageTitle.AddSiteNameTitle("成功获取代金券");
                return;
            }

            default:
            {
                string str6 = str2;
                if (str6 != null)
                {
                    if (!(str6 == "-1"))
                    {
                        if ((str6 == "-2") || (str6 == "-4"))
                        {
                            this.divNoLogin.Visible = true;
                            break;
                        }
                        if (str6 == "-3")
                        {
                            this.divNoNum.Visible = true;
                            break;
                        }
                    }
                    else
                    {
                        string            str4 = HttpContext.Current.Request.QueryString.Get("orderid");
                        OrderRedPagerInfo orderRedPagerInfo = OrderRedPagerBrower.GetOrderRedPagerInfo(str4);
                        if (orderRedPagerInfo != null)
                        {
                            this.ltRedPagerActivityNameForOrders.Text = orderRedPagerInfo.RedPagerActivityName;
                            string str5 = "http://" + Globals.DomainName + Globals.ApplicationPath + "/Vshop/GetRedPager.aspx?orderid=" + str4;
                            this.hlinkLogin.NavigateUrl = "/Vshop/UserLogin.aspx?returnUrl=" + HttpContext.Current.Server.UrlEncode(str5 + "&" + this.getopenid());
                            this.divNoLogin.Visible     = true;
                        }
                        else
                        {
                            HttpContext.Current.Response.Redirect("/Vshop/");
                            HttpContext.Current.Response.End();
                        }
                    }
                }
                break;
            }
            }
            PageTitle.AddSiteNameTitle("获取代金券");
        }