コード例 #1
0
        public ActionResult SaveConnection(string ServerName, string DatabaseName, string UserName, string Password,
                                           string PortNumber = "", string UseSSL = "", string ActivateSSL = "")
        {
            facade = new Fasada();
            try
            {
                facade = new Fasada();
                var dt = facade.GetMysqlScheme(ServerName, DatabaseName, UserName, Password, PortNumber, UseSSL, ActivateSSL);

                var connectionString = facade.GetMySqlConnectionString(ServerName, DatabaseName, UserName, Password,
                                                                       PortNumber, UseSSL, ActivateSSL);

                using (var context = new SkyContext())
                {
                    var dataBaseType =
                        context.DatabaseTypes.Where(a => a.DatabaseTypeID == 1).Select(a => a).FirstOrDefault();
                    connectionString += "[1]";
                    context.ConnectionStrings.Add(new ConnectionString()
                    {
                        Connection = connectionString,
                    });
                    context.SaveChanges();
                }
            }
            catch (Exception exception)
            {
                //log error
                @TempData["TestData"] = exception.Message;
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult SelectTop(string top, string connectionString, string tableName)
        {
            facade = new Fasada();
            DataTable dt = facade.GetSMySqlelectedTopTable(top, connectionString, tableName);

            HomeViewModel vm = new HomeViewModel(dt, connectionString, tableName);

            return(PartialView("Selected", vm));
        }
コード例 #3
0
        public ActionResult GetScheme(string ServerName, string DatabaseName, string UserName, string Password, string PortNumber = "", string UseSSL = "", string ActivateSSL = "")
        {
            facade = new Fasada();
            DataTable dt = facade.GetMysqlScheme(ServerName, DatabaseName, UserName, Password, PortNumber, UseSSL, ActivateSSL);

            HomeViewModel vm = new HomeViewModel(dt, facade.GetMySqlConnectionString(ServerName, DatabaseName, UserName, Password, PortNumber, UseSSL, ActivateSSL));

            return(View("Scheme", vm));
        }
コード例 #4
0
        public ActionResult GetScheme(string ServerName, string DatabaseName, string UserName, string Password, string Trusted)
        {
            facade = new Fasada();
            DataTable dt = facade.GetMSsqlScheme(ServerName, DatabaseName, UserName, Password, Trusted);

            HomeViewModel vm = new HomeViewModel(dt, facade.GetMSSqlConnectionString(ServerName, DatabaseName, UserName, Password, Trusted));

            return(View("Scheme", vm));
        }
コード例 #5
0
 public ActionResult TestConnection(string ServerName, string DatabaseName, string UserName, string Password, string Trusted)
 {
     try
     {
         facade = new Fasada();
         var dt = facade.GetMSsqlScheme(ServerName, DatabaseName, UserName, Password, Trusted);
         @TempData["TestData"] = 1;
         return(RedirectToAction("Index"));
     }
     catch (Exception exception)
     {
         //log error
         @TempData["TestData"] = exception.Message;
         return(RedirectToAction("Index"));
     }
 }
コード例 #6
0
 public ActionResult TestConnection(string ServerName, string DatabaseName, string UserName, string Password,
                                    string PortNumber = "", string UseSSL = "", string ActivateSSL = "")
 {
     try
     {
         facade = new Fasada();
         var dt = facade.GetMysqlScheme(ServerName, DatabaseName, UserName, Password, PortNumber, UseSSL, ActivateSSL);
         @TempData["TestData"] = "OK";
         return(RedirectToAction("Index"));
     }
     catch (Exception exception)
     {
         //log error
         @TempData["TestData"] = exception.Message;
         return(RedirectToAction("Index"));
     }
 }