Beispiel #1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sysConfig"></param>
 /// <returns></returns>
 public String Update(SysConfig sysConfig)
 {
     try
     {
         sysConfig.UpdateBy   = CurrentUser.Id;
         sysConfig.UpdateTime = DateTime.Now;
         int result = new BLSysConfig().Update(sysConfig);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "修改成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "修改失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "修改失败,失败原因:" + ex.Message
         }));
     }
 }
Beispiel #2
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="sysConfig"></param>
 /// <returns></returns>
 public String Add(SysConfig sysConfig)
 {
     try
     {
         sysConfig.Id         = Guid.NewGuid().ToString();
         sysConfig.CreateBy   = CurrentUser.Id;
         sysConfig.CreateTime = DateTime.Now;
         int result = new BLSysConfig().Add(sysConfig);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "新增成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "新增失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "新增失败,失败原因:" + ex.Message
         }));
     }
 }
Beispiel #3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        public String SelectByPage(int limit, int start)
        {
            int total;
            List <SysConfig> sysConfigs = new BLSysConfig().Select(limit, start, null, out total, "");

            return(JsonConvert.JavaScriptSerializer(new ExtGridRecord(sysConfigs, total)));
        }
Beispiel #4
0
        public ActionResult Index()
        {
            //检查Cookie是不为空就自动登录
            var cookie = Request.Cookies["LifeLogin"];

            if (cookie != null)
            {
                var data = cookie.Value.Replace("%2C", ",").Split(',');
                if (data.Length == 2)
                {
                    var loginUserName = data[0];
                    var loginPassword = MD5Encry.Encry(data[1]);
                    //直接登录
                    Users user = new BLUsers().Login(loginUserName, loginPassword);
                    if (user != null)
                    {
                        Session["user"] = user;
                        return(Redirect("/Default/Index"));
                    }
                }
            }

            List <SysConfig> list = new BLSysConfig().Select(new HashTableExp("SysKey", "SysVersion"));

            ViewData["version"]  = list[0].SysValue;
            ViewData["dataBase"] = ConfigurationManager.AppSettings["DAL"];
            return(View());
        }
Beispiel #5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids">Id的集合,如1,2,3</param>
        /// <returns></returns>
        public String Delete(String ids)
        {
            int num = new BLSysConfig().Delete(ids);

            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = true, msg = "成功删除" + num + "条数据"
            }));
        }