//插入一条新的咨询 public int InsertSWfsQuestAnswer(SWfsQuestAnswer QA) { UpdateSWfsQuestAnswerOperateUserId(QA.QuestAnswerId, PresentationHelper.GetPassport().UserName); return(DapperUtil.Insert <SWfsQuestAnswer>(QA, false)); }
//更新一条新的咨询 public bool UpdateSWfsQuestAnswer(SWfsQuestAnswer QA) { UpdateSWfsQuestAnswerOperateUserId(QA.QuestAnswerId, PresentationHelper.GetPassport().UserName); return(DapperUtil.Update <SWfsQuestAnswer>(QA)); }
public ActionResult CreateQANew() { try { string QuestionParams = null; string msg = null; if (!string.IsNullOrEmpty(Request.Params["myQuestion"])) { QuestionParams = Request.Params["myQuestion"]; } string AnwserParams = null; if (!string.IsNullOrEmpty(Request.Params["yourAnwser"])) { AnwserParams = Request.Params["yourAnwser"]; } string SortParams = null; if (!string.IsNullOrEmpty(Request.Params["sort"])) { SortParams = Request.Params["sort"]; } string StartTimeParams = null; if (!string.IsNullOrEmpty(Request.Params["StartTime"])) { StartTimeParams = Request.Params["StartTime"]; } string EndTimeParams = null; if (!string.IsNullOrEmpty(Request.Params["EndTime"])) { EndTimeParams = Request.Params["EndTime"]; } string IsShowParams = null; if (!string.IsNullOrEmpty(Request.Params["IsShow"])) { IsShowParams = Request.Params["IsShow"]; } SWfsQuestAnswer QuestAnswer = new SWfsQuestAnswer(); QuestAnswer.Quest = QuestionParams; QuestAnswer.Answer = AnwserParams; QuestAnswer.Sort = Convert.ToInt32(SortParams); QuestAnswer.DateQuest = string.IsNullOrEmpty(StartTimeParams) ? DateTime.Now : DateTime.Parse(StartTimeParams); QuestAnswer.DateAnswer = string.IsNullOrEmpty(StartTimeParams) ? DateTime.Now : DateTime.Parse(EndTimeParams); QuestAnswer.IsShow = Convert.ToInt16(IsShowParams); if ((!string.IsNullOrEmpty(Request["isEdit"])) && Request["isEdit"] == "1") { QuestAnswer.QuestAnswerId = Convert.ToInt32(Request.Params["questAnswerId"]); if (productCommentService.UpdateSWfsQuestAnswer(QuestAnswer)) { msg = "修改成功"; } else { msg = "修改失败"; } } else { if (productCommentService.InsertSWfsQuestAnswer(QuestAnswer) == 0) { msg = "添加成功"; } else { msg = "添加失败"; } } return(Json(new { result = "1", message = msg })); } catch (Exception ex) { return(Json(new { result = "0", message = ex.Message })); } }