AdminCreateDB() private method

private AdminCreateDB ( string newProjectName ) : int
newProjectName string
return int
示例#1
0
        public static bool Testing_SetupDatabase(string host, int port, string adminUser, string adminPwd, string user, string pwd, string projectName)
        {
            AssetServer.AdminSetCredentials(host, port, adminUser, adminPwd);
            MaintDatabaseRecord[] recordArray = AssetServer.AdminRefreshDatabases();
            if (recordArray == null)
            {
                return(false);
            }
            foreach (MaintDatabaseRecord record in recordArray)
            {
                if (record.name == projectName)
                {
                    AssetServer.AdminDeleteDB(projectName);
                }
            }
            if (AssetServer.AdminCreateDB(projectName) == 0)
            {
                return(false);
            }
            string databaseName = AssetServer.GetDatabaseName(host, adminUser, adminPwd, port.ToString(), projectName);

            if (!AssetServer.AdminSetUserEnabled(databaseName, user, user, string.Empty, 1))
            {
                return(false);
            }
            Testing_SetActiveDatabase(host, port, projectName, databaseName, user, pwd);
            return(true);
        }
示例#2
0
        public static bool Testing_SetupDatabase(string host, int port, string adminUser, string adminPwd, string user, string pwd, string projectName)
        {
            AssetServer.AdminSetCredentials(host, port, adminUser, adminPwd);
            MaintDatabaseRecord[] array = AssetServer.AdminRefreshDatabases();
            if (array == null)
            {
                return(false);
            }
            MaintDatabaseRecord[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                MaintDatabaseRecord maintDatabaseRecord = array2[i];
                if (maintDatabaseRecord.name == projectName)
                {
                    AssetServer.AdminDeleteDB(projectName);
                }
            }
            if (AssetServer.AdminCreateDB(projectName) == 0)
            {
                return(false);
            }
            string databaseName = AssetServer.GetDatabaseName(host, adminUser, adminPwd, port.ToString(), projectName);

            if (!AssetServer.AdminSetUserEnabled(databaseName, user, user, string.Empty, 1))
            {
                return(false);
            }
            ASEditorBackend.Testing_SetActiveDatabase(host, port, projectName, databaseName, user, pwd);
            return(true);
        }
        private void PerformCurrentAction()
        {
            switch (this.currAction)
            {
            case Action.Main:
                this.currAction = Action.Main;
                this.DoConnect();
                Event.current.Use();
                return;

            case Action.CreateUser:
                AssetServer.AdminCreateUser(this.nUserName, this.nFullName, this.nEmail, this.nPassword1);
                this.currAction = Action.Main;
                if (this.lv.row > -1)
                {
                    this.DoGetUsers();
                }
                Event.current.Use();
                return;

            case Action.SetPassword:
                AssetServer.AdminChangePassword(this.users[this.lv2.row].userName, this.nPassword1);
                this.currAction = Action.Main;
                Event.current.Use();
                return;

            case Action.CreateProject:
                if (AssetServer.AdminCreateDB(this.nProjectName, this.nTemplateProjectName) != 0)
                {
                    this.DoRefreshDatabases();
                    for (int i = 0; i < this.databases.Length; i++)
                    {
                        if (this.databases[i].name == this.nProjectName)
                        {
                            this.lv.row = i;
                            this.DoGetUsers();
                            break;
                        }
                    }
                }
                break;

            case Action.ModifyUser:
                AssetServer.AdminModifyUserInfo(this.databases[this.lv.row].dbName, this.users[this.lv2.row].userName, this.nFullName, this.nEmail);
                this.currAction = Action.Main;
                if (this.lv.row > -1)
                {
                    this.DoGetUsers();
                }
                Event.current.Use();
                return;

            default:
                return;
            }
            this.currAction = Action.Main;
            Event.current.Use();
        }
示例#4
0
        public static int AdminCreateDB(string newProjectName)
        {
            string empty = string.Empty;

            return(AssetServer.AdminCreateDB(newProjectName, empty));
        }
示例#5
0
        public static int AdminCreateDB(string newProjectName)
        {
            string copyFromProjectName = "";

            return(AssetServer.AdminCreateDB(newProjectName, copyFromProjectName));
        }