コード例 #1
0
        private TableUIGenerationParams[] BuildDefaultTableUiGenerationParams(ITable tb)
        {
            List <TableUIGenerationParams> tableUIGenerationParamsList = new List <TableUIGenerationParams>();

            foreach (IColumn column in tb.Columns)
            {
                var tableUIGenerationParams = new TableUIGenerationParams();

                tableUIGenerationParams.IsSelect  = true;
                tableUIGenerationParams.FieldName = column.Name.Trim().Replace("_", "");

                tableUIGenerationParams.FieldNameCn =
                    TableGenerationHelper.GetNameFromDescription(column.Description.Trim(),
                                                                 column.Name.Trim().Replace("_", "").Trim());

                tableUIGenerationParams.LanguageType = column.LanguageType;
                tableUIGenerationParams.Size         = column.CharacterMaxLength;
                tableUIGenerationParams.IsAutoKey    = column.IsAutoKey;

                if (config is NHibernateFrameworkWebUIGenerateConfig)
                {
                    NHibernateFrameworkWebUIGenerateConfig nconfig = config as NHibernateFrameworkWebUIGenerateConfig;
                    nconfig.SetColumnParams(column, tableUIGenerationParams);
                }


                tableUIGenerationParams.IsReqiured   = !column.IsNullable;
                tableUIGenerationParams.DefaultValue = column.Default;
                tableUIGenerationParams.DbColumnName = column.Name;
                tableUIGenerationParamsList.Add(tableUIGenerationParams);
            }

            return(tableUIGenerationParamsList.ToArray());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void GetSingleInputData(string generateType)
        {
            ITable selectTable = this.cbxtoolStripSelectObejct.ComboBox.SelectedValue as MyMeta.ITable;

            this.zeusInput["GenerateType"] = generateType;
            this.zeusInput["selectTable"]  = selectTable;
            //this.zeusInput["codeGenerationSetting"] = this.Config;



            List <TableUIGenerationParams> 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);
            }

            TableUIGenerationParams[] tableUIGenerationParamsListArray = new TableUIGenerationParams[tableUIGenerationParamsList.Count];

            tableUIGenerationParamsList.CopyTo(tableUIGenerationParamsListArray);

            this.zeusInput["TableUIGenerationParamsArray"] = tableUIGenerationParamsListArray;
        }
コード例 #4
0
 public void SetColumnParams(IColumn column, TableUIGenerationParams tableUIGenerationParams)
 {
     switch (UI_Type)
     {
     case UIType.AspNet:
     case UIType.AspNetWithEasyUI:
         if (column.LanguageType == "bool")
         {
             tableUIGenerationParams.InputType = "CheckBox";
         }
         else
         {
             if (column.LanguageType == "string" && column.CharacterMaxLength > 200)
             {
                 tableUIGenerationParams.InputType = "TextBoxMultiLine";
             }
             tableUIGenerationParams.InputType = "TextBox";
         }
         break;
     }
 }
コード例 #5
0
        private void cbxtoolStripSelectObejct_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.dataGridViewField.AutoGenerateColumns = false;
            MyMeta.ITable tb = this.cbxtoolStripSelectObejct.ComboBox.SelectedValue as MyMeta.ITable;

            List <TableUIGenerationParams> tableUIGenerationParamsList = new List <TableUIGenerationParams>();

            foreach (IColumn column in tb.Columns)
            {
                TableUIGenerationParams tableUIGenerationParams = new TableUIGenerationParams();

                tableUIGenerationParams.IsSelect  = true;
                tableUIGenerationParams.FieldName = column.Name.Trim().Replace("_", "");

                tableUIGenerationParams.FieldNameCn =
                    TableGenerationHelper.GetNameFromDescription(column.Description.Trim(), column.Name.Trim().Replace("_", "").Trim());

                tableUIGenerationParams.LanguageType = column.LanguageType;
                tableUIGenerationParams.Size         = column.CharacterMaxLength;
                tableUIGenerationParams.IsAutoKey    = column.IsAutoKey;
                if (column.LanguageType == "bool")
                {
                    tableUIGenerationParams.InputType = "CheckBox";
                }
                else
                {
                    tableUIGenerationParams.InputType = "TextBox";
                }
                tableUIGenerationParams.IsReqiured   = !column.IsNullable;
                tableUIGenerationParams.DefaultValue = column.Default;
                tableUIGenerationParams.DbColumnName = column.Name;
                tableUIGenerationParamsList.Add(tableUIGenerationParams);
            }

            TableUIGenerationParams[] tableUIGenerationParamsListArray = new TableUIGenerationParams[tableUIGenerationParamsList.Count];

            tableUIGenerationParamsList.CopyTo(tableUIGenerationParamsListArray);

            this.dataGridViewField.DataSource = tableUIGenerationParamsListArray;
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        private TableUIGenerationParams[] GetTableUiGenerationParamsListArray()
        {
            List <TableUIGenerationParams> tableUIGenerationParamsList = new List <TableUIGenerationParams>();

            foreach (DataGridViewRow row in dataGridViewField.Rows)
            {
                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;
                tableUIGenerationParams.InputUIControlType =
                    webuiconfig.getInputUIControlByName(tableUIGenerationParams.InputType);
                tableUIGenerationParamsList.Add(tableUIGenerationParams);
            }
            return(tableUIGenerationParamsList.ToArray());
        }
コード例 #8
0
 public string GenerateFieldValidateInfo(TableUIGenerationParams column)
 {
     return(string.Format(this.ValidateInfo, column.FieldNameCn));
 }
コード例 #9
0
 public string GenerateFieldInputTooltip(TableUIGenerationParams column)
 {
     return(string.Format(this.InputTootip, column.FieldNameCn));
 }