public IActionResult AddDataDB(int i)
        {
            var req = this.HttpContext.Request.Form;
            EbDataDbConnection DataDB = new EbDataDbConnection();

            DataDB.DatabaseName = req["databasename"];
            DataDB.Server       = req["server"];
            DataDB.Port         = Int32.Parse(req["port"]);
            DataDB.UserName     = req["username"];
            DataDB.Password     = req["pwd"];
            DataDB.Timeout      = Int32.Parse(req["timeout"]);
            var r = this.ServiceClient.Post <bool>(new ChangeDataDBConnectionRequest {
                DataDBConnection = DataDB, IsNew = true
            });

            return(Redirect("/ConnectionManager"));
        }
Exemple #2
0
        public IActionResult DataDb(int i)
        {
            GetConnectionsResponse solutionConnections = this.ServiceClient.Post <GetConnectionsResponse>(new GetConnectionsRequest {
                ConnectionType = (int)EbConnectionTypes.EbDATA
            });
            var req = this.HttpContext.Request.Form;
            EbDataDbConnection dbcon = new EbDataDbConnection();

            dbcon.NickName = req["nickname"];
            dbcon.Server   = req["server"];
            dbcon.Port     = Int32.Parse(req["port"]);
            dbcon.UserName = req["username"];
            dbcon.Password = req["pwd"];
            if (!String.IsNullOrEmpty(req["Isdef"]))
            {
                dbcon.IsDefault = false;
            }

            if (solutionConnections.EBSolutionConnections.DataDbConnection != null)
            {
                if (String.IsNullOrEmpty(dbcon.Password) && dbcon.UserName == solutionConnections.EBSolutionConnections.SMSConnection.UserName && dbcon.Server == solutionConnections.EBSolutionConnections.DataDbConnection.Server)
                {
                    dbcon.Password = solutionConnections.EBSolutionConnections.DataDbConnection.Password;
                }
                this.ServiceClient.Post <bool>(new ChangeDataDBConnectionRequest {
                    DataDBConnection = dbcon, IsNew = false
                });
            }
            else
            {
                this.ServiceClient.Post <bool>(new ChangeDataDBConnectionRequest {
                    DataDBConnection = dbcon, IsNew = true
                });
            }
            return(Redirect("/ConnectionManager"));
        }