コード例 #1
0
        private DataMapField CreateDataMapField(string key, string value)
        {
            DataMapField field = null;

            if (key != "cssClass")
            {
                return(null);
            }
            switch (value)
            {
            case "input_text":
                field = new InputDataMapField();
                break;

            case "checkbox":
                field = new CheckBoxDataMapField();
                break;

            case "select":
                field = new SelectDataMapField();
                break;

            case "radio":
                field = new RadioDataMapField();
                break;

            case "textarea":
                field = new TextAreaDataMapField();
                break;

            case "input_file":
                field = new FileInputDataMapField();
                break;

            default:
                break;
            }
            return(field);
        }
コード例 #2
0
        static private DataMapField GetDataMapField(JsonDataMapField o)
        {
            string       type = o.CssClass;
            DataMapField p    = null;

            if (type == "input_text")
            {
                p = new InputDataMapField();
            }
            else if (type == "checkbox")
            {
                p = new CheckBoxDataMapField();
                ((CheckBoxDataMapField)p).Options.AddRange(o.Options);
            }
            else if (type == "select")
            {
                p = new SelectDataMapField();
                ((SelectDataMapField)p).Options.AddRange(o.Options);
            }
            else if (type == "radio")
            {
                p = new RadioDataMapField();
                ((RadioDataMapField)p).Options.AddRange(o.Options);
            }
            else if (type == "textarea")
            {
                p = new TextAreaDataMapField();
            }
            else
            {
                p = new DataMapField();
            }
            p.CssClass    = o.CssClass;
            p.Value       = o.Value;
            p.Required    = o.Required;
            p.DisplayName = o.DisplayName;
            return(p);
        }