public JsonResult GetData_Data() { var nguoidung = (Planner2.Models.User)Session[Planner2.Controllers.LoginAuth.NameSession]; using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { string sql = @" SELECT T1.[ID] ,[TaskID] ,[NOIDUNG] ,[HoTen] ,[DienThoai] ,[DiaChi] ,[TieuDe] ,[MucDich] ,[DateCreate] ,[Email],t2.TaskName,t2.CreatedBy,t2.SeoUrl FROM [CommentTask] as t1 inner join MainTask as t2 on t1.TaskID=t2.Id where t2.CreatedBy='' or 1 = " + nguoidung.SupperAdmin + @" order by t1.DateCreate desc "; var data = rrc_db.Database.SqlQuery <DsComment>(sql).ToList(); JsonResult jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = 2147483647; return(jsonResult); } }
public JsonResult GetData_Data() { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { List <Category> data = rrc_db.Categories.ToList(); JsonResult jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = 2147483647; return(jsonResult); } }
public JsonResult GetData_Data() { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { List <Models.SettingData> data = rrc_db.SettingDatas.Where(z => z.Type == "BANNER" || z.Type == "LOGO").ToList(); JsonResult jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = 2147483647; return(jsonResult); } }
public JsonResult GetUserName() { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { var data = rrc_db.Users.ToList(); JsonResult jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = 2147483647; return(jsonResult); } }
public JsonResult GetData_Data() { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { var nguoidung = (Planner2.Models.User)Session[Planner2.Controllers.LoginAuth.NameSession]; var data = rrc_db.User_Category.Where(v => (v.UserName + "").ToUpper() == nguoidung.UserName.ToUpper()).ToList(); JsonResult jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = 2147483647; return(jsonResult); } }
public JsonResult XoaAnh(string ID) { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { var data = rrc_db.SettingDatas.Where(v => v.KeyID == ID).FirstOrDefault(); data.Value = ""; rrc_db.SaveChanges(); MvcApplication.ReloadSetting(); return(Json("", JsonRequestBehavior.AllowGet)); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ReloadSetting(); using (Models.Planner2Entities db = new Models.Planner2Entities()) { Application["Users"] = db.Users.Where(z => z.Email != null).ToList(); Common.SettingData.HeaderHTML = db.CustomPages.Where(v => v.NamePage == "HEADER").Select(z => z.ContentPage).FirstOrDefault(); } }
public ActionResult UploadFILEBanner(string BannerID, HttpPostedFileBase File_Banner = null) { using (Planner2Entities rrc_db = new Planner2.Models.Planner2Entities()) { var file = SubmitFile(new List <HttpPostedFileBase> { File_Banner }); var data = rrc_db.SettingDatas.Where(v => v.KeyID == BannerID).FirstOrDefault(); data.Value = file.FirstOrDefault(); rrc_db.SaveChanges(); MvcApplication.ReloadSetting(); return(RedirectToAction("index")); } }
public static void ReloadSetting() { using (Models.Planner2Entities db = new Models.Planner2Entities()) { Common.SettingData obj = new Common.SettingData(); foreach (var item in db.SettingDatas) { PropertyInfo propertyInfo = obj.GetType().GetProperty(item.KeyID, BindingFlags.Public | BindingFlags.Static); if (propertyInfo != null) { propertyInfo.SetValue(obj, item.Value, null); } var x = obj.GetType(); } } }