private void Add() { if (banH.IsBan()) { msgAjax.Error("ban"); return; } int fraction = Fn.IsInt(Req.GetQueryString("star"), 3); if (fraction < 0 || fraction > 5) { fraction = 3; } int userID = 0; if (!LoginInfo.IsLogin()) { userID = LoginInfo.UserID; } string sDetail = Server.HtmlEncode(Req.GetForm("content")); if (sDetail.Length > 600) { msgAjax.Error("above"); return; } string sSql = "insert into CaiPu_Evaluate(FK_User,FK_Pro,Fraction,Detail,Purview,IP) values(@FK_User,@FK_Pro,@Fraction,@Detail,@Purview,@IP)"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User", userID), DbHelp.Def.AddParam("@FK_Pro", id), DbHelp.Def.AddParam("@Fraction", fraction), DbHelp.Def.AddParam("@Detail", sDetail), DbHelp.Def.AddParam("@Purview", 0), DbHelp.Def.AddParam("@IP", Request.UserHostAddress), }; if (DbHelp.Update(sSql, dp) > 0) { banH.Add(); msgAjax.Success("1"); } else { msgAjax.Error("nosubmit"); } }
private int AddComment_Trans(IDbHelp thelp, object obj) { if (AddComment(thelp, obj)) { banH.Add(); msgAjax.Success("1"); return(1); } else { msgAjax.Error("提交失败"); return(0); } }
private int CaiPuEval_Trans(IDbHelp thelp, object obj) { CaiPuMsg_TransM tmod = (CaiPuMsg_TransM)obj; CaiPu_MsgM mod = tmod.mod; string sSql = "insert into CaiPu_Msg(FK_User,FK_Pro,Detail,Purview,IP) values(@FK_User,@FK_Pro,@Detail,@Purview,@IP)"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User", mod.FK_User), DbHelp.Def.AddParam("@FK_Pro", mod.FK_Pro), DbHelp.Def.AddParam("@Detail", mod.Detail), DbHelp.Def.AddParam("@Purview", mod.Purview), DbHelp.Def.AddParam("@IP", mod.IP), }; if (thelp.Update(sSql, dp) > 0) { banH.Add(); //若用户登录 if (mod.FK_User > 0) { //增加积分或经验 string sname = DbHelp.First("select ProName from CaiPu_Info where ProSN=" + mod.FK_Pro); User_FractHandler.FractHandlerParam ufParam = new User_FractHandler.FractHandlerParam(mod.FK_User, "system", 1, "caipu_comment", "caipu_comment", "菜谱评论 \"" + sname + "\""); ufParam.FK_All = mod.FK_Pro; string slog = new User_FractHandler(thelp).SetFract(ufParam); //string slog = new User_FractHandler(thelp).SetFract(mod.FK_User, "system", 1, "caipu_comment", "caipu_comment", "菜谱评论 \"" + sname + "\""); if (slog != "1") { tmod.returnValue = slog; return(0); } } } else { tmod.returnValue = "nosubmit"; return(0); } tmod.returnValue = "1"; return(1); }
private int NewsEval_Trans(IDbHelp thelp, object obj) { NewsMsg_TransM tmod = (NewsMsg_TransM)obj; News_MsgM mod = tmod.mod; string sql = "insert into News_Msg(FK_User,FK_News,Detail,Purview,IP) values(@FK_User,@FK_News,@Detail,@Purview,@IP)"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User", mod.FK_User), DbHelp.Def.AddParam("@FK_News", mod.FK_News), DbHelp.Def.AddParam("@Detail", mod.Detail), DbHelp.Def.AddParam("@Purview", mod.Purview), DbHelp.Def.AddParam("@IP", mod.IP), }; if (thelp.Update(sql, dp) > 0) { banH.Add(); //若用户登录 if (mod.FK_User > 0) { //增加积分或经验 string sname = DbHelp.First("select Title from News_Info where NewsSN=" + mod.FK_News); User_FractHandler.FractHandlerParam ufParam = new User_FractHandler.FractHandlerParam(mod.FK_User, "system", 1, "news_comment", "news_comment", "新闻评论 \"" + sname + "\""); ufParam.FK_All = mod.FK_News; string slog = new User_FractHandler(thelp).SetFract(ufParam); //string slog = new User_FractHandler(thelp).SetFract(mod.FK_User, "system", 1, "news_comment", "news_comment", "新闻评论 \"" + sname + "\""); if (slog != "1") { tmod.returnValue = slog; return(0); } } } else { tmod.returnValue = "nosubmit"; return(0); } tmod.returnValue = "1"; return(1); }
private int ProEval_Trans(IDbHelp thelp, object obj) { ProEval_TransM tmod = (ProEval_TransM)obj; Pro_EvaluateM mod = tmod.mod; string sql = "insert into Pro_Evaluate(FK_User,FK_Pro,Fraction,Detail,Purview,IP) values(@FK_User,@FK_Pro,@Fraction,@Detail,@Purview,@IP)"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User", mod.FK_User), DbHelp.Def.AddParam("@FK_Pro", mod.FK_Pro), DbHelp.Def.AddParam("@Fraction", mod.Fraction), DbHelp.Def.AddParam("@Detail", mod.Detail), DbHelp.Def.AddParam("@Purview", mod.Purview), DbHelp.Def.AddParam("@IP", mod.IP), }; if (thelp.Update(sql, dp) > 0) { banH.Add(); //增加积分或经验 string sname = DbHelp.First("select ProName from Pro_Info where ProSN=" + mod.FK_Pro); User_FractHandler.FractHandlerParam ufParam = new User_FractHandler.FractHandlerParam(mod.FK_User, "system", 1, "pro_eval", "pro_eval", "产品评价 \"" + sname + "\""); ufParam.FK_All = mod.FK_Pro; string slog = new User_FractHandler(thelp).SetFract(ufParam); //string slog = new User_FractHandler(thelp).SetFract(mod.FK_User, "system", 1, "pro_eval", "pro_eval", "产品评价 \"" + sname + "\""); if (slog != "1") { tmod.returnValue = slog; return(0); } tmod.returnValue = "1"; return(1); } else { tmod.returnValue = "nosubmit"; return(0); } }
private void LL() { if (banH.IsBan()) { msgAjax.Error("ban"); return; } string sql = "select Vote from News_Info where NewsSN=" + id; SqlDataSelect d = new SqlDataSelect(sql); if (d.Count > 0) { } else { msgAjax.Error("不存在此新闻"); return; } string vote = d.Eval("Vote").ToString(); JavaScriptObject jsoVote = null; try { jsoVote = (JavaScriptObject)JavaScriptConvert.DeserializeObject(vote); } catch { jsoVote = new JavaScriptObject(); } finally { if (jsoVote == null) { jsoVote = new JavaScriptObject(); } } sql = "select top 1 1 from Vote_Class where PClassSN in(select ClassSN from Vote_Class where Str='news') and Str=@Str"; IDataParameter[] dp = { DbHelp.Def.AddParam("@Str", s), }; if (DbHelp.First(sql, dp, "0") == "1") { object val; if (jsoVote.TryGetValue(s, out val)) { jsoVote[s] = Fn.IsInt(val.ToString(), 0) + 1; } else { jsoVote.Add(s, "1"); } } else { msgAjax.Error("不存在此投票项"); return; } if (jsoVote.Count > 0) { sql = "update News_Info set Vote=@Vote where NewsSN=" + id; IDataParameter[] dp1 = { DbHelp.Def.AddParam("@Vote", JavaScriptConvert.SerializeObject(jsoVote)), }; DbHelp.Update(sql, dp1); banH.Add(); msgAjax.Success("1"); } else { msgAjax.Error("投票失败"); } }