public string SettingUpdate(TBL_SYSSET set)
 {
     if (UpdateTools.UpdateSyssetInfo(u => u.syssetId == set.syssetId, set) == true)
     {
         Response.Redirect("/SettingManagement/Index");
         return "success";
     }
     else
     {
         Response.Redirect("/SettingManagement/Index");
         return "false";
     }
     
 }
        public ActionResult SettingSelect(TBL_SYSSET set)
        {
            TBL_SYSSET[] allInfo = SelectTools.SelectSyssetInfo(u => u.syssetId == u.syssetId, u => u.syssetId);
            TBL_SYSSET[] info = SelectTools.SelectSyssetInfo(u => u.syssetId == set.syssetId, u => u.syssetId);
            ViewBag.allInfo = allInfo;
            ViewBag.info = info;

            HttpCookie cookie = Request.Cookies["userId"];
            if (cookie.Name != null)
            {
                ViewBag.user = cookie.Value;
            }

            return View();
        }
 /// <summary>
 /// 往系统设置信息表中插入数据
 /// </summary>
 /// <param name="info">前端页面输入的信息</param>
 /// <returns></returns>
 public static Boolean InsertSyssetInfo(TBL_SYSSET info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             db.TBL_SYSSET.Add(info);
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 查找系统设置信息表中符合条件的信息
 /// </summary>
 /// <param name="whereLambda">u => u.syssetId == info.syssetId, u => u.syssetId</param>
 /// <returns>系统设置信息数组</returns>
 public static TBL_SYSSET[] SelectSyssetInfo <TKey>(Expression <Func <TBL_SYSSET, bool> > whereLambda, Expression <Func <TBL_SYSSET, TKey> > orderBy)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_SYSSET> dataObject = db.TBL_SYSSET.Where(whereLambda).OrderBy(orderBy) as DbQuery <TBL_SYSSET>;
             TBL_SYSSET[]         infoList   = dataObject.ToArray();
             return(infoList);
         }
     }
     catch
     {
         TBL_SYSSET[] nullInfo = new TBL_SYSSET[0];
         return(nullInfo);
     }
 }
 /// <summary>
 /// 修改TBL_SYSSET表的数据
 /// </summary>
 /// <param name="whereLambda"> (u=>u.syssetId == info.syssetId, info) == true </param>
 /// 判断有无syssetId
 /// <param name="info"> info是需要修改的信息 </param>
 /// <notice></notice>
 public static Boolean UpdateSyssetInfo(Expression <Func <TBL_SYSSET, bool> > whereLambda, TBL_SYSSET info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_SYSSET> dataObject = db.TBL_SYSSET.Where(whereLambda) as DbQuery <TBL_SYSSET>;
             TBL_SYSSET           oldInfo    = dataObject.FirstOrDefault();
             oldInfo.syssetName       = info.syssetName;
             oldInfo.syssetOpevalue   = info.syssetOpevalue;
             oldInfo.syssetClovalue   = info.syssetClovalue;
             oldInfo.syssetAlatime    = info.syssetAlatime;
             oldInfo.syssetAlacurrent = info.syssetAlacurrent;
             oldInfo.syssetNote       = info.syssetNote;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }