Ejemplo n.º 1
0
        public DataEditorSettingType GetDataEditorSettingType()
        {
            //Assembly a = string.IsNullOrEmpty(assembly) ? Assembly.GetExecutingAssembly() : Assembly.Load(assembly);
            //DataEditorSettingType dst = (DataEditorSettingType)a.CreateInstance(control);

            //Type t = System.Web.Compilation.BuildManager.GetType(type, false);
            DataEditorSettingType dst = (DataEditorSettingType)System.Activator.CreateInstance(type, true);

            if (defaultValue != null)
            {
                dst.DefaultValue = defaultValue.ToString();
            }

            if (dst != null)
            {
                dst.Prevalues = GetPrevalues();
            }

            return(dst);
        }
Ejemplo n.º 2
0
        protected void LoadSettings()
        {
            DataEditorPropertyPanel pnlType = new DataEditorPropertyPanel();

            pnlType.Text = ui.Text("dataBaseDatatype");

            _dropdownlist    = new DropDownList();
            _dropdownlist.ID = "dbtype";

            _dropdownlist.Items.Add(DBTypes.Date.ToString());
            _dropdownlist.Items.Add(DBTypes.Integer.ToString());
            _dropdownlist.Items.Add(DBTypes.Ntext.ToString());
            _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString());

            DataEditorPropertyPanel pnlPrevalue = new DataEditorPropertyPanel();

            pnlPrevalue.Text = ui.Text("prevalue");

            _textbox         = new TextBox();
            _textbox.ID      = "prevalues";
            _textbox.Visible = _displayTextBox;

            // put the childcontrols in context - ensuring that
            // the viewstate is persisted etc.

            pnlType.Controls.Add(_dropdownlist);
            Controls.Add(pnlType);

            if (_displayTextBox)
            {
                pnlPrevalue.Controls.Add(_textbox);
                Controls.Add(pnlPrevalue);
            }


            foreach (KeyValuePair <string, DataEditorSetting> kv in _datatype.Settings())
            {
                DataEditorSettingType dst = kv.Value.GetDataEditorSettingType();
                dtSettings.Add(kv.Key, dst);

                DataEditorPropertyPanel panel = new DataEditorPropertyPanel();
                panel.Text  = kv.Value.GetName();
                panel.Text += "<br/><small>" + kv.Value.description + "</small>";


                if (_datatype.HasSettings())
                {
                    DataEditorSettingsStorage ss = new DataEditorSettingsStorage();

                    List <Setting <string, string> > s = ss.GetSettings(_datatype.DataTypeDefinitionId);
                    ss.Dispose();

                    if (s.Find(set => set.Key == kv.Key).Value != null)
                    {
                        dst.Value = s.Find(set => set.Key == kv.Key).Value;
                    }
                }

                panel.Controls.Add(dst.RenderControl(kv.Value));

                Label invalid = new Label();
                invalid.Attributes.Add("style", "color:#8A1F11");
                invalid.ID = "lbl" + kv.Key;
                panel.Controls.Add(invalid);

                this.Controls.Add(panel);
            }
        }