public void Save() { // save the prevalue data and get on with you life ;) if (_datatype != null) { _datatype.DBType = (cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(cms.businesslogic.datatype.DBTypes), _dropdownlist.SelectedValue, true); } else if (_datatypeOld != null) { _datatypeOld.DBType = (DBTypes)Enum.Parse(typeof(DBTypes), _dropdownlist.SelectedValue, true); } if (_displayTextBox) { // If the prevalue editor has an prevalue textbox - save the textbox value as the prevalue Prevalue = _textbox.Text; } DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); ss.ClearSettings(_datatype.DataTypeDefinitionId); int i = 0; foreach (KeyValuePair <string, DataEditorSettingType> k in dtSettings) { ss.InsertSetting(_datatype.DataTypeDefinitionId, k.Key, k.Value.Value, i); i++; } ss.Dispose(); }
public void Save() { bool hasErrors = false; foreach (KeyValuePair <string, DataEditorSettingType> k in dtSettings) { var result = k.Value.Validate(); Label lbl = this.FindControlRecursive <Label>("lbl" + k.Key); if (result == null && lbl != null) { if (lbl != null) { lbl.Text = string.Empty; } } else { if (hasErrors == false) { hasErrors = true; } if (lbl != null) { lbl.Text = " " + result.ErrorMessage; } } } if (!hasErrors) { // save the prevalue data and get on with you life ;) if (_datatype != null) { _datatype.DBType = (cms.businesslogic.datatype.DBTypes) Enum.Parse(typeof(cms.businesslogic.datatype.DBTypes), _dropdownlist.SelectedValue, true); } else if (_datatypeOld != null) { _datatypeOld.DBType = (DBTypes)Enum.Parse(typeof(DBTypes), _dropdownlist.SelectedValue, true); } if (_displayTextBox) { // If the prevalue editor has an prevalue textbox - save the textbox value as the prevalue Prevalue = _textbox.Text; } DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); ss.ClearSettings(_datatype.DataTypeDefinitionId); int i = 0; foreach (KeyValuePair <string, DataEditorSettingType> k in dtSettings) { ss.InsertSetting(_datatype.DataTypeDefinitionId, k.Key, k.Value.Value, i); i++; } ss.Dispose(); } }