Ejemplo n.º 1
0
        public override void SetValueAfterCreate(string value, ApplicantResponse applicant, ApiHttpClient apiClient)
        {
            if (IsCustomFieldAvailable(apiClient) && IsCustomFieldValueValid(value, apiClient))
            {
                var customField = GetCustomField(apiClient);
                var parameter   = new CustomFieldValueParameter
                {
                    CustomField = customField.Name
                };

                switch (customField.Type)
                {
                case CustomFieldResponse.CustomFieldType.TextMultiLine:
                case CustomFieldResponse.CustomFieldType.TextSingleLine:
                case CustomFieldResponse.CustomFieldType.DropdownList:
                    parameter.Value = value;
                    break;

                case CustomFieldResponse.CustomFieldType.CheckBox:
                    parameter.Value = value.Is("X").ToString().ToLower();
                    break;

                case CustomFieldResponse.CustomFieldType.CheckboxList:
                    parameter.Values = (value ?? "").Split(',').Select(x => x.Trim()).Where(x => x.HasValue());
                    break;

                case CustomFieldResponse.CustomFieldType.Date:
                    var date = ParseDate(value);
                    parameter.Value = date.HasValue ? date.Value.ToString(CultureInfo.InvariantCulture) : null;
                    break;
                }

                new ApplicantCustomFieldPostRequest(applicant.Id, parameter).LoadResult(apiClient);
            }
        }
        public override void SetValueAfterCreate(string value, ApplicantResponse applicant, ApiHttpClient apiClient)
        {
            if (IsCustomFieldAvailable(apiClient) && IsCustomFieldValueValid(value, apiClient))
            {
                var customField = GetCustomField(apiClient);
                var parameter = new CustomFieldValueParameter
                {
                    CustomField = customField.Name
                };

                switch (customField.Type)
                {
                    case CustomFieldResponse.CustomFieldType.TextMultiLine:
                    case CustomFieldResponse.CustomFieldType.TextSingleLine:
                    case CustomFieldResponse.CustomFieldType.DropdownList:
                        parameter.Value = value;
                        break;
                    case CustomFieldResponse.CustomFieldType.CheckBox:
                        parameter.Value = value.Is("X").ToString().ToLower();
                        break;
                    case CustomFieldResponse.CustomFieldType.CheckboxList:
                        parameter.Values = (value ?? "").Split(',').Select(x => x.Trim()).Where(x => x.HasValue());
                        break;
                    case CustomFieldResponse.CustomFieldType.Date:
                        var date = ParseDate(value);
                        parameter.Value = date.HasValue ? date.Value.ToString(CultureInfo.InvariantCulture) : null;
                        break;
                }

                new ApplicantCustomFieldPostRequest(applicant.Id, parameter).LoadResult(apiClient);
            }
        }
Ejemplo n.º 3
0
 public ApplicantCustomFieldPostRequest(int applicantId, CustomFieldValueParameter customField)
     : base("Api/Applicant/" + applicantId + "/CustomField", customField)
 {
 }