Exemple #1
0
        public string UpdateBusiness(BusinessModel business)
        {
            Business biz = new Business()
            {
                ID           = !String.IsNullOrEmpty(business.ID) ? business.ID : Guid.NewGuid().ToString(),
                Name         = business.Name,
                BusinessType = (BusinessType)Enum.Parse(typeof(BusinessType), business.Type),
            };

            List <Configuration> confs = new List <Configuration>();

            foreach (var conf in business.Configurations)
            {
                confs.Add(new Configuration()
                {
                    ID = !String.IsNullOrEmpty(conf.ID) ? conf.ID : Guid.NewGuid().ToString(),
                    ConfigurationType  = (ConfigurationType)Enum.Parse(typeof(ConfigurationType), conf.Type),
                    DbConnectionString = DBUtility.BuildConnectionString(conf.ServerAddress, conf.DatabaseName, conf.UserName, conf.Password)
                });
            }

            biz.Configurations = confs.ToArray();

            if (business.ReferenceID != null && business.ReferenceID.Length > 0)
            {
                biz.ReferenceID = business.ReferenceID.ToArray();
            }

            int result = Provider.BusinessManager().UpdateBusinessConfiguration(biz);

            return(result.ToString());
        }
Exemple #2
0
        public string CheckDatabaseExistency(SQLServerConnectionModel connection)
        {
            string connectionString = DBUtility.BuildConnectionString(connection.ServerAddress, "master", connection.UserName, connection.Password);

            string[] result = Provider.SQLServerDatabaseManager().ListDatabases(connectionString);

            foreach (var item in result)
            {
                if (item.ToLower() == connection.DatabaseName.ToLower())
                {
                    return("1");
                }
            }

            return("0");
        }
Exemple #3
0
        public string[] ListDatabases(SQLServerConnectionModel connection)
        {
            string connectionString = DBUtility.BuildConnectionString(connection.ServerAddress, connection.DatabaseName, connection.UserName, connection.Password);

            return(Provider.SQLServerDatabaseManager().ListDatabases(connectionString));
        }