Exemple #1
0
        private Durados.Web.Mvc.UI.Json.Field GetParentJsonField(ParentField parentField, string fk, DataAction dataAction, string guid)
        {
            bool   disabled = parentField.IsDisable(dataAction, guid);
            string value    = string.Empty;

            if (dataAction == DataAction.Create)
            {
                if (parentField.IncludeInDuplicate)
                {
                    value = fk;
                }
                else
                {
                    if (parentField.DefaultValue != null)
                    {
                        value = parentField.ConvertDefaultToString();
                    }
                }
            }
            else
            {
                value = fk;
            }
            Json.Field jsonField = new Json.Field()
            {
                Name = parentField.Name, Value = value, Type = parentField.GetHtmlControlType().ToString(), ValidationType = parentField.GetValidationType(), Format = parentField.Validation.Format, Required = parentField.Required, DependencyChildren = parentField.GetDependencyTriggeredFieldNames(), Searchable = parentField.IsSearchable(), Disabled = parentField.IsDisableForCreate(), DisDup = parentField.DisableInDuplicate, Refresh = parentField.Refresh, DependencyData = parentField.DependencyData
            };
            if (parentField.ParentHtmlControlType == ParentHtmlControlType.Autocomplete || disabled)
            {
                jsonField.Default = parentField.GetLocalizedDisplayValue(value);
            }

            return(jsonField);
        }