Exemple #1
0
 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;
 }
Exemple #2
0
 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();
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 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);
     }
 }
Exemple #5
0
        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}");
            }
        }
Exemple #6
0
 internal TextCustomField(_CustomField data, Project project)
     : base(data, project)
 {
 }