//推荐为满意答案 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; }
protected void Page_Load(object sender, EventArgs e) { if (!B_ARoleAuth.Check(ZLEnum.Auth.content, "ComentManage")) { function.WriteErrMsg("没有权限进行此项操作"); } if (function.isAjax(Request)) { int flag = 0; if (Request.Form["action"] == "add") { flag = replyBut_Click() ? 1 : 2; } else if (Request.Form["action"] == "update") { flag = replyEdit_Click() ? 1 : 2; } Response.Write(flag); Response.Flush(); Response.End(); } if (!this.IsPostBack && !string.IsNullOrEmpty(Request["ID"])) { int id = Int32.Parse(Request["ID"]); m_ask = b_ask.SelReturnModel(id); askName.Text += m_ask.UserName; askTime.Text += m_ask.AddTime.ToString("yyyy年MM月dd日 HH:mm"); askContent.Text = m_ask.Qcontent; this.ViewState["cType"] = "";//this.m_type.ToString(); DataBind(); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ContentManage.aspx'>内容管理</a></li><li><a href='WdCheck.aspx'>百科问答</a></li><li class='active'>问题回复</li>"); } }
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)); }
protected void Lnk_Click(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Audit") { M_Ask askMod = askBll.SelReturnModel(Id); if (askMod.Status == 0) { askBll.UpdateByField("Status", "1", Id); } else { askBll.UpdateByField("Status", "0", Id); } } if (e.CommandName == "Del") { askBll.Del(Id); DataTable dt = answerBll.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"]); answerBll.Del(" ID=" + ID); } } } MyBind(); }
//我的提问 public ActionResult Interactive() { AskAuth(); int Mid = DataConverter.CLng(Request["ID"]); M_Ask askMod = askBll.SelReturnModel(Mid); ViewBag.ansDt = ansBll.Sel(" QueId=" + Mid + " And supplymentid=0", " Status desc", null); return(View(askMod)); }
public int AddAsk(string key, M_Ask askMod) { M_Ucenter ucMod = CheckKey(key); if (ucMod == null) { return(0); } return(askBll.insert(askMod)); }
public IActionResult SearchDetails() { AskAuth(); M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return(WriteErr("问题不存在")); return(Content("")); } ViewBag.dt1 = ansBll.Sel(" QueId=" + Mid + " And Status=1", " Status desc", null); ViewBag.dt2 = ansBll.Sel(" QueId=" + Mid + " And Status=0", " AddTime desc", null); ViewBag.dt3 = askBll.Sel("Status=1", "Addtime desc", null); return(View(askMod)); }
public ActionResult SearchDetails() { AskAuth(); int Mid = DataConvert.CLng(Request["ID"]); M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { function.WriteErrMsg("问题不存在"); return(Content("")); } ViewBag.dt1 = ansBll.Sel(" QueId=" + Mid + " And Status=1", " Status desc", null); ViewBag.dt2 = ansBll.Sel(" QueId=" + Mid + " And Status=0", " AddTime desc", null); ViewBag.dt3 = askBll.Sel("Status=1", "Addtime desc", null); return(View(askMod)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["ID"])) { int id = Convert.ToInt32(Request["ID"]); m_Ask = b_Ask.SelReturnModel(id); } txtContent.Text = m_Ask.Qcontent; txtSupplyment.Text = m_Ask.Supplyment; ddlCate.SelectedItem.Text = m_Ask.QueType; ddlScore.SelectedItem.Text = (m_Ask.Score).ToString(); } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ContentManage.aspx'>内容管理</a></li><li><a href='WdCheck.aspx'>百科问答</a></li><li class='active'>修改问题</li>"); }
//问题的发起人修改问题 public IActionResult AskDetail() { //AskAuth(); M_UserInfo mu = buser.GetLogin(); M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return(WriteErr("问题不存在")); return(null); } if (askMod.UserId != mu.UserID) { Response.Redirect("/Ask/MyAnswer?ID=" + askMod.ID); } ViewBag.ansDt = ansBll.Sel(" QueId=" + Mid + " And supplymentid=0", " Status desc", null); return(View(askMod)); }
protected void btnSubmit_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Request["ID"]); m_Ask = b_Ask.SelReturnModel(id); // throw new Exception(this.txtSupplyment.Text); m_Ask.Qcontent = this.txtContent.Text; m_Ask.Supplyment = this.txtSupplyment.Text; m_Ask.QueType = ddlCate.SelectedItem.Text; m_Ask.Score = Convert.ToInt32(ddlScore.SelectedItem.Text); m_Ask.ID = Convert.ToInt32(Request["ID"]); // throw new Exception(this.txtContent.Text); //throw new Exception(m_Ask.Supplyment); // throw new Exception(this.txtSupplyment.Text); b_Ask.UpdateByID(m_Ask); function.WriteSuccessMsg("修改成功!", "WdCheck.aspx?"); }
//推荐为满意答案 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 IActionResult Add_Submit() { if (GuestConfig.GuestOption.WDOption.IsLogin && mu.IsNull) { return(RedirectToAction("Login", "", new { area = "User", ReturnUrl = "/Ask/Add" })); } int score = DataConverter.CLng(Request.Form["ddlScore"]); if (mu.UserID > 0 && mu.UserExp < score) { return(WriteErr("积分不足")); } //--------------- M_Ask askMod = new M_Ask(); askMod.QTitle = RequestEx["QTitle"]; askMod.Qcontent = RequestEx["QContent"].Trim(); askMod.UserId = mu.UserID; askMod.UserName = mu.IsNull ? "游客" : mu.UserName; askMod.Score = score; askMod.IsNi = DataConvert.CLng(Request.Form["isAnony_chk"]); askMod.IsSole = DataConvert.CLng(Request.Form["isSole_chk"]); askMod.QueType = Request.Form["QueType"]; //if (string.IsNullOrEmpty(askMod.QueType)) { askMod.QueType = Request.Form["ddlCate"]; } askMod.ID = askBll.insert(askMod); if (!mu.IsNull) { if (score > 0) { //悬赏积分 buser.MinusVMoney(mu.UserID, score, M_UserExpHis.SType.Point, mu.UserName + "提交问题[" + askMod.Qcontent + "],扣除悬赏积分-" + score); } if (GuestConfig.GuestOption.WDOption.QuestPoint > 0) { buser.AddMoney(mu.UserID, GuestConfig.GuestOption.WDOption.QuestPoint, ((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), mu.UserName + "提交问题[" + askMod.Qcontent + "],增加问答积分" + GuestConfig.GuestOption.WDOption.QuestPoint); } } return(RedirectToAction("AddSuccess")); }
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 ActionResult MyAnswer() { AskAuth(); M_UserInfo mu = b_tuser.GetLogin(); if (!string.IsNullOrEmpty(GuestConfig.GuestOption.WDOption.ReplyGroup)) { //用户组回复权限 string groups = "," + GuestConfig.GuestOption.WDOption.ReplyGroup + ","; if (!groups.Contains("," + mu.GroupID.ToString() + ",")) { function.WriteErrMsg("您没有回复问题的权限!"); return(Content("")); } } ViewBag.adoption = adoption; ViewBag.solvedcount = solvedcount; ViewBag.solvingcount = solvingcount; ViewBag.usercount = usercount; int Mid = DataConverter.CLng(Request["ID"]); M_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { function.WriteErrMsg("问题不存在!"); return(Content("")); } if (askMod.Status == 0) { function.WriteErrMsg("该问题未经过审核,无法对其答复!", "/Guest/Ask/List"); return(Content("")); } if (askMod.UserId == buser.GetLogin().UserID) { Response.Redirect("Interactive?ID=" + Mid); return(Content("")); } ViewBag.ansDt = ansBll.Sel(" QueId=" + Mid + " And supplymentid=0 AND status<>0", "", null); return(View(askMod)); }
public ActionResult AddToFav() { M_Favorite favMod = new M_Favorite(); favMod.InfoID = DataConvert.CLng(Request["infoID"]); favMod.Owner = mu.UserID; favMod.AddDate = DateTime.Now; favMod.FavoriType = DataConvert.CLng(Request.Form["type"], 1); //--------------------------- favMod.FavItemID = ""; favMod.Title = HttpUtility.HtmlEncode(Request["title"]); favMod.FavUrl = Request.Form["url"]; switch (favMod.FavoriType) { case 1: case 3: { M_CommonData conMod = conBll.SelReturnModel(favMod.InfoID); if (conMod == null) { err = "内容ID[" + favMod.InfoID + "]不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = conMod.Title; } } break; case 2: { M_Product proMod = proBll.GetproductByid(favMod.InfoID); if (proMod == null) { err = "商品不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = proMod.Proname; } } break; case 4: { B_Ask askBll = new B_Ask(); M_Ask askMod = askBll.SelReturnModel(favMod.InfoID); if (askMod == null) { err = "问题不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = StringHelper.SubStr(askMod.Qcontent); } } break; case 5: { B_Baike bkBll = new B_Baike(); M_Baike bkMod = bkBll.SelReturnModel(favMod.InfoID); if (bkMod == null) { err = "百科不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = bkMod.Tittle; } } break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = "无标题"; } if (favMod.InfoID < 1) { err = "未指定内容ID"; } else if (favMod.Owner < 1) { err = "用户未登录"; } else { favBll.insert(favMod); } ViewBag.err = err; return(View()); }
public void Add_Submit() { AskAuth(); M_UserInfo mu = buser.GetLogin(); int score = DataConverter.CLng(Request.Form["ddlScore"]); if (mu.UserID > 0) { if (mu.UserExp < score) { function.WriteErrMsg("积分不足"); return; } } else if (!GuestConfig.GuestOption.WDOption.IsLogin) { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"].Trim())) { function.WriteErrMsg("验证码不正确!"); return; } } else { Response.Redirect("/User/Login?ReturnUrl=/Ask/Add"); return; } M_Ask askMod = new M_Ask(); askMod.Qcontent = Request.Form["txtContent"].Trim(); askMod.Supplyment = Request.Form["txtSupplyment"].Trim(); askMod.AddTime = DateTime.Now; askMod.UserId = mu.UserID; askMod.UserName = mu.UserID > 0 ? mu.UserName : mu.UserName + "[" + mu.WorkNum + "]"; askMod.Score = score; askMod.IsNi = DataConverter.CBool(Request.Form["isNi"]) ? 1 : 0; askMod.QueType = Request.Form["subgrade"]; if (string.IsNullOrEmpty(askMod.QueType)) { askMod.QueType = Request.Form["ddlCate"]; } askMod.Elite = 0; askMod.Status = 1; int flag = askBll.insert(askMod); DataTable dts = askBll.Sel(); if (score > 0 && buser.CheckLogin()) { //悬赏积分 buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { score = 0 - score, ScoreType = (int)M_UserExpHis.SType.Point, detail = mu.UserName + "提交问题[" + askMod.Qcontent + "],扣除悬赏积分-" + score }); } //string fix = Request["fix"]; //if (!string.IsNullOrEmpty(fix))//提交时,若求助对象可见,则向求助对象发送一条短信息 //{ // B_Message message = new B_Message(); // M_Message messInfo = new M_Message(); // messInfo.Incept = fix; // string UserName = mu.UserName; // messInfo.Sender = mu.UserID.ToString(); // messInfo.Title = "来自" + mu.UserName + "的问答求助"; // messInfo.PostDate = DateTime.Now; // messInfo.Content = "<a href=\"/Guest/Question/MyAnswer?ID=" + (dts.Rows[0]["ID"]).ToString() + "\" target=\"_blank\">" + askMod.Qcontent + "</a>"; // messInfo.Savedata = 0; // messInfo.Receipt = ""; // int i = message.GetInsert(messInfo); //} if (flag > 0 && mu.UserID > 0) { buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { score = GuestConfig.GuestOption.WDOption.QuestPoint, ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))), detail = mu.UserName + "提交问题[" + askMod.Qcontent + "],增加问答积分" + GuestConfig.GuestOption.WDOption.QuestPoint }); } Response.Redirect("AddSuccess"); return; }
public int insert(M_Ask model) { return(DBCenter.Insert(model)); }
public bool UpdateByID(M_Ask model) { return(DBCenter.UpdateByID(model, model.ID)); }
public bool UpdateByID(M_Ask model) { return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), initMod.GetParameters())); }