internal ListCustomField(_CustomField data, Project project) : base(data, project) { Items = data.items.Select(x => new ListCustomFieldItem(x)).ToArray(); IsDirectInputAllowed = data.allowInput ?? false; IsAdditionAllowed = data.allowAddItem.Value; }
internal CustomField(_CustomField data, Project project) : base(data.id) { Project = project; Type = (CustomFieldType)data.typeId; Name = data.name; Description = data.description; IsRequired = data.required; ApplicableTicketTypeIds = data.applicableIssueTypes.ToArray(); }
internal DateCustomField(_CustomField data, Project project) : base(data, project) { if (data.min != default) { Min = DateTime.Parse(data.min); } if (data.max != default) { Max = DateTime.Parse(data.max); } InitialValueType = (DateCustomFieldInitialValueType)data.initialDate.id; InitialDate = data.initialDate.date; InitialShift = data.initialDate.shift; }
internal NumericCustomField(_CustomField data, Project project) : base(data, project) { if (data.min != null) { Min = double.Parse(data.min); } if (data.max != null) { Max = double.Parse(data.max); } InitialValue = data.initialValue; if (data.unit != null) { Unit = double.Parse(data.unit); } }
internal static CustomField Create(_CustomField data, Project project) { switch ((CustomFieldType)data.typeId) { case CustomFieldType.String: case CustomFieldType.TextArea: return(new TextCustomField(data, project)); case CustomFieldType.Numeric: return(new NumericCustomField(data, project)); case CustomFieldType.Date: return(new DateCustomField(data, project)); case CustomFieldType.SingleList: case CustomFieldType.MultipleList: case CustomFieldType.CheckBox: case CustomFieldType.Radio: return(new ListCustomField(data, project)); default: throw new ArgumentException($"invalid data.typeId: {data.typeId}"); } }
internal TextCustomField(_CustomField data, Project project) : base(data, project) { }