/// <summary>
        /// 添加反馈意见
        /// </summary>
        /// <param name="feedback">意见反馈实体</param>
        public void AddFeedBack(FeedBack feedback)
        {
            try
            {
                string sql = "INSERT INTO usta_FeedBack(feedBackTitle,feedBackContent,feedBackContactTo,[backUserNo],[backUserType],type,resolver) VALUES(@feedBackTitle,@feedBackContent ,@feedBackContactTo,@backUser,@backUserType,@type,@resolver)";

                SqlParameter[] parameters = {
                    new SqlParameter("@feedBackTitle", SqlDbType.NChar,50),
                    new SqlParameter("@feedBackContent", SqlDbType.NVarChar,500),
                    new SqlParameter("@feedBackContactTo", SqlDbType.NChar,50),
                    new SqlParameter("@backUser", SqlDbType.NVarChar,50),
                    new SqlParameter("@backUserType", SqlDbType.Int),
                    new SqlParameter("@type", SqlDbType.Int),
                    new SqlParameter("@resolver", SqlDbType.NVarChar,50)};
                parameters[0].Value = feedback.feedBackTitle;
                parameters[1].Value = feedback.feedBackContent;
                parameters[2].Value = feedback.feedBackContactTo;
                parameters[3].Value = feedback.backUserNo;
                parameters[4].Value = feedback.backUserType;
                parameters[5].Value = feedback.type;
                parameters[6].Value = feedback.resolver;

                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, parameters);
            }
            catch (Exception ex)
            {
               MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int tryParseInt = 0;

            if (CommonUtility.SafeCheckByParams<string>(Request["feedBackId"], ref tryParseInt))
            {
                int feedbackId = tryParseInt;//取得URL参数
                DalOperationFeedBack dofb = new DalOperationFeedBack();
                feedback = dofb.FindFeedBackById(feedbackId); //绑定到对象实例
                if (feedback != null)
                {
                    dofb.UpdateFeedBackIsReadById(feedbackId); //更新阅读的状态为已读
                    if (!IsPostBack)
                    {
                        txtbackinfo.Text = feedback.backInfo;
                    }
                }
            }
        }
 /// <summary>
 /// 查询反馈意见
 /// </summary>
 /// <param name="feedBackId">反馈意见编号</param>
 /// <returns>意见反馈实体</returns>
 public FeedBack FindFeedBackById(int feedBackId)
 {
     FeedBack feedback = null;
     string sql = "SELECT [feedBackId] ,[feedBackTitle],[feedBackContent] ,[feedBackContactTo],[isRead],[updateTime],[backInfo],[backTime],[backUserNo],[backUserType],type  FROM [USTA].[dbo].[usta_FeedBack] WHERE feedBackId=@feedBackId";//按照时间降序排列
     SqlParameter[] parameters = {
          new SqlParameter("@feedBackId", SqlDbType.Int,4)
     };
     parameters[0].Value = feedBackId;
     SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql,parameters);
        while(dr.Read())
        {
        feedback = new FeedBack();
        feedback.feedBackId = int.Parse(dr["feedBackId"].ToString());
        feedback.feedBackTitle = dr["feedBackTitle"].ToString().Trim();
        feedback.feedBackContent = dr["feedBackContent"].ToString().Trim();
        feedback.feedBackContactTo = dr["feedBackContactTo"].ToString().Trim();
        feedback.isRead = bool.Parse(dr["isRead"].ToString());
        feedback.updateTime = DateTime.Parse(dr["updateTime"].ToString());
        feedback.backInfo = dr["backInfo"].ToString().Trim();
        if (dr["backTime"].ToString().Trim() != "") feedback.backTime = DateTime.Parse(dr["backTime"].ToString());
        feedback.backUserNo = dr["backUserNo"].ToString();
        feedback.backUserType = int.Parse(dr["backUserType"].ToString());
        feedback.type = int.Parse(dr["type"].ToString());
        }
        dr.Close();
        conn.Close();
        return feedback;
 }