private VmDescription CreateVmDescription(DescriptionTypeEnum descriptionType) { return(new VmDescription() { Description = "desc", TypeId = Guid.NewGuid()//descriptionType }); }
public static VmDescription CreateVmDescriptionModel(DescriptionTypeEnum descriptionType) { return(new VmDescription() { Description = "channelDescription", TypeId = Guid.NewGuid()//descriptionType }); }
public string GetDescription(DescriptionTypeEnum type) { string description = string.Empty; try { if (!m_parsed) { ExpressionParser parser = new ExpressionParser(m_expression, m_options); m_expressionParts = parser.Parse(); m_parsed = true; } switch (type) { case DescriptionTypeEnum.FULL: description = GetFullDescription(); break; case DescriptionTypeEnum.TIMEOFDAY: description = GetTimeOfDayDescription(); break; case DescriptionTypeEnum.HOURS: description = GetHoursDescription(); break; case DescriptionTypeEnum.MINUTES: description = GetMinutesDescription(); break; case DescriptionTypeEnum.SECONDS: description = GetSecondsDescription(); break; case DescriptionTypeEnum.DAYOFMONTH: description = GetDayOfMonthDescription(); break; case DescriptionTypeEnum.MONTH: description = GetMonthDescription(); break; case DescriptionTypeEnum.DAYOFWEEK: description = GetDayOfWeekDescription(); break; default: description = GetSecondsDescription(); break; } } catch (Exception ex) { if (!m_options.ThrowExceptionOnParseError) { description = ex.Message; } else { throw; } } return description; }
/// <summary> /// Generates a human readable string for the Cron Expression /// </summary> /// <param name="type">Which part(s) of the expression to describe</param> /// <returns>The cron expression description</returns> public string GetDescription(DescriptionTypeEnum type) { string description; try { if (!_parsed) { var parser = new ExpressionParser(_expression, _options); _expressionParts = parser.Parse(); _parsed = true; } switch (type) { case DescriptionTypeEnum.Full: description = GetFullDescription(); break; case DescriptionTypeEnum.Timeofday: description = GetTimeOfDayDescription(); break; case DescriptionTypeEnum.Hours: description = GetHoursDescription(); break; case DescriptionTypeEnum.Minutes: description = GetMinutesDescription(); break; case DescriptionTypeEnum.Seconds: description = GetSecondsDescription(); break; case DescriptionTypeEnum.DayOfmonth: description = GetDayOfMonthDescription(); break; case DescriptionTypeEnum.Month: description = GetMonthDescription(); break; case DescriptionTypeEnum.DayOfweek: description = GetDayOfWeekDescription(); break; case DescriptionTypeEnum.Year: description = GetYearDescription(); break; default: description = GetSecondsDescription(); break; } } catch (Exception exception) { if (!_options.ThrowExceptionOnParseError) description = exception.Message; else throw; } return description; }
public void TranslateOrganizationDescriptionToEntity(DescriptionTypeEnum descriptionType) { var vmDescription = TestHelper.CreateVmDescriptionModel(descriptionType); var toTranslate = new List <VmDescription>() { vmDescription }; var translations = RunTranslationModelToEntityTest <VmDescription, OrganizationDescription>(translators, toTranslate, unitOfWorkMock); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); Assert.Equal(vmDescription.Description, translation.Description); Assert.Equal(vmDescription.TypeId, translation.TypeId); }
public void TranslateServiceDescriptionToEntity(DescriptionTypeEnum descriptionType) { var vmDescription = CreateVmDescription(descriptionType); var toTranslate = new List <VmDescription>() { vmDescription }; RegisterDbSet(CreateCodeData <DescriptionType>(typeof(DescriptionTypeEnum)), unitOfWorkMockSetup); RegisterDbSet(CreateCodeData <Language>(typeof(LanguageCode)), unitOfWorkMockSetup); var translations = RunTranslationModelToEntityTest <VmDescription, ServiceDescription>(new List <ITranslator> { serviceDescriptionTranslator, descriptionTypeCodeTranslator, languageCodeTranslator }, toTranslate, unitOfWorkMock); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); Assert.Equal(vmDescription.Description, translation.Description); Assert.Equal(vmDescription.TypeId, translation.TypeId); }
public DescriptionAttribute(string text, DescriptionTypeEnum descriptionType = DescriptionTypeEnum.NONE, int order = 0) { Text = text; this.order = order; switch (descriptionType) { case DescriptionTypeEnum.ERROR: messageType = MessageType.Error; break; case DescriptionTypeEnum.INFO: messageType = MessageType.Info; break; case DescriptionTypeEnum.NONE: messageType = MessageType.None; break; case DescriptionTypeEnum.WARNING: messageType = MessageType.Warning; break; default: break; } }
private ICollection <ServiceDescription> GetDescription(ServiceVersioned serviceVersioned, DescriptionTypeEnum type) { return(serviceVersioned.ServiceDescriptions.Where(x => x.TypeId == typesCache.Get <DescriptionType>(type.ToString())).ToList()); }
private IEnumerable <IDescription> GetDescription(StatutoryServiceGeneralDescriptionVersioned generalDescriptionVersioned, DescriptionTypeEnum type) { return(generalDescriptionVersioned.Descriptions.Where(x => typesCache.Compare <DescriptionType>(x.TypeId, type.ToString()))); }
private VmDescription CreateDescription(string language, string value, VmGeneralDescriptionBase vModel, DescriptionTypeEnum typeEnum, bool isEmpty = false) { return(new VmDescription { Description = isEmpty ? null : value, TypeId = typesCache.Get <DescriptionType>(typeEnum.ToString()), OwnerReferenceId = vModel.Id, LocalizationId = languageCache.Get(language) }); }
private IEnumerable <IDescription> GetDescription(OrganizationVersioned organizationVersioned, DescriptionTypeEnum type) { return(organizationVersioned.OrganizationDescriptions.Where(x => x.TypeId == typesCache.Get <DescriptionType>(type.ToString()))); }
public DescriptionType(uint value) { this.EnumValue = this.GetType(value); }
public DescriptionType(DescriptionTypeEnum value) { this.EnumValue = value; }
private ICollection <StatutoryServiceDescription> GetDescription(StatutoryServiceGeneralDescriptionVersioned gdVersioned, DescriptionTypeEnum type) { return(gdVersioned.Descriptions.Where(x => x.TypeId == typesCache.Get <DescriptionType>(type.ToString())).ToList()); }
private IEnumerable <IDescription> GetDescription(GeneralDescriptionServiceChannel generalDescriptionServiceChannel, DescriptionTypeEnum type) { return(generalDescriptionServiceChannel.GeneralDescriptionServiceChannelDescriptions.Where(x => typesCache.Compare <DescriptionType>(x.TypeId, type.ToString()))); }
private VmDescription CreateDescription(string language, string value, VmServiceChannel vModel, DescriptionTypeEnum typeEnum) { return(new VmDescription { Description = value, TypeId = typesCache.Get <DescriptionType>(typeEnum.ToString()), OwnerReferenceId = vModel.Id, LocalizationId = languageCache.Get(language) }); }
private VmDescription CreateDescription(string language, string value, VmConnectionInput vModel, DescriptionTypeEnum typeEnum, bool isEmpty = false) { return(new VmDescription { Description = isEmpty ? null : value, TypeId = typesCache.Get <DescriptionType>(typeEnum.ToString()), OwnerReferenceId = vModel.MainEntityId, OwnerReferenceId2 = vModel.ConnectedEntityId, LocalizationId = languageCache.Get(language) }); }
private IEnumerable <IDescription> GetDescription(ServiceChannelVersioned serviceChannelVersioned, DescriptionTypeEnum type) { return(serviceChannelVersioned.ServiceChannelDescriptions.Where(x => typesCache.Compare <DescriptionType>(x.TypeId, type.ToString()))); }
public DescriptionType(string value) { this.EnumValue = this.GetType(value); }
/// <summary> /// Generates a human readable string for the Cron Expression /// </summary> /// <param name="type">Which part(s) of the expression to describe</param> /// <returns>The cron expression description</returns> public string GetDescription(DescriptionTypeEnum type) { string description = string.Empty; try { if (!m_parsed) { ExpressionParser parser = new ExpressionParser(m_expression, m_options); m_expressionParts = parser.Parse(); m_parsed = true; } switch (type) { case DescriptionTypeEnum.FULL: description = GetFullDescription(); break; case DescriptionTypeEnum.TIMEOFDAY: description = GetTimeOfDayDescription(); break; case DescriptionTypeEnum.HOURS: description = GetHoursDescription(); break; case DescriptionTypeEnum.MINUTES: description = GetMinutesDescription(); break; case DescriptionTypeEnum.SECONDS: description = GetSecondsDescription(); break; case DescriptionTypeEnum.DAYOFMONTH: description = GetDayOfMonthDescription(); break; case DescriptionTypeEnum.MONTH: description = GetMonthDescription(); break; case DescriptionTypeEnum.DAYOFWEEK: description = GetDayOfWeekDescription(); break; case DescriptionTypeEnum.YEAR: description = GetYearDescription(); break; default: description = GetSecondsDescription(); break; } } catch (Exception ex) { if (!m_options.ThrowExceptionOnParseError) { description = ex.Message; } else { throw; } } // Uppercase the first letter description = string.Concat(m_culture.TextInfo.ToUpper(description[0]), description.Substring(1)); return(description); }
private IEnumerable <VmDescription> GetDescription(IEnumerable <JsonLanguageLabel> descriptions, DescriptionTypeEnum type, StatutoryServiceGeneralDescriptionVersioned generalDescription) { var typeId = typesCache.Get <DescriptionType>(type.ToString()); return(descriptions?.Select( x => new VmDescription { Description = x.Label, TypeId = typeId, OwnerReferenceId = generalDescription.Id, LocalizationId = languageCache.Get(x.Lang) }) ?? new List <VmDescription>()); }