public void FeedbackUpdate(TBL_FEEDBACK info)
        {
            try
            {
                HttpCookie cookie = Request.Cookies["userId"];
                if (cookie.Name != null)
                {
                    ViewBag.user = cookie.Value;
                }

                DateTime dt = DateTime.Now;
                info.feedbackTime = dt;
                if (InsertTools.InsertFeedbackInfo(info) == true)
                {
                    Response.Write("<script>alert('删除成功!');</script>");
                    Response.Redirect("/Feedback/Index");
                }
                else
                {
                    Response.Write("<script>alert('不存在删除内容!');</script>");
                    Response.Redirect("/Feedback/Index");
                }
            }
            catch
            {
                Response.Write("<script>alert('删除失败!');</script>");
                Response.Redirect("/Feedback/Index");
            }
        }
 /// <summary>
 /// 往问题反馈表中插入数据
 /// </summary>
 /// <param name="info">新上传的反馈信息</param>
 /// <returns></returns>
 public static Boolean InsertFeedbackInfo(TBL_FEEDBACK info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             db.TBL_FEEDBACK.Add(info);
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 查找问题反馈表中符合条件的信息
 /// </summary>
 /// <param name="whereLambda">u => u.userId == info.userId, u => u.userId</param>
 /// <returns>问题反馈数组</returns>
 public static TBL_FEEDBACK[] SelectFeedbackInfo <TKey>(Expression <Func <TBL_FEEDBACK, bool> > whereLambda, Expression <Func <TBL_FEEDBACK, TKey> > orderBy)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_FEEDBACK> dataObject = db.TBL_FEEDBACK.Where(whereLambda).OrderBy(orderBy) as DbQuery <TBL_FEEDBACK>;
             TBL_FEEDBACK[]         infoList   = dataObject.ToArray();
             return(infoList);
         }
     }
     catch
     {
         TBL_FEEDBACK[] nullInfo = new TBL_FEEDBACK[0];
         return(nullInfo);
     }
 }
 /// <summary>
 /// 修改TBL_FEEDBACK表的数据
 /// </summary>
 /// <param name="whereLambda"> (u=>u.userId == info.userId, info) == true </param>
 /// 判断有无userId
 /// <param name="info"> info是需要修改的信息 </param>
 /// <notice></notice>
 public static Boolean UpdateFeedbackInfo(Expression <Func <TBL_FEEDBACK, bool> > whereLambda, TBL_FEEDBACK info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_FEEDBACK> dataObject = db.TBL_FEEDBACK.Where(whereLambda) as DbQuery <TBL_FEEDBACK>;
             TBL_FEEDBACK           oldInfo    = dataObject.FirstOrDefault();
             oldInfo.userId       = info.userId;
             oldInfo.feedbackTime = info.feedbackTime;
             oldInfo.feedbackNote = info.feedbackNote;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }