public IActionResult MyAnswer() { AskAuth(); M_UserInfo mu = tuBll.GetLogin(); //if (!string.IsNullOrEmpty(GuestConfig.GuestOption.WDOption.ReplyGroup)) //{ // //用户组回复权限 // string groups = "," + GuestConfig.GuestOption.WDOption.ReplyGroup + ","; // if (!groups.Contains("," + mu.GroupID.ToString() + ",")) // { return WriteErr("您没有回复问题的权限!");return Content(""); } //} M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return(WriteErr("问题不存在!")); return(Content("")); } if (askMod.Status == 0) { return(WriteErr("该问题未经过审核,无法对其答复!", "/Ask/List")); return(Content("")); } if (askMod.UserId == mu.UserID) { Response.Redirect("Interactive?ID=" + Mid); return(Content("")); } //----检测自己是否有回复过该问题 M_GuestAnswer ansMod = ansBll.SelModelByAsk(askMod.ID, mu.UserID); if (ansMod == null) { ansMod = new M_GuestAnswer(); } ViewBag.ansMod = ansMod; return(View(askMod)); }
//推荐为满意答案 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; }
//服务端更新(Diuse) protected void replyEdit_Click(object sender, EventArgs e) { m_guestanswer = ViewState["reply"] as M_GuestAnswer; m_guestanswer.Content = txtContent.Value; b_guestanswer.UpdateByID(m_guestanswer); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改成功');location=location;", true); }
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(); }
//更新 protected bool replyEdit_Click() { if (string.IsNullOrEmpty(Request.Form["id"]) || string.IsNullOrEmpty(Request.Form["content"])) { return(false); } int id = DataConvert.CLng(Request.Form["id"]);//回复ID string content = Request.Form["content"]; m_guestanswer = b_guestanswer.SelReturnModel(id); m_guestanswer.Content = content; b_guestanswer.UpdateByID(m_guestanswer); return(true); }
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 SuppleAsk() { M_UserInfo mu = buser.GetLogin(); M_GuestAnswer ansMod = new M_GuestAnswer(); ansMod.QueId = DataConverter.CLng(RequestEx["ID"]); ansMod.Content = this.Request.Form["txtSupplyment"]; ansMod.AddTime = DateTime.Now; ansMod.UserId = buser.GetLogin().UserID; ansMod.UserName = buser.GetLogin().UserName; ansMod.Status = 0; ansMod.audit = 0; ansMod.supplymentid = DataConverter.CLng(Request.Form["Rid"]); ansBll.insert(ansMod); return(WriteOK("追问成功!", "Interactive?ID=" + ansMod.QueId)); }
//推荐为满意答案 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)); }
//每个用户在一个问题下,只能有一个回答 public IActionResult Answer_Submit() { M_UserInfo tmu = tuBll.GetLogin(); if (GuestConfig.GuestOption.WDOption.IsReply && tmu.UserID <= 0) { Response.Redirect("/User/Login?ReturnUrl=/Ask/MyAnswer"); } M_GuestAnswer ansMod = ansBll.SelModelByAsk(Mid, tmu.UserID); if (ansMod == null || tmu.UserID < 1) { ansMod = new M_GuestAnswer(); } //----------------------- ansMod.UserId = tmu.UserID; ansMod.Content = StringHelper.Strip_Script(Request.Form["ans_content"]); ansMod.QueId = Mid; ansMod.UserName = tmu.UserID > 0 ? tmu.UserName : tmu.UserName + "[" + tmu.WorkNum + "]"; ansMod.IsNi = DataConvert.CLng(Request.Form["ans_IsNi"]); if (ansMod.ID < 1) { ansMod.ID = ansBll.insert(ansMod); } else { ansBll.UpdateByID(ansMod); } if (tmu.UserID > 0) { M_Ask askMod = askBll.SelReturnModel(ansMod.QueId); buser.ChangeVirtualMoney(tmu.UserID, new M_UserExpHis() { score = GuestConfig.GuestOption.WDOption.WDPoint, ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), detail = string.Format("{0} {1}在问答中心回答了{2}问题,赠送{3}分", DateTime.Now, tmu.UserName, "", GuestConfig.GuestOption.WDOption.WDPoint) }); } return(WriteOK("回答成功", "List")); }
public void Answer() { M_UserInfo tmu = b_tuser.GetLogin(); if (GuestConfig.GuestOption.WDOption.IsReply && tmu.UserID <= 0) { Response.Redirect("/User/Login?ReturnUrl=/Guest/Ask/MyAnswer"); return; } M_GuestAnswer ansMod = new M_GuestAnswer(); ansMod.UserId = tmu.UserID; ansMod.Content = Server.HtmlEncode(Request.Form["txtContent"]); ansMod.QueId = DataConverter.CLng(Request["ID"]); ansMod.AddTime = DateTime.Now; ansMod.Status = 0; ansMod.UserName = tmu.UserID > 0 ? tmu.UserName : tmu.UserName + "[" + tmu.WorkNum + "]"; ansMod.supplymentid = 0; ansMod.audit = 0; ansMod.IsNi = DataConverter.CBool(Request.Form["CkIsNi"]) ? 1 : 0; ansBll.insert(ansMod); if (tmu.UserID > 0) { M_Ask askMod = askBll.SelReturnModel(ansMod.QueId); string questname = buser.SelReturnModel(askMod.UserId).UserName; if (string.IsNullOrEmpty(questname)) { questname = "匿名用户"; } buser.ChangeVirtualMoney(tmu.UserID, new M_UserExpHis() { score = GuestConfig.GuestOption.WDOption.WDPoint, ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), detail = string.Format("{0} {1}在问答中心回答了{2}的问题,赠送{3}分", DateTime.Now, tmu.UserName, questname, GuestConfig.GuestOption.WDOption.WDPoint) }); } function.WriteSuccessMsg("回答成功", "List"); return; }
public int insert(M_GuestAnswer model) { return(DBCenter.Insert(model)); }
public bool UpdateByID(M_GuestAnswer model) { return(DBCenter.UpdateByID(model, model.ID)); }
public int insert(M_GuestAnswer model) { return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
public bool UpdateByID(M_GuestAnswer model) { return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }