private void AddNewQuestion(out string msg) { Entities.KLRaiseQuestions entity = new Entities.KLRaiseQuestions(); entity.CreateUserId = BLL.Util.GetLoginUserID(); entity.CreateDate = DateTime.Now; entity.Title = QuestionTitle; entity.CONTENT = QuestionDetails; entity.KLCId = int.Parse(QuestionCid); //0:知识点,1:FAQ entity.KLRefId = int.Parse(KLID); entity.Type = int.Parse(QuestionType); entity.Status = 0; DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeAgent(entity.CreateUserId); if (dt != null && dt.Rows.Count > 0) { entity.BGID = int.Parse(dt.Rows[0]["BGID"].ToString()); } ; //entity.AnswerUser = -1; //entity.LastModifyDate = DateTime.Now; //entity.LastModifyBy = -1; ; msg = BLL.Personalization.Instance.InsertKLRaiseQuestion(entity) > 0 ? "success" : "提问失败!"; }
/// <summary> /// 增加一条问题数据 /// </summary> /// <param name="model"></param> /// <returns>返回值大于零表示执行成功</returns> public int InsertKLRaiseQuestion(Entities.KLRaiseQuestions model) { SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int), new SqlParameter("@CreateUserId", SqlDbType.Int, 4), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@CONTENT", SqlDbType.NVarChar, 4000), new SqlParameter("@KLCId", SqlDbType.Int, 4), new SqlParameter("@KLRefId", SqlDbType.Int, 4), new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@AnswerUser", SqlDbType.Int, 4), new SqlParameter("@BGID", SqlDbType.Int, 4), new SqlParameter("@LastModifyDate", SqlDbType.DateTime), new SqlParameter("@LastModifyBy", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.CreateUserId; parameters[2].Value = model.CreateDate; parameters[3].Value = model.Title; parameters[4].Value = model.CONTENT; parameters[5].Value = model.KLCId; parameters[6].Value = model.KLRefId; parameters[7].Value = model.Type; parameters[8].Value = model.Status; parameters[9].Value = model.AnswerUser; parameters[10].Value = model.BGID; parameters[11].Value = model.LastModifyDate; parameters[12].Value = model.LastModifyBy; SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_KLRaiseQuestions_Insert, parameters); return((int)parameters[0].Value); }
/// <summary> /// 修改一条问题数据,同时添加日志数据 /// </summary> /// <param name="model"></param> /// <returns>返回值 1:执行成功;0:执行失败</returns> public int UpdateKLRaiseQuestion(Entities.KLRaiseQuestions model) { return(Dal.Personalization.Instance.UpdateKLRaiseQuestion(model)); }