protected void Lnk_Click(object sender, GridViewCommandEventArgs e) { int Id = DataConvert.CLng(e.CommandArgument.ToString()); if (e.CommandName == "Audit") { m_guestanswer = b_guestanswer.SelReturnModel(Id); if (m_guestanswer.Status == 0) { b_guestanswer.Update(" Status = 1", " ID=" + Id); } else { b_guestanswer.Update(" Status = 0", " ID=" + Id); } } else if (e.CommandName == "Del") { b_guestanswer.Del(" ID=" + Id); DataTable dt = b_guestanswer.Sel(" QueId=" + Id, "", null); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { int ID = Convert.ToInt32(dt.Rows[i]["ID"]); b_guestanswer.Del(" ID=" + ID); } } } DataBind(); }
//推荐为满意答案 public void Recomand() { int Mid = DataConvert.CLng(Request["ID"]); M_GuestAnswer ansMod = ansBll.SelReturnModel(DataConverter.CLng(Request["aid"])); M_UserInfo answeuser = buser.SelReturnModel(ansMod.UserId);//回答人用户模型 ansMod.Status = 1; ansBll.UpdateByID(ansMod); M_Ask mask = askBll.SelReturnModel(Mid); mask.Status = 2; //问题状态设置为已解决 if (askBll.SelReturnModel(Mid).Score > 0) { buser.ChangeVirtualMoney(ansMod.UserId, new M_UserExpHis()//悬赏积分 { score = mask.Score, ScoreType = (int)M_UserExpHis.SType.Point, detail = answeuser.UserName + "对问题[" + mask.Qcontent + "]的回答被推荐为满意答案,增加悬赏积分+" + mask.Score.ToString() }); } buser.ChangeVirtualMoney(ansMod.UserId, new M_UserExpHis()//问答积分 { score = GuestConfig.GuestOption.WDOption.WDRecomPoint, ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), detail = answeuser.UserName + "对问题[" + mask.Qcontent + "]的回答被推荐为满意答案,增加问答积分+" + GuestConfig.GuestOption.WDOption.WDRecomPoint }); askBll.UpdateByID(mask); function.WriteSuccessMsg("推荐成功!", "Interactive?ID=" + Mid); return; }
public string GetQueAnswer() { string result = ""; B_GuestAnswer answerBll = new B_GuestAnswer(); M_GuestAnswer answerMod = answerBll.SelReturnModel("Where Status=1 And QueId=" + DataConverter.CLng(Eval("ID").ToString())); if (answerMod != null) { result += "<p><a href=\"#\"><img src=\"" + GetUserFace(answerMod.UserId.ToString()) + "\" alt=\"" + answerMod.UserName + "\" /> " + answerMod.UserName + "</a><span>最佳答案</span> " + answerMod.Content + "</p>"; result += "<div class=\"viewcon_ask_lsb\"><div class=\"pull-left\">标签:<span>黄果树</span><span>安顺</span><span>火车站</span></div><div class=\"pull-right\"><span>" + answerMod.AddTime.ToString("yyyy-MM-dd HH:mm:ss") + "</span><span>有用(1)</span><span>同问(1)</span><span>回答(1)</span><span>浏览(1)</span></div><div class=\"clearfix\"></div></div>"; } else { } return(result); }
//推荐为满意答案 public IActionResult Recomand() { M_GuestAnswer ansMod = ansBll.SelReturnModel(DataConverter.CLng(RequestEx["aid"])); M_UserInfo ansUser = buser.SelReturnModel(ansMod.UserId);//回答人用户模型 if (ansMod == null) { return(WriteErr("回答不存在")); } M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return(WriteErr("问题不存在")); } if (ansMod.QueId != askMod.ID) { return(WriteErr("问题与答案不匹配")); } //--------------------------------------- ansMod.Status = 1; //满意答案 DBCenter.UpdateSQL(ansMod.TbName, "[Status]=1", "ID=" + ansMod.ID); askMod.Status = 2; //问题状态设置为已解决 DBCenter.UpdateSQL(askMod.TbName, "[Status]=2", "ID=" + askMod.ID); if (askMod.Score > 0) { buser.ChangeVirtualMoney(ansMod.UserId, new M_UserExpHis()//悬赏积分 { score = askMod.Score, ScoreType = (int)M_UserExpHis.SType.Point, detail = ansUser.UserName + "对问题[" + askMod.QTitle + "]的回答被推荐为满意答案,增加悬赏积分+" + askMod.Score }); } buser.ChangeVirtualMoney(ansMod.UserId, new M_UserExpHis()//问答积分 { score = GuestConfig.GuestOption.WDOption.WDRecomPoint, ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), detail = ansUser.UserName + "对问题[" + askMod.QTitle + "]的回答被推荐为满意答案,增加问答积分+" + GuestConfig.GuestOption.WDOption.WDRecomPoint }); return(WriteOK("推荐成功!", "Interactive?ID=" + Mid)); }