Exemple #1
0
        public SuccessResponse <IAPIResponseData> TransactionList(APIRequest <TransactionListRP> rp)
        {
            var cardDepositBLL = new CardDepositBLL(CurrentUserInfo);
            var rd             = new TransactionListRD();
            var rsp            = new SuccessResponse <IAPIResponseData>(rd);

            DataSet ds = _currentDAO.TransactionList(rp.Parameters.PageSize, rp.Parameters.PageIndex);

            if (ds.Tables.Count == 2)
            {
                var transactionList = (from d in ds.Tables[0].AsEnumerable()
                                       select new Transaction()
                {
                    Amount = d["Amount"].ToString(),
                    AmountSource = d["AmountSource"].ToString(),
                    CreateTime = d["CreateTime"].ToString(),
                    Phone = d["Phone"].ToString(),
                    UnitName = d["UnitName"].ToString(),
                    VipCode = d["VipCode"].ToString(),
                    VipName = d["VipName"].ToString(),
                    VipRealName = d["VipRealName"].ToString(),
                    RoomType = d["Remark"].ToString(),
                    IDCard = d["Col2"].ToString()
                });

                rd.TransactionArray = transactionList.ToArray();
                rd.TotalPage        = int.Parse(ds.Tables[1].Rows[0][0].ToString());
                rd.TotalCount       = int.Parse(ds.Tables[1].Rows[0][1].ToString());
            }

            return(rsp);
        }
Exemple #2
0
        public SuccessResponse <IAPIResponseData> CardSummary(APIRequest <CardSummaryRP> rp)
        {
            var cardDepositBLL = new CardDepositBLL(CurrentUserInfo);
            var rd             = new CardSummaryRD();
            var rsp            = new SuccessResponse <IAPIResponseData>(rd);

            DataSet ds = _currentDAO.CardSummary(rp.Parameters.PageSize, rp.Parameters.PageIndex);

            if (ds.Tables.Count == 2)
            {
                var cardSummaryList = (from d in ds.Tables[0].AsEnumerable()
                                       select new CardSummary()
                {
                    ChannelTitle = d["ChannelTitle"].ToString(),
                    Amount = d["Amount"].ToString(),
                    ActivatedAmount = d["ActivatedAmount"].ToString()
                });

                rd.CardSummaryArray = cardSummaryList.ToArray();
                rd.TotalPage        = int.Parse(ds.Tables[1].Rows[0][0].ToString());
                rd.TotalCount       = int.Parse(ds.Tables[1].Rows[0][1].ToString());
            }

            return(rsp);
        }
Exemple #3
0
        public int ActiveCard(APIRequest <ActiveCardRP> rp)
        {
            var cardDepositBLL = new CardDepositBLL(CurrentUserInfo);
            var cardDeposit    = PagedSearch(new GetCardRP()
            {
                CardNo = rp.Parameters.CardNo, UseStatus = "0"
            }, CurrentUserInfo.ClientID);

            int result = 0;

            if (cardDeposit != null && cardDeposit.Tables.Count > 0 && cardDeposit.Tables[0].Rows.Count > 0)
            {
                DataRow dr = cardDeposit.Tables[0].Rows[0];
                if (rp.Parameters.CardPassword == System.Text.Encoding.UTF8.GetString(cardDepositBLL.DecryptCardPassword((byte[])dr["CardPassword"])).Replace("\0", ""))
                {
                    System.Data.SqlClient.SqlTransaction tran = GetTran();
                    using (tran.Connection)
                    {
                        string       errorMessage = "";
                        VipAmountBLL vipAmountBLL = new VipAmountBLL(CurrentUserInfo);
                        vipAmountBLL.SetVipAmountChange(CurrentUserInfo.ClientID, 4, rp.Parameters.VipID, decimal.Parse(dr["Amount"].ToString()) + decimal.Parse(dr["Bonus"].ToString()), dr["CardDepositId"].ToString(), "Prepaid card charge", "In", out errorMessage, tran);
                        result = this._currentDAO.ActiveCard(rp.Parameters.CardNo, rp.Parameters.VipID, this.CurrentUserInfo.UserID, this.CurrentUserInfo.ClientID, tran);

                        tran.Commit();
                    }
                }
            }

            return(result);
        }
Exemple #4
0
        public SuccessResponse <IAPIResponseData> VipConsume(APIRequest <VipConsumeRP> rp)
        {
            var cardDepositBLL            = new CardDepositBLL(CurrentUserInfo);
            var registerValidationCodeBLL = new RegisterValidationCodeBLL(CurrentUserInfo);
            var vipBLL = new VipBLL(CurrentUserInfo);
            var rd     = new EmptyRD();
            var rsp    = new SuccessResponse <IAPIResponseData>(rd);

            string phone = "";

            var vip = vipBLL.Query(new IWhereCondition[] { new EqualsCondition()
                                                           {
                                                               FieldName = "VipID", Value = rp.Parameters.VipID
                                                           } }, null);

            if (vip.Length > 0)
            {
                phone = vip[0].Phone;

                if (string.IsNullOrEmpty(phone))
                {
                    rsp.ResultCode = 202;
                    rsp.Message    = "会员未注册手机号!";
                }
                else if (string.IsNullOrEmpty(rp.Parameters.SMSCode))
                {
                    //发送验证码
                    registerValidationCodeBLL.SendCode(phone);
                }
                else
                {
                    //验证验证码
                    var codeEntity = registerValidationCodeBLL.Query(new IWhereCondition[] {
                        new EqualsCondition()
                        {
                            FieldName = "Mobile", Value = phone
                        }
                        , new EqualsCondition()
                        {
                            FieldName = "Code", Value = rp.Parameters.SMSCode
                        }
                        , new EqualsCondition()
                        {
                            FieldName = "IsValidated", Value = 0
                        }
                        , new EqualsCondition()
                        {
                            FieldName = "IsDelete", Value = 0
                        }
                    }, new OrderBy[] {
                        new OrderBy()
                        {
                            FieldName = "CreateTime", Direction = OrderByDirections.Desc
                        }
                    });

                    if (codeEntity != null && codeEntity.Length > 0)
                    {
                        System.Data.SqlClient.SqlTransaction tran = GetTran();
                        using (tran.Connection)
                        {
                            registerValidationCodeBLL.DeleteByMobile(phone, 1, tran);

                            string       errorMessage = "";
                            VipAmountBLL vipAmountBLL = new VipAmountBLL(CurrentUserInfo);
                            vipAmountBLL.SetVipAmountChange(CurrentUserInfo.ClientID, 5, rp.Parameters.VipID, rp.Parameters.Amount, CurrentUserInfo.CurrentUserRole.UnitId, "Prepaid card consumption" + "~" + (rp.Parameters.DocumentCode ?? ""), "Out", out errorMessage, tran);

                            tran.Commit();
                        }
                    }
                    else
                    {
                        rsp.ResultCode = 203;
                        rsp.Message    = "请先获取验证码!";
                    }
                }
            }
            else
            {
                rsp.ResultCode = 201;
                rsp.Message    = "会员不存在!";
            }

            return(rsp);
        }