public ActionResult LookCode(string baseInfoJson, string gridInfoJson, string gridColumnJson, string formInfoJson, string formFieldJson) { SingleTable default_Template = new SingleTable(); BaseConfigModel baseConfigModel = baseInfoJson.ToObject <BaseConfigModel>(); baseConfigModel.gridModel = gridInfoJson.ToObject <GridModel>(); baseConfigModel.gridColumnModel = gridColumnJson.ToList <GridColumnModel>(); baseConfigModel.formModel = formInfoJson.ToObject <FormModel>(); baseConfigModel.formFieldModel = formFieldJson.ToList <FormFieldModel>(); var tableFiled = new DataBaseTableBLL().GetTableFiledList(baseConfigModel.DataBaseLinkId, baseConfigModel.DataBaseTableName); string entitybuilder = default_Template.EntityBuilder(baseConfigModel, DataHelper.ListToDataTable <DataBaseTableFieldEntity>(tableFiled.ToList())); string entitymapbuilder = default_Template.EntityMapBuilder(baseConfigModel); string servicebuilder = default_Template.ServiceBuilder(baseConfigModel); string iservicebuilder = default_Template.IServiceBuilder(baseConfigModel); string businesbuilder = default_Template.BusinesBuilder(baseConfigModel); string controllerbuilder = default_Template.ControllerBuilder(baseConfigModel); string indexbuilder = default_Template.IndexBuilder(baseConfigModel); string formbuilder = default_Template.FormBuilder(baseConfigModel); var jsonData = new { entityCode = entitybuilder, entitymapCode = entitymapbuilder, serviceCode = servicebuilder, iserviceCode = iservicebuilder, businesCode = businesbuilder, controllerCode = controllerbuilder, indexCode = indexbuilder, formCode = formbuilder }; return(ToJsonResult(jsonData)); }
public ActionResult LookCode(string baseInfoJson, string gridInfoJson, string gridColumnJson, string formInfoJson, string formFieldJson) { SingleTable default_Template = new SingleTable(); BaseConfigModel baseConfigModel = baseInfoJson.ToObject <BaseConfigModel>(); baseConfigModel.gridModel = gridInfoJson.ToObject <GridModel>(); baseConfigModel.gridColumnModel = gridColumnJson.ToList <GridColumnModel>(); baseConfigModel.formModel = formInfoJson.ToObject <FormModel>(); baseConfigModel.formFieldModel = formFieldJson.ToList <FormFieldModel>(); var tableFiled = new DataBaseTableBLL(baseConfigModel.DataBaseLinkId).GetTableFiledList(baseConfigModel.DataBaseLinkId, baseConfigModel.DataBaseTableName); baseConfigModel.DataBaseLinkName = ""; DataBaseLinkEntity dataBaseLinkEntity = new DataBaseLinkBLL().GetEntity(baseConfigModel.DataBaseLinkId); string connectionString = ConfigurationManager.ConnectionStrings["BaseDb"].ConnectionString; if (connectionString != dataBaseLinkEntity.F_DbConnection) { baseConfigModel.DataBaseLinkName = dataBaseLinkEntity.F_DBName; baseConfigModel.DataBaseLinkType = dataBaseLinkEntity.F_DbType; if (ConfigurationManager.ConnectionStrings[dataBaseLinkEntity.F_DBName] == null) { string providerName = "System.Data.SqlClient"; if (dataBaseLinkEntity.F_DbType == "MySql") { providerName = "MySql.Data.MySqlClient"; } else if (dataBaseLinkEntity.F_DbType == "Oracle") { providerName = "Oracle.ManagedDataAccess.Client"; } Config.UpdateOrCreateConnectionString("XmlConfig\\database.config", dataBaseLinkEntity.F_DBName, dataBaseLinkEntity.F_DbConnection, providerName); } } string entitybuilder = default_Template.EntityBuilder(baseConfigModel, DataHelper.ListToDataTable <DataBaseTableFieldEntity>(tableFiled.ToList())); string entitymapbuilder = default_Template.EntityMapBuilder(baseConfigModel); string servicebuilder = default_Template.ServiceBuilder(baseConfigModel); string iservicebuilder = default_Template.IServiceBuilder(baseConfigModel); string businesbuilder = default_Template.BusinesBuilder(baseConfigModel); string controllerbuilder = default_Template.ControllerBuilder(baseConfigModel); string indexbuilder = default_Template.IndexBuilder(baseConfigModel); string formbuilder = default_Template.FormBuilder(baseConfigModel); var jsonData = new { entityCode = entitybuilder, entitymapCode = entitymapbuilder, serviceCode = servicebuilder, iserviceCode = iservicebuilder, businesCode = businesbuilder, controllerCode = controllerbuilder, indexCode = indexbuilder, formCode = formbuilder }; return(ToJsonResult(jsonData)); }