public Slide GetSlideWithSliders(short slideId) { try { Slide slide = new SlideBO().Get(ConnectionHandler, slideId); if (slide == null || !slide.Enabled) { return(null); } slide.SlideItems = new SlideItemBO().OrderBy(ConnectionHandler, x => x.Order, x => x.SlideId == slideId && x.Enabled && ((string.IsNullOrEmpty(x.StartDate) && string.IsNullOrEmpty(x.FinishDate)) || (x.StartDate.CompareTo(DateTime.Now.ShamsiDate()) <= 0 && x.FinishDate.CompareTo(DateTime.Now.ShamsiDate()) >= 0))); if (string.IsNullOrEmpty(slide.EffectType)) { slide.EffectType = Definition.Enums.SliderCycleFxType.blindX.ToString(); } return(slide); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public JsonResult GetSlideByID(int id) { if (_session.IsLogin) { if (id == -1) { string jsonData = ""; jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(new Photo()); jsonData += "}"; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } else { string jsonData = ""; SlideBO _cls = new SlideBO(); var data = _cls.GetByID(id); jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(data); jsonData += "}"; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } } else { RedirectToAction("index", "admin"); } return(Json("[]", JsonRequestBehavior.AllowGet)); }
public JsonResult SaveSlide(Slide slide) { SlideBO cls = new SlideBO(); bool IsResult = cls.Save(slide); return(Json(new { IsOk = IsResult }, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateSlide(int id) { ViewBag.ID = id; if (_session.IsLogin) { Slide model = new Slide(); ViewBag.Image = "~/Uploads/Default/default.png"; if (id != -1) { SlideBO cls = new SlideBO(); model = cls.GetByID(id); if (model == null) { model = new Slide(); } else { ViewBag.Image = model.Image; } return(View(model)); } else { return(View(model)); } } else { return(RedirectToAction("index", "admin")); } }
public JsonResult DeleteSlide(int id) { if (_session.IsLogin) { SlideBO _cls = new SlideBO(); var IsResult = _cls.Delete(id); return(Json(new { IsOk = IsResult }, JsonRequestBehavior.AllowGet)); } else { RedirectToAction("index", "admin"); } return(Json(new { IsOk = false }, JsonRequestBehavior.AllowGet)); }
public override bool Delete(params object[] keys) { try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); SlideBO slideBo = new SlideBO(); Slide obj = slideBo.Get(ConnectionHandler, keys); SlideItemBO slideItemFacade = new SlideItemBO(); List <SlideItem> list = new SlideItemBO().Where(ConnectionHandler, supporter => supporter.SlideId == obj.Id); foreach (SlideItem slideItem in list) { if ( !slideItemFacade.Delete(ConnectionHandler, FileManagerConnection, slideItem.Id)) { throw new Exception("خطایی در "); } } if (!slideBo.Delete(ConnectionHandler, keys)) { throw new Exception("خطایی در حذف اسلاید وجود دارد"); } ConnectionHandler.CommitTransaction(); FileManagerConnection.CommitTransaction(); return(true); } catch (KnownException ex) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public JsonResult GetSlide() { if (_session.IsLogin) { string jsonData = "[]"; SlideBO _cls = new SlideBO(); var data = _cls.GetAll(); if (data != null) { jsonData = new JavaScriptSerializer().Serialize(data); } return(Json(jsonData, JsonRequestBehavior.AllowGet)); } else { RedirectToAction("index", "admin"); } return(Json("[]", JsonRequestBehavior.AllowGet)); }
public JsonResult SaveSlide(Slide slide, SlideLang slideLang) { if (_session.IsLogin && _session.IsStore && _session.IsAdmin) { slide.SiteID = _session.SiteID; slideLang.LangID = _session.LangID; ISlide _cls = new SlideBO(); var IsResult = _cls.SaveSlide(slide, slideLang); return Json(new { IsOk = IsResult }, JsonRequestBehavior.AllowGet); } else RedirectToAction("index", "admin"); return Json("[]", JsonRequestBehavior.AllowGet); }
public JsonResult GetSlider() { string jsonData = "[]"; ISlide _cls = new SlideBO(); var data = _cls.GetSlide(_session.LangID, "SLIDE_TOP"); if (data != null) jsonData = new JavaScriptSerializer().Serialize(data); return Json(jsonData, JsonRequestBehavior.AllowGet); }
public JsonResult DeleteSlide(long id) { if (_session.IsLogin && _session.IsStore && _session.IsAdmin) { ISlide _cls = new SlideBO(); var IsResult = _cls.Delete(id); return Json(new { IsOk = IsResult}, JsonRequestBehavior.AllowGet); } else RedirectToAction("index", "admin"); return Json(new { IsOk = false}, JsonRequestBehavior.AllowGet); }
public ActionResult CreateSlide(long id) { if (_session.IsLogin && _session.IsStore && _session.IsAdmin) { ViewBag.ID = id; ViewBag.Image = "~/Uploads/Default/default.png"; vw_Slide model = new vw_Slide(); if (id != -1) { ISlide cls = new SlideBO(); model = cls.GetData(id); if (model == null) model = new vw_Slide(); else ViewBag.Image = model.Image; } return View(model); } else return RedirectToAction("index", "admin"); }
public JsonResult SaveSlide(Slide slide) { SlideBO cls = new SlideBO(); bool IsResult = cls.Save(slide); return Json(new { IsOk = IsResult }, JsonRequestBehavior.AllowGet); }
public JsonResult GetSlideByID(int id) { if (_session.IsLogin) { if (id == -1) { string jsonData = ""; jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(new Photo()); jsonData += "}"; return Json(jsonData, JsonRequestBehavior.AllowGet); } else { string jsonData = ""; SlideBO _cls = new SlideBO(); var data = _cls.GetByID(id); jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(data); jsonData += "}"; return Json(jsonData, JsonRequestBehavior.AllowGet); } } else RedirectToAction("index", "admin"); return Json("[]", JsonRequestBehavior.AllowGet); }
public JsonResult GetSlide() { if (_session.IsLogin) { string jsonData = "[]"; SlideBO _cls = new SlideBO(); var data = _cls.GetAll(); if (data != null) jsonData = new JavaScriptSerializer().Serialize(data); return Json(jsonData, JsonRequestBehavior.AllowGet); } else RedirectToAction("index", "admin"); return Json("[]", JsonRequestBehavior.AllowGet); }
public ActionResult CreateSlide(int id) { ViewBag.ID = id; if (_session.IsLogin) { Slide model = new Slide(); ViewBag.Image = "~/Uploads/Default/default.png"; if (id != -1) { SlideBO cls = new SlideBO(); model = cls.GetByID(id); if (model == null) model = new Slide(); else ViewBag.Image = model.Image; return View(model); } else return View(model); } else return RedirectToAction("index", "admin"); }