/// <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("会员预存款不足 或 解冻金额超出范围"); } }
public bool Add(Log_SetUserMoneyM pMod) { pMod.IP = HttpContext.Current.Request.UserHostAddress; const string sSQL = "insert into Log_SetUserMoney(FK_User,Number,Operator,SetMoney,Remark,IP) values(@FK_User,@Number,@Operator,@SetMoney,@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("@SetMoney", pMod.SetMoney), DbHelp.Def.AddParam("@Remark", pMod.Remark), DbHelp.Def.AddParam("@IP", pMod.IP), }; return(curHelp.Update(sSQL, dp) > 0); }
/// <summary> /// 设置 预存款 /// </summary> /// <param name="pUserID"></param> /// <param name="pMoney"></param> /// <param name="pRemark"></param> public string SetUserMoney(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}"; } else { sWhere = "where UserSN={1} and UserMoney+{0}>=0";//扣除预存款时不能超过他本身 } string sSQL = string.Format("update User_Info set UserMoney=UserMoney+{0}" + sWhere, pMoney, pUserID); if (curHelp.Update(sSQL) > 0) { 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("预存款 设置失败"); } }