public string GetTableInfoByTableNameandClassName(AdonaiBuildStructureInfo buildInfo)
        {
            string tableName     = USUtil.CovertFirstLetterToCapital(buildInfo.TableName);
            string infoClassName = USUtil.CovertFirstLetterToCapital(buildInfo.InfoClassName);

            string strFinalinfoString = string.Empty;
            string strScript          = SmartBuilder.Repository.MsSQL.QueryCollaborator.GenerateQuery_GetListOfColumnInfoByTableName(tableName);
            AppUtilityDataProvider objInfoDataProvider = new AppUtilityDataProvider();

            DataTable dataTable = objInfoDataProvider.GetTableColumnsBySQLScritpt(strScript, buildInfo.ConnectionString);


            InfoClassGenerator infoClassGenerator = new InfoClassGenerator(GetSystemSettings());

            strFinalinfoString = infoClassGenerator.BuildInfoClassforGivenDataTable(dataTable, infoClassName, buildInfo.IsNullableRequired, buildInfo.IsSerializable);

            //Process data of data table to build final string for the C# info class
            //strFinalinfoString = TableInfoGenerator.BuildInfoClassforGivenDataTable(dt, infoClassName, buildInfo.IsNullableRequired, buildInfo.IsSerializable);

            StringBuilder strBuilder = new StringBuilder();

            strBuilder.Append(USUtil.LoadUsingCodex(buildInfo.InfoNameSpace, string.Empty));
            strBuilder.Append(strFinalinfoString);
            strBuilder.Append(" \r }");
            USUtil.CreateClassFileForGivenTypeClass(infoClassName, strBuilder.ToString(), ICD.Info);

            //Add Controller Class
            if (buildInfo.IsControllerRequired)
            {
                strBuilder.Append(AddContentHeader("Your Controller Class"));

                string txtControllerCode = USUtil.Initialize_UsingStatementAndClassHeader(buildInfo.InfoNameSpace, tableName, ICD.Controller);
                USUtil.CreateClassFileForGivenTypeClass(tableName + USUtil.Controller, txtControllerCode, ICD.Controller);

                strBuilder.Append(txtControllerCode);
            }

            //Add SQL DataProvider Class
            if (buildInfo.IsProviderRequired)
            {
                strBuilder.Append(AddContentHeader("Your SQL Data Provider Class"));

                string txtProviderCode = USUtil.Initialize_UsingStatementAndClassHeader(buildInfo.InfoNameSpace, tableName, ICD.DataProvider);
                USUtil.CreateClassFileForGivenTypeClass(tableName + USUtil.Provider, txtProviderCode, ICD.DataProvider);
                strBuilder.Append(txtProviderCode);
            }
            return(strBuilder.ToString());
        }
Esempio n. 2
0
        private void chkDefaults_CheckedChanged(object sender, EventArgs e)
        {
            pnlDataContract.Enabled = Settings.Default.EnableDataContract = chkDataContract.Checked;
            Settings.Default.EnableDataContractNamespace = chkDataContractNamespace.Checked;
            pnlDisplayAttribute.Enabled                  = Settings.Default.EnableDisplayAttributes = chkDisplayAttribute.Checked;
            Settings.Default.EnableDataContractName      = chkDataContractName.Checked;
            Settings.Default.EnableDisplayAttributeOrder = chkDisplayAttributeOrder.Checked;
            Settings.Default.EnableDisplayAttributeName  = chkDisplayAttributeName.Checked;
            Settings.Default.EnableDataMemberName        = chkDataMemberName.Checked;
            Settings.Default.EnableDataMemberOrder       = chkDataMemberOrder.Checked;
            pnlDataMember.Enabled           = Settings.Default.EnableDataMember = chkDataMember.Checked;
            Settings.Default.EnableRequired = chkEnableRequired.Checked;

            Settings.Default.Save();
            InfoClassGenerator infoClassGenerator = new InfoClassGenerator(SystemSettings.GetSystemSettings());

            lblOutputString.Text = infoClassGenerator.LoadTableInfoPrimarySettings();
        }