Beispiel #1
0
        public ModelInvokeResult <DatabaseConnectPK> Create(DatabaseConnect databaseConnect)
        {
            ModelInvokeResult <DatabaseConnectPK> result = new ModelInvokeResult <DatabaseConnectPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (databaseConnect.ConnectId == "自动生成")
                {
                    databaseConnect.ConnectId = GlobalManager.getPK(databaseConnect.GetMappingTableName(), "ConnectId");
                }
                /***********************begin 自定义代码*******************/
                databaseConnect.ServerName            = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Encrypt(databaseConnect.ServerName);
                databaseConnect.DatabaseName          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Encrypt(databaseConnect.DatabaseName);
                databaseConnect.UserCode              = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Encrypt(databaseConnect.UserCode);
                databaseConnect.UserPassword          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Encrypt(databaseConnect.UserPassword);
                databaseConnect.IbatisConfigFileValue = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Encrypt(databaseConnect.IbatisConfigFileValue);
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = databaseConnect.GetCreateMethodName(), ParameterObject = databaseConnect.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new DatabaseConnectPK {
                    ConnectId = databaseConnect.ConnectId
                };

                //注册数据连接ase
                GlobalManager.RegisterDatabaseConnections();
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }