Exemplo n.º 1
0
        /// <summary>
        /// 用户已付款
        /// </summary>
        /// <param name="pUserID"></param>
        /// <param name="pMoney"></param>
        /// <param name="pRemark"></param>
        public string UserPay(int pUserID, double pMoney, string pOperator, string pRemark, string pNumber)
        {
            if (pMoney == 0)
            {
                return("1");
            }

            if (pMoney > 0)
            {
                return("设置付款,金额应是负数");
            }

            string sSQL = string.Format("update User_Info set UserMoney=UserMoney+{0},UserFreezeMoney=UserFreezeMoney+{0} where UserSN={1} and UserMoney+{0}>=0 and UserFreezeMoney+{0}>=0", pMoney, pUserID);

            if (curHelp.Update(sSQL) > 0)
            {
                string sMsg = string.Empty;

                //添加 冻结金额日志
                Log_SetUserFreezeMoneyM freMod = new Log_SetUserFreezeMoneyM();
                freMod.FK_User        = pUserID;
                freMod.Number         = pNumber;
                freMod.Operator       = pOperator;
                freMod.SetFreezeMoney = pMoney;
                freMod.Remark         = pRemark;
                if (!(new Log_SetUserFreezeMoneyL(this.curHelp).Add(freMod)))
                {
                    return("设置冻结金额成功,但日志添加失败");
                }

                //添加 预存款日志
                Log_SetUserMoneyM mod = new Log_SetUserMoneyM();
                mod.FK_User  = pUserID;
                mod.Number   = pNumber;
                mod.Operator = pOperator;
                mod.SetMoney = pMoney;
                mod.Remark   = pRemark;
                if (new Log_SetUserMoneyL(this.curHelp).Add(mod))
                {
                    return("1");
                }
                else
                {
                    return("设置预存款成功,但日志添加失败");
                }
            }
            else
            {
                return("会员预存款不足 或 解冻金额超出范围");
            }
        }
Exemplo n.º 2
0
        public bool Add(Log_SetUserFreezeMoneyM pMod)
        {
            pMod.IP = HttpContext.Current.Request.UserHostAddress;

            const string sSQL = "insert into Log_SetUserFreezeMoney(FK_User,Number,Operator,SetFreezeMoney,Remark,IP) values(@FK_User,@Number,@Operator,@SetFreezeMoney,@Remark,@IP)";

            IDataParameter[] dp =
            {
                DbHelp.Def.AddParam("@FK_User",        pMod.FK_User),
                DbHelp.Def.AddParam("@Number",         pMod.Number),
                DbHelp.Def.AddParam("@Operator",       pMod.Operator),
                DbHelp.Def.AddParam("@SetFreezeMoney", pMod.SetFreezeMoney),
                DbHelp.Def.AddParam("@Remark",         pMod.Remark),
                DbHelp.Def.AddParam("@IP",             pMod.IP),
            };

            return(curHelp.Update(sSQL, dp) > 0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设置 冻结/解冻金额
        /// </summary>
        /// <param name="pUserID"></param>
        /// <param name="pMoney"></param>
        /// <param name="pRemark">备注</param>
        /// <returns></returns>
        public string SetFreezeMoney(int pUserID, double pMoney, string pOperator, string pRemark, string pNumber)
        {
            if (pMoney == 0)
            {
                return("1");
            }

            string sWhere = string.Empty;

            if (pMoney > 0)
            {
                sWhere = " where UserSN={1} and UserMoney>=(UserFreezeMoney+{0})";//冻结时不能超过会员的预存款
            }
            else
            {
                sWhere = " where UserSN={1} and UserFreezeMoney+{0}>=0";//解冻时不能超过已冻结的金额
            }
            string sSQL = string.Format("update User_Info set UserFreezeMoney=UserFreezeMoney+{0}" + sWhere, pMoney, pUserID);

            if (curHelp.Update(sSQL) > 0)
            {
                Log_SetUserFreezeMoneyM freMod = new Log_SetUserFreezeMoneyM();
                freMod.FK_User        = pUserID;
                freMod.Number         = pNumber;
                freMod.Operator       = pOperator;
                freMod.SetFreezeMoney = pMoney;
                freMod.Remark         = pRemark;

                if (new Log_SetUserFreezeMoneyL(this.curHelp).Add(freMod))
                {
                    return("1");
                }
                else
                {
                    return("设置冻结金额成功,但日志添加失败");//设置冻结金额成功,但日志添加失败
                }
            }
            else
            {
                return("解冻金额 设置失败");//冻结/解冻金额 设置失败
            }
        }