public ActionResult Configure(string conf_css, string conf_side_html, string conf_first_html, string conf_tail_html, string conf_js) { var IsShowCSS = Request.Form["IsShowCSS"] == "on"; var IsDisCSS = Request.Form["IsDisCSS"] == "on"; if (BLLSession.UserInfoSessioin == null) { return(Json("您还没有登录 不能修改~")); } ; try { //============================================================================================================== //遗留问题: //如下:如果 userinfobll.Up(BLLSession.UserInfoSessioin.UserInfo)两次的话 报异常:[一个实体对象不能由多个 IEntityChangeTracker 实例引用] //那么 我只能 new一个新的对象 修改 然后 同时 BLLSession.UserInfoSessioin.UserInfo里面的属性,不然 其他地方访问的话 是没有修改过来的值 //============================================================================================================== var userinftemp = new ModelDB.UserInfo(); //BLLSession.UserInfoSessioin.UserInfo; BLL.UserInfoBLL userinfobll = new UserInfoBLL(); if (Request.Form["TerminalType"] == "PC") //如果是PC端 { userinftemp.IsShowCSS = BLLSession.UserInfoSessioin.UserInfo.IsShowCSS = IsShowCSS; userinftemp.IsDisCSS = BLLSession.UserInfoSessioin.UserInfo.IsDisCSS = IsDisCSS; userinftemp.Id = BLLSession.UserInfoSessioin.UserInfo.Id; userinfobll.Up(userinftemp, "IsShowCSS", "IsDisCSS");//"IsShowHTML",, "IsShowJS" } else { userinftemp.IsShowMCSS = BLLSession.UserInfoSessioin.UserInfo.IsShowMCSS = IsShowCSS; userinftemp.IsDisMCSS = BLLSession.UserInfoSessioin.UserInfo.IsDisMCSS = IsDisCSS; userinftemp.Id = BLLSession.UserInfoSessioin.UserInfo.Id; userinfobll.Up(userinftemp, "IsShowMCSS", "IsDisMCSS"); } CacheData.GetAllUserInfo().FirstOrDefault(t => t.Id == BLLSession.UserInfoSessioin.Id).UserInfo = BLLSession.UserInfoSessioin.UserInfo; userinfobll.save(); string path = FileHelper.defaultpath + "/MyConfigure/" + BLLSession.UserInfoSessioin.UserName + "/"; FileHelper.CreatePath(path); if (conf_css.Length >= 40000 || conf_tail_html.Length >= 40000 || conf_first_html.Length >= 40000 || conf_side_html.Length >= 40000 || conf_js.Length >= 40000) { return(Json("您修改的内容字符过多~")); } if (Request.Form["TerminalType"] == "PC")//如果是PC端 { FileHelper.SaveFile(path, "conf.css", conf_css); FileHelper.SaveFile(path, "conf_side.txt", conf_side_html); FileHelper.SaveFile(path, "conf_first.txt", conf_first_html); FileHelper.SaveFile(path, "conf_tail.txt", conf_tail_html); FileHelper.SaveFile(path, "conf.js", conf_js); } else { FileHelper.SaveFile(path, "Mconf.css", conf_css); FileHelper.SaveFile(path, "Mconf_side.txt", conf_side_html); FileHelper.SaveFile(path, "Mconf_first.txt", conf_first_html); FileHelper.SaveFile(path, "Mconf_tail.txt", conf_tail_html); FileHelper.SaveFile(path, "Mconf.js", conf_js); } return(Json("修改成功~")); } catch (Exception) { return(Json("修改失败~"));; } }
public ActionResult Configure(string conf_css, string conf_side_html, string conf_first_html, string conf_tail_html, string conf_js) { var IsShowCSS = Request.Form["IsShowCSS"] == "on"; var IsDisCSS = Request.Form["IsDisCSS"] == "on"; if (BLLSession.UserInfoSessioin == null) return Json("您还没有登录 不能修改~"); ; try { //============================================================================================================== //遗留问题: //如下:如果 userinfobll.Up(BLLSession.UserInfoSessioin.UserInfo)两次的话 报异常:[一个实体对象不能由多个 IEntityChangeTracker 实例引用] //那么 我只能 new一个新的对象 修改 然后 同时 BLLSession.UserInfoSessioin.UserInfo里面的属性,不然 其他地方访问的话 是没有修改过来的值 //============================================================================================================== var userinftemp = new ModelDB.UserInfo(); //BLLSession.UserInfoSessioin.UserInfo; BLL.UserInfoBLL userinfobll = new UserInfoBLL(); if (Request.Form["TerminalType"] == "PC")//如果是PC端 { userinftemp.IsShowCSS = BLLSession.UserInfoSessioin.UserInfo.IsShowCSS = IsShowCSS; userinftemp.IsDisCSS = BLLSession.UserInfoSessioin.UserInfo.IsDisCSS = IsDisCSS; userinftemp.Id = BLLSession.UserInfoSessioin.UserInfo.Id; userinfobll.Up(userinftemp, "IsShowCSS", "IsDisCSS");//"IsShowHTML",, "IsShowJS" } else { userinftemp.IsShowMCSS = BLLSession.UserInfoSessioin.UserInfo.IsShowMCSS = IsShowCSS; userinftemp.IsDisMCSS = BLLSession.UserInfoSessioin.UserInfo.IsDisMCSS = IsDisCSS; userinftemp.Id = BLLSession.UserInfoSessioin.UserInfo.Id; userinfobll.Up(userinftemp, "IsShowMCSS", "IsDisMCSS"); } CacheData.GetAllUserInfo().FirstOrDefault(t => t.Id == BLLSession.UserInfoSessioin.Id).UserInfo = BLLSession.UserInfoSessioin.UserInfo; userinfobll.save(); string path = FileHelper.defaultpath + "/MyConfigure/" + BLLSession.UserInfoSessioin.UserName + "/"; FileHelper.CreatePath(path); if (conf_css.Length >= 40000 || conf_tail_html.Length >= 40000 || conf_first_html.Length >= 40000 || conf_side_html.Length >= 40000 || conf_js.Length >= 40000) { return Json("您修改的内容字符过多~"); } if (Request.Form["TerminalType"] == "PC")//如果是PC端 { FileHelper.SaveFile(path, "conf.css", conf_css); FileHelper.SaveFile(path, "conf_side.txt", conf_side_html); FileHelper.SaveFile(path, "conf_first.txt", conf_first_html); FileHelper.SaveFile(path, "conf_tail.txt", conf_tail_html); FileHelper.SaveFile(path, "conf.js", conf_js); } else { FileHelper.SaveFile(path, "Mconf.css", conf_css); FileHelper.SaveFile(path, "Mconf_side.txt", conf_side_html); FileHelper.SaveFile(path, "Mconf_first.txt", conf_first_html); FileHelper.SaveFile(path, "Mconf_tail.txt", conf_tail_html); FileHelper.SaveFile(path, "Mconf.js", conf_js); } return Json("修改成功~"); } catch (Exception) { return Json("修改失败~"); ; } }