public NotificationTemplateEntityParams GetNotificationTemplate(NotificationType notificationType)
        {
            CultureInfo uiCultureInfo = Thread.CurrentThread.CurrentUICulture;
            CultureInfo cultureInfo   = Thread.CurrentThread.CurrentCulture;
            var         culture       = cultureInfo.ToString();

            var notificationTemplate = Entities
                                       .FirstOrDefault(x => x.NotificationType == notificationType && x.Status == Status.Active);

            var notificationTemplateCulture = CulturedEntities.FirstOrDefault(x => x.BaseEntityId == notificationTemplate.Id && x.Culture == culture);

            var notificationTemplateEntityParams = Map <NotificationTemplateEntityParams>(notificationTemplateCulture.Id, culture);

            return(notificationTemplateEntityParams);
        }
示例#2
0
        protected override void OnRemoving(CityParams entityParams)
        {
            var culturedEntity = CulturedEntities.FirstOrDefault(x => x.Id == entityParams.Id);
            var baseEntityId   = culturedEntity?.BaseEntityId;

            if (entityParams != null)
            {
                entityParams.PredefinedPage = PredefinedPage.City;
            }

            _customRouteService.Remove(entityParams);

            var relationalDistrictIds = _districtService.Entities.Where(x => x.CityId == baseEntityId)
                                        .Select(x => x.Id).ToList();

            foreach (var relationalDistrictId in relationalDistrictIds)
            {
                _districtService.Remove(relationalDistrictId);
            }
        }
示例#3
0
        public bool CreateIfNotExists(string genre, out int id)
        {
            var genreEntity = CulturedEntities.FirstOrDefault(x => x.Name == genre);

            id = genreEntity?.BaseEntityId ?? 0;
            if (id != 0)
            {
                return(false);
            }

            var genreParams = new GenreParams();

            genreParams.Name     = genre;
            genreParams.UserType = UserTypes.Dashboard;
            genreParams.Status   = Status.Active;

            genreParams = CreateOrUpdate(genreParams);
            id          = genreParams.BaseEntityId;

            return(true);
        }