示例#1
0
 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));
 }
示例#2
0
        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);
            }
        }
示例#3
0
 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);
 }