Beispiel #1
0
        public HtmlString GetAddParameterLayout(Parameter parameter)
        {
            var type       = parameter.GetType();
            var FieldInfos = type.GetProperties();

            var div_tag = new TagBuilder("div");

            div_tag.InnerHtml += "<h4>Заполните пожалуйста основные характеристики параметра</h4>";

            var textbox_render = new TextBoxRenderer();

            foreach (PropertyInfo field_info in FieldInfos)
            {
                var dict = new Dictionary <string, object>();
                dict["Name"]  = field_info.Name;
                dict["Value"] = new object();

                if (field_info.Name != "MetaData" && field_info.Name != "Id")
                {
                    div_tag.InnerHtml += textbox_render.GetLayout(dict, name_prefix, field_info.Name);
                }
                else
                {
                    if (field_info.Name == "MetaData" && field_info.PropertyType == typeof(MetaData))
                    {
                        div_tag.InnerHtml += "<h4>Заполните пожалуйста мета-данные</h4>";

                        var metadata_type   = typeof(MetaData);
                        var fieldInfos2     = metadata_type.GetProperties();
                        var checkbox_render = new CheckBoxRenderer();
                        foreach (PropertyInfo fieldinfo2 in fieldInfos2)
                        {
                            if (fieldinfo2.PropertyType == typeof(bool))
                            {
                                var dict2 = new Dictionary <string, object>();
                                dict2["Name"]  = fieldinfo2.Name;
                                dict2["Value"] = new bool();

                                div_tag.InnerHtml += checkbox_render.GetLayout(dict2, name_prefix, fieldinfo2.Name);
                            }

                            if (fieldinfo2.PropertyType == typeof(object) || fieldinfo2.PropertyType == typeof(Nullable <int>))
                            {
                                var dict2 = new Dictionary <string, object>();
                                dict2["Name"]  = fieldinfo2.Name;
                                dict2["Value"] = new object();

                                div_tag.InnerHtml += textbox_render.GetLayout(dict2, name_prefix, fieldinfo2.Name);
                            }
                        }
                    }
                }
            }
            return(new HtmlString(div_tag.ToString(TagRenderMode.Normal)));
        }
Beispiel #2
0
        public HtmlString GetPatientParameterLayout()
        {
            var        name_element = "Value";
            HtmlString layout       = new HtmlString("");

            if (!parameter.MetaData.Is_var)
            {
                var _object = new Dictionary <string, object>();
                _object["Name"]  = parameter.Name;
                _object["Value"] = parameter.Value;

                var renderer = new TextBoxRenderer();
                return(new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString()));
            }
            else
            {
                var _object = new Dictionary <string, object>();
                _object["Name"] = parameter.Name;
                var _Variants = new Dictionary <string, string>();
                for (int i = 0; i < parameter.MetaData.Variants.Length; i++)
                {
                    _Variants.Add(String.Format("name-{0}", i), parameter.MetaData.Variants[i].Value);
                }
                _object["Variants"] = _Variants;
                if (parameter.MetaData.Variants.Length <= BaseRenderer.limit_length_of_list)
                {
                    var renderer = new ListBoxRenderer();
                    return(new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString()));
                }
                else
                {
                    var renderer = new DropDownBoxRenderer();
                    return(new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString()));
                }
            }
        }
Beispiel #3
0
        public HtmlString GetPatientParameterLayout()
        {
            var name_element = "Value";
            HtmlString layout = new HtmlString("");
            if (!parameter.MetaData.Is_var)
            {
                var _object = new Dictionary<string, object>();
                _object["Name"] = parameter.Name;
                _object["Value"] = parameter.Value;

                var renderer = new TextBoxRenderer();
                return new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString());
            }
            else
            {
                var _object = new Dictionary<string, object>();
                _object["Name"] = parameter.Name;
                var _Variants = new Dictionary<string, string>();
                for (int i = 0; i < parameter.MetaData.Variants.Length; i++)
                {
                    _Variants.Add(String.Format("name-{0}", i), parameter.MetaData.Variants[i].Value);
                }
                _object["Variants"] = _Variants;
                if (parameter.MetaData.Variants.Length <= BaseRenderer.limit_length_of_list)
                {
                    var renderer = new ListBoxRenderer();
                    return new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString());
                }
                else
                {
                    var renderer = new DropDownBoxRenderer();
                    return new HtmlString(renderer.GetLayout(_object, name_prefix, name_element).ToString());
                }
            }
        }
Beispiel #4
0
        public HtmlString GetAddParameterLayout(Parameter parameter)
        {
            var type = parameter.GetType();
            var FieldInfos = type.GetProperties();

            var div_tag = new TagBuilder("div");
            div_tag.InnerHtml += "<h4>Заполните пожалуйста основные характеристики параметра</h4>";

            var textbox_render = new TextBoxRenderer();
            foreach (PropertyInfo field_info in FieldInfos)
            {
                var dict = new Dictionary<string, object>();
                dict["Name"] = field_info.Name;
                dict["Value"] = new object();

                if (field_info.Name != "MetaData" && field_info.Name != "Id")
                {
                    div_tag.InnerHtml += textbox_render.GetLayout(dict, name_prefix, field_info.Name);
                }
                else
                {
                    if (field_info.Name == "MetaData" && field_info.PropertyType == typeof(MetaData))
                    {
                        div_tag.InnerHtml += "<h4>Заполните пожалуйста мета-данные</h4>";

                        var metadata_type = typeof(MetaData);
                        var fieldInfos2 = metadata_type.GetProperties();
                        var checkbox_render = new CheckBoxRenderer();
                        foreach (PropertyInfo fieldinfo2 in fieldInfos2)
                        {
                            if (fieldinfo2.PropertyType == typeof(bool))
                            {
                                var dict2 = new Dictionary<string, object>();
                                dict2["Name"] = fieldinfo2.Name;
                                dict2["Value"] = new bool();

                                div_tag.InnerHtml += checkbox_render.GetLayout(dict2, name_prefix, fieldinfo2.Name);
                            }

                            if (fieldinfo2.PropertyType == typeof(object) || fieldinfo2.PropertyType == typeof(Nullable<int>))
                            {
                                var dict2 = new Dictionary<string, object>();
                                dict2["Name"] = fieldinfo2.Name;
                                dict2["Value"] = new object();

                                div_tag.InnerHtml += textbox_render.GetLayout(dict2, name_prefix, fieldinfo2.Name);
                            }
                        }
                    }
                }
            }
            return new HtmlString(div_tag.ToString(TagRenderMode.Normal));
        }