private FormUISetting GetFormUIConfig(IDatabase database, ITable selectTable) { List <TableUIGenerationParams> tableUIGenerationParamsList = null; if (database != null && selectTable != null) { tableUIGenerationParamsList = new List <TableUIGenerationParams>(); foreach (DataGridViewRow row in dataGridViewField.Rows) { if ((bool)row.Cells["colIsSelect"].Value) { var tableUIGenerationParams = new TableUIGenerationParams(); tableUIGenerationParams.IsSelect = (bool)row.Cells["colIsSelect"].Value; tableUIGenerationParams.FieldName = (string)row.Cells["colFieldName"].Value; tableUIGenerationParams.FieldNameCn = (string)row.Cells["colFieldNameCn"].Value; tableUIGenerationParams.LanguageType = (string)row.Cells["colLanguageType"].Value; tableUIGenerationParams.Size = (int)row.Cells["colSize"].Value; tableUIGenerationParams.IsAutoKey = (bool)row.Cells["colIsAutoKey"].Value; tableUIGenerationParams.InputType = (string)row.Cells["colInputType"].Value; tableUIGenerationParams.IsReqiured = (bool)row.Cells["colIsReqiured"].Value; tableUIGenerationParams.DefaultValue = (string)row.Cells["colDefaultValue"].Value; tableUIGenerationParams.Items = (string)row.Cells["colSelectItem"].Value; tableUIGenerationParams.DbColumnName = (string)row.Cells["colIndexName"].Value; tableUIGenerationParamsList.Add(tableUIGenerationParams); } } } var uis = new FormUISetting(); uis.TableName = selectTable.Name; uis.Items = tableUIGenerationParamsList; return(uis); }
private void toolStripButtonLoadConifg_Click(object sender, EventArgs e) { if (this.cbxtoolStripSelectObejct.ComboBox.SelectedIndex >= 0) { if (this.openFileDialogInputUIConfig.ShowDialog() == DialogResult.OK) { FormUISetting uis = XmlConfigReader.GetConfig <FormUISetting>(this.openFileDialogInputUIConfig.FileName); ITable selectTable = this.cbxtoolStripSelectObejct.ComboBox.SelectedValue as MyMeta.ITable; IDatabase database = selectTable.Database; for (int i = 0; i < this.cbxtoolStripSelectObejct.ComboBox.Items.Count; i++) { ITable table = (ITable)this.cbxtoolStripSelectObejct.ComboBox.Items[i]; if (table.Name == uis.TableName) { this.cbxtoolStripSelectObejct.ComboBox.SelectedIndex = i; break; } } this.dataGridViewField.DataSource = uis.Items; } } }
private void toolStripButtonSaveConfig_Click(object sender, EventArgs e) { if ((cbxtoolStripSelectDataBase.ComboBox.SelectedIndex >= 0) && (cbxtoolStripSelectObejct.ComboBox.SelectedIndex >= 0)) { var database = cbxtoolStripSelectDataBase.ComboBox.SelectedValue as IDatabase; var selectTable = cbxtoolStripSelectObejct.ComboBox.SelectedValue as ITable; FormUISetting uis = GetFormUIConfig(database, selectTable); string pathKey = "Key|KilerCodeGeneration|UI|" + database.Name + "|" + selectTable.Name; XmlConfigReader.SetConfig <FormUISetting>(pathKey, uis, saveFileDialogInputUIConfig); } }
private void toolStripButtonSaveConfig_Click(object sender, EventArgs e) { if (this.cbxtoolStripSelectObejct.ComboBox.SelectedIndex >= 0) { ITable selectTable = this.cbxtoolStripSelectObejct.ComboBox.SelectedValue as MyMeta.ITable; IDatabase database = selectTable.Database; List <TableUIGenerationParams> tableUIGenerationParamsList = null; if (database != null && selectTable != null) { tableUIGenerationParamsList = new List <TableUIGenerationParams>(); foreach (DataGridViewRow row in this.dataGridViewField.Rows) { TableUIGenerationParams tableUIGenerationParams = new TableUIGenerationParams(); tableUIGenerationParams.IsSelect = (bool)row.Cells["colIsSelect"].Value; tableUIGenerationParams.FieldName = (string)row.Cells["colFieldName"].Value; tableUIGenerationParams.FieldNameCn = (string)row.Cells["colFieldNameCn"].Value; tableUIGenerationParams.LanguageType = (string)row.Cells["colLanguageType"].Value; tableUIGenerationParams.Size = (int)row.Cells["colSize"].Value; tableUIGenerationParams.IsAutoKey = (bool)row.Cells["colIsAutoKey"].Value; tableUIGenerationParams.InputType = (string)row.Cells["colInputType"].Value; tableUIGenerationParams.IsReqiured = (bool)row.Cells["colIsReqiured"].Value; tableUIGenerationParams.DefaultValue = (string)row.Cells["colDefaultValue"].Value; tableUIGenerationParams.Items = (string)row.Cells["colSelectItem"].Value; tableUIGenerationParams.DbColumnName = (string)row.Cells["colIndexName"].Value; tableUIGenerationParamsList.Add(tableUIGenerationParams); } } FormUISetting uis = new FormUISetting(); uis.TableName = selectTable.Name; uis.Items = tableUIGenerationParamsList; string pathKey = "Key|KilerCodeGeneration|UI|" + database.Name + "|" + selectTable.Name; XmlConfigReader.SetConfig <FormUISetting>(pathKey, uis, this.saveFileDialogInputUIConfig); } }