public AddWarrantCommand( string inmateId, WarrantType warrantType, DateTime effectiveDate, IIssuingAuthority issuingAuthority ) { }
/// <summary> /// Получаем из атрибута описание данного результата проверки /// </summary> /// <param name="element"></param> /// <returns></returns> public static string GetAttrName(this WarrantType element) { var type = typeof(WarrantType); var memInfo = type.GetMember(element.ToString()); var attributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); if (!attributes.Any()) { throw new Exception(String.Format("Элемент перечисления {0} не имеет атрибута DescriptionAttribute", element.ToString())); } return(((DescriptionAttribute)attributes[0]).Description); }
public AddWarrantCommand( string inmateId, WarrantType warrantType, DateTime issueAt, DateTime effectiveFrom, string issuerId, string scanLocationUrl, TimeSpan duration) { _inmateId = inmateId; _warrantType = warrantType; _issueAt = issueAt; _effectiveFrom = effectiveFrom; _issuerId = issuerId; _scanLocationUrl = scanLocationUrl; _duration = duration; }
public AddWarrantCommand( string inmateId, WarrantType warrantType, DateTime issueAt, DateTime effectiveFrom, string issuerId, string scanAttachmentId, TimeSpan duration) { _inmateId = inmateId; _warrantType = warrantType; _issueAt = issueAt; _effectiveFrom = effectiveFrom; _issuerId = issuerId; _scanAttachmentId = scanAttachmentId; _duration = duration; }
/// <summary> /// Получаем коллекцию всех возможных результатов проверки сборки /// </summary> /// <param name="element"></param> /// <returns></returns> public static IEnumerable <KeyValuePair <int, string> > GetAll(this WarrantType element) { var collection = (IEnumerable <WarrantType>)System.Enum.GetValues(typeof(WarrantType)); return(collection.Select(t => new KeyValuePair <int, string>((int)t, t.GetAttrName()))); }