Ejemplo n.º 1
0
 public static HtmlString NewParameterDraw(this HtmlHelper helper, Parameter parameter, string name_prefix)
 {
     if (Factory == null)
     {
         Factory = new RenderingFactory(parameter, name_prefix);
     }
     return Factory.GetAddParameterLayout(parameter);
 }
Ejemplo n.º 2
0
 public static HtmlString GetLayoutForParameterForPatient(this HtmlHelper helper, Parameter parameter, string name_prefix)
 {
     if (Factory == null)
     {
         Factory = new RenderingFactory(parameter, name_prefix);
     }
     return Factory.GetPatientParameterLayout();
 }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Инициализирует фабрику для отрисовки параметра.
 /// </summary>
 /// <param name="parameter">Отрисовываемый параметр</param>
 /// <param name="name_prefix">Префикс для генерации имен Html-объектов</param>
 public RenderingFactory(Parameter parameter, string name_prefix)
 {
     this.parameter = parameter;
     this.name_prefix = name_prefix;
 }