//更新 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 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 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")); }