示例#1
0
        public ActionResult Delete(int[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var numArray = ids;
                    for (var i = 0; i < numArray.Length; i++)
                    {
                        var num       = numArray[i];
                        var slideShow = _slideShowService.Get(x => x.Id == num);

                        _slideShowService.Delete(slideShow);

                        //Delete localize
                        var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(num);

                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", ex.Message));
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    IEnumerable <StaticContent> staticContents =
                        from id in ids
                        select this._staticContentService.GetById(int.Parse(id));

                    this._staticContentService.BatchDelete(staticContents);

                    ////Check and delete logo exists
                    //string str1 = string.Format("{0}", item.FileName.NonAccent());
                    //if (System.IO.File.Exists(str))
                    //    System.IO.File.Delete(str);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    IEnumerable <GenericControl> GenericControls =
                        from id in ids
                        select this._genericControlService.GetById(int.Parse(id));

                    this._genericControlService.BatchDelete(GenericControls);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("ServerGenericControl.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
示例#4
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var menuLinks =
                        from id in ids
                        select _menuLinkService.GetMenu(int.Parse(id));

                    _menuLinkService.BatchDelete(menuLinks);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("MenuLink.Delete: ", ex.Message));
                ModelState.AddModelError("", ex.Message);
            }
            return(RedirectToAction("Index"));
        }
示例#5
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.IsAny())
                {
                    var idTest = from id in ids select id;
                    var aa     = idTest.FirstOrDefault();

                    var genericControls =
                        from id in ids
                        select _gCService.GetById(int.Parse(id));

                    _gCService.BatchDelete(genericControls);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var localizedProperties
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));

                        _localizedPropertyService.BatchDelete(localizedProperties);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("GenericControl --> Delete: ", ex.Message));
                ModelState.AddModelError("", ex.Message);
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var contactInformations =
                        from id in ids
                        select _contactInfoService.GetById(int.Parse(id));

                    _contactInfoService.BatchDelete(contactInformations);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                ExtentionUtils.Log(string.Concat("ContactInformation.Delete: ", exception.Message));
            }
            return(RedirectToAction("Index"));
        }
示例#7
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    IEnumerable <MenuLink> menuLinks =
                        from id in ids
                        select this._menuLinkService.GetById(int.Parse(id));

                    this._menuLinkService.BatchDelete(menuLinks);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                ExtentionUtils.Log(string.Concat("MenuLink.Delete: ", ex.Message));
                base.ModelState.AddModelError("", ex.Message);
            }
            return(base.RedirectToAction("Index"));
        }
示例#8
0
        public ActionResult Delete(int[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    int[] numArray = ids;
                    for (int i = 0; i < (int)numArray.Length; i++)
                    {
                        int       num       = numArray[i];
                        SlideShow slideShow = this._slideShowService.Get((SlideShow x) => x.Id == num, false);
                        this._slideShowService.Delete(slideShow);

                        //Delete localize
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(num);
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
示例#9
0
        public ActionResult Delete(int[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    IEnumerable <News> news =
                        from id in ids
                        select this._newsService.GetById(id);

                    this._newsService.BatchDelete(news);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(ids[i]);
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
示例#10
0
        public ActionResult Delete(int[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var news =
                        from id in ids
                        select _newsService.GetById(id);

                    _newsService.BatchDelete(news);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(ids[i]);

                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                LogText.Log(string.Concat("Post.Delete: ", exception.Message));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var staticContents =
                        from id in ids
                        select _staticContentService.GetById(int.Parse(id));

                    _staticContentService.BatchDelete(staticContents);

                    ////Check and delete logo exists
                    //string str1 = string.Format("{0}", item.FileName.NonAccent());
                    //if (System.IO.File.Exists(str))
                    //    System.IO.File.Delete(str);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(Concat("StaticContent.Delete: ", ex.Message));
            }

            return(RedirectToAction("Index"));
        }
示例#12
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.IsAny())
                {
                    var posts         = new List <Post>();
                    var galleryImages = new List <GalleryImage>();
                    var orderItems    = new List <OrderItem>();
                    IEnumerable <LocalizedProperty> localizedProperties = null;

                    for (var i = 0; i < ids.Length; i++)
                    {
                        var id   = int.Parse(ids[i]);
                        var post = _postService.Get(x => x.Id == id);

                        if (post.GalleryImages.IsAny())
                        {
                            galleryImages.AddRange(post.GalleryImages.ToList());
                        }

                        post.AttributeValues.ToList().ForEach(att => post.AttributeValues.Remove(att));
                        posts.Add(post);

                        var orderItem = _orderItemService.GetByPostId(id);
                        if (orderItem != null)
                        {
                            orderItems.Add(orderItem);
                        }

                        localizedProperties = _localizedPropertyService.GetByEntityId(id);
                    }

                    _galleryService.BatchDelete(galleryImages);
                    _orderItemService.BatchDelete(orderItems);
                    _localizedPropertyService.BatchDelete(localizedProperties);
                    _postService.BatchDelete(posts);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                LogText.Log(string.Concat("Post.Delete: ", ex.Message));
            }

            return(RedirectToAction("Index"));
        }
示例#13
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var posts         = new List <Post>();
                    var galleryImages = new List <GalleryImage>();
                    var strArrays     = ids;
                    for (var i = 0; i < strArrays.Length; i++)
                    {
                        var num  = int.Parse(strArrays[i]);
                        var post = _postService.Get(x => x.Id == num);
                        galleryImages.AddRange(post.GalleryImages.ToList());
                        post.AttributeValues.ToList().ForEach(att => post.AttributeValues.Remove(att));
                        posts.Add(post);
                    }

                    _galleryService.BatchDelete(galleryImages);
                    _postService.BatchDelete(posts);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));

                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                ExtentionUtils.Log(string.Concat("Post.Delete: ", ex.Message));
            }

            return(RedirectToAction("Index"));
        }
示例#14
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    List <Post>         posts         = new List <Post>();
                    List <GalleryImage> galleryImages = new List <GalleryImage>();
                    string[]            strArrays     = ids;
                    for (int i = 0; i < (int)strArrays.Length; i++)
                    {
                        int  num  = int.Parse(strArrays[i]);
                        Post post = this._postService.Get((Post x) => x.Id == num, false);
                        galleryImages.AddRange(post.GalleryImages.ToList <GalleryImage>());
                        post.AttributeValues.ToList <AttributeValue>().ForEach((AttributeValue att) => post.AttributeValues.Remove(att));
                        posts.Add(post);
                    }
                    this._galleryService.BatchDelete(galleryImages);
                    this._postService.BatchDelete(posts);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }