Exemple #1
0
        private void DeleteSort(int id)
        {
            List <RotationSort> sortList = GetRotationSorts();

            if (sortList.Count <= 0)
            {
                return;
            }

            try
            {
                RotationSort bannerSort = sortList.Find(g => g.RotationType == RotationType.Banner) ?? new RotationSort();
                RotationSort logoSort   = sortList.Find(g => g.RotationType == RotationType.Logo) ?? new RotationSort();

                if (bannerSort.SortList.Count > 0)
                {
                    bannerSort.SortList.RemoveAll(g => g.Equals(id));
                }
                if (logoSort.SortList.Count > 0)
                {
                    logoSort.SortList.RemoveAll(g => g.Equals(id));
                }

                UpdateRotationSort(new List <RotationSort>()
                {
                    bannerSort, logoSort
                });
            }
            catch
            {
            }
        }
Exemple #2
0
        private List <int> GetSortList(RotationType type)
        {
            List <RotationSort> sortList = GetRotationSorts();
            List <int>          sorts    = new List <int>();

            if (sortList != null)
            {
                RotationSort sortModel = sortList.Find(g => g.RotationType == type);

                if (sortModel != null)
                {
                    sorts = sortModel.SortList;
                }
            }

            return(sorts);
        }