/// <summary> /// 设置会员经验 /// </summary> /// <param name="pUserId"></param> /// <param name="pValue"></param> /// <returns></returns> public string SetUserExp(int pUserID, int pFK_All, string pIdentifier, int pValue, string pOperator, string pRemark) { string sWhere = string.Empty; if (pValue > 0) { sWhere = "where UserSN={1}"; } else { sWhere = "where UserSN={1} and UserExp+{0}>=0";//扣除经验时不能超过他本身 } string sSQL = string.Format("update User_Info set UserExp=UserExp+{0}" + sWhere, pValue, pUserID); if (curHelp.Update(sSQL) > 0) { Log_SetUserExpM mod = new Log_SetUserExpM(); mod.FK_User = pUserID; mod.FK_All = pFK_All; mod.Operator = pOperator; mod.SetValue = pValue; mod.Remark = pRemark; mod.Fract_Identifier = pIdentifier; if (new Log_SetUserExpL(this.curHelp).Add(mod)) { string slog = Upgrade(pUserID); if (slog != "1" && slog != "2") { return(slog); } return("1"); } else { return("设置经验成功,但日志添加失败"); } } else { return("会员经验 设置失败"); } }
public bool Add(Log_SetUserExpM pMod) { pMod.IP = HttpContext.Current.Request.UserHostAddress; const string sSQL = "insert into Log_SetUserExp(FK_User,FK_All,Operator,Fract_Identifier,SetValue,Remark,IP) values(@FK_User,@FK_All,@Operator,@Fract_Identifier,@SetValue,@Remark,@IP)"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User", pMod.FK_User), DbHelp.Def.AddParam("@FK_All", pMod.FK_All), DbHelp.Def.AddParam("@Operator", pMod.Operator), DbHelp.Def.AddParam("@Fract_Identifier", pMod.Fract_Identifier), DbHelp.Def.AddParam("@SetValue", pMod.SetValue), DbHelp.Def.AddParam("@Remark", pMod.Remark), DbHelp.Def.AddParam("@IP", pMod.IP), }; return(curHelp.Update(sSQL, dp) > 0); }