示例#1
0
        private void bPassWord_Click(object sender, EventArgs e)
        {
            string str   = this.userID.Text.Trim();
            string str1  = this.passWord.Text.Trim();
            string str2  = this.serverName.Text.Trim();
            string upper = this.createUserID.Text.Trim().ToUpper();

            OracleFuctions.DeleteUsers(str, str1, str2, upper);
        }
示例#2
0
        private void btabSpaceDelete_Click(object sender, EventArgs e)
        {
            string str   = this.userID.Text.Trim();
            string str1  = this.passWord.Text.Trim();
            string str2  = this.serverName.Text.Trim();
            string upper = this.tabSpace.Text.Trim().ToUpper();
            string str3  = this.tabSpaceDir.Text.Trim();

            OracleFuctions.DeleteTableSpaceFile(str, str1, str2, upper, str3);
        }
示例#3
0
        private void buttonConnection_Click(object sender, EventArgs e)
        {
            string str  = "";
            string str1 = "";
            string str2 = "";

            str  = this.userID.Text.Trim();
            str1 = this.passWord.Text.Trim();
            str2 = this.serverName.Text.Trim();
            OracleFuctions.ConnectTest(str2, str, str1);
        }
示例#4
0
        private void bUserID_Click(object sender, EventArgs e)
        {
            string str    = this.userID.Text.Trim();
            string str1   = this.passWord.Text.Trim();
            string str2   = this.serverName.Text.Trim();
            string upper  = this.createUserID.Text.Trim().ToUpper();
            string str3   = this.createPassWord.Text.Trim();
            string upper1 = this.tabSpace.Text.Trim().ToUpper();

            OracleFuctions.CreateOracleUsers(str, str1, str2, upper, str3, upper1);
        }
示例#5
0
 public static void ImportUsers(string string_0, string string_1, string string_2, string string_3,
                                string string_4, string string_5)
 {
     if (!(string_0 == null ? false : !(string_0.Trim() == "")))
     {
         MessageBox.Show("用户名不能为空");
     }
     else if (!(string_1 == null ? false : !(string_1.Trim() == "")))
     {
         MessageBox.Show("用户名密码不能为空");
     }
     else if (!(string_2 == null ? false : !(string_2.Trim() == "")))
     {
         MessageBox.Show("Oracle服务名不能为空");
     }
     else if (!(string_3 == null ? false : !(string_3.Trim() == "")))
     {
         MessageBox.Show("备份文件名不能为空");
     }
     else if (!(string_4 == null ? false : !(string_4.Trim() == "")))
     {
         MessageBox.Show("源用户名不能为空");
     }
     else if ((string_5 == null ? false : !(string_5.Trim() == "")))
     {
         string    startupPath = "";
         ArrayList arrayLists  = new ArrayList();
         startupPath = Application.StartupPath;
         startupPath = (startupPath.Substring(startupPath.Length - 1, 1) != "\\"
             ? string.Concat(startupPath, "\\Imp_User", string_0, ".bat")
             : string.Concat(startupPath, "Imp_User", string_0, ".bat"));
         ClsReadWriteTxt clsReadWriteTxt = new ClsReadWriteTxt();
         clsReadWriteTxt.DeleteTextFile(startupPath);
         clsReadWriteTxt.CreateTextFile(startupPath);
         arrayLists.Clear();
         string[] string0 = new string[]
         {
             "imp ", string_0, "/", string_1, "@", string_2, "  file=", string_3, " Full=N  FromUser="******" ToUser="******" Rows=Y Compile=Y;"
         };
         arrayLists.Add(string.Concat(string0));
         for (int i = 0; i < arrayLists.Count; i++)
         {
             clsReadWriteTxt.AppendTextToFile(startupPath, arrayLists[i].ToString());
         }
         OracleFuctions.ExecuteWindowExe(startupPath, string.Concat("导入用户", string_0, "成功"));
     }
     else
     {
         MessageBox.Show("目标用户名不能为空");
     }
 }
示例#6
0
        public static void CreateTableSpace(string string_0, string string_1, string string_2, string string_3,
                                            string string_4, string string_5)
        {
            int       i;
            string    startupPath = "";
            string    str         = "";
            ArrayList arrayLists  = new ArrayList();

            startupPath = Application.StartupPath;
            startupPath = (startupPath.Substring(startupPath.Length - 1, 1) != "\\"
                ? string.Concat(startupPath, "\\CreateTableSpace.par")
                : string.Concat(startupPath, "CreateTableSpace.par"));
            ClsReadWriteTxt clsReadWriteTxt = new ClsReadWriteTxt();

            clsReadWriteTxt.DeleteTextFile(startupPath);
            clsReadWriteTxt.CreateTextFile(startupPath);
            arrayLists.Clear();
            arrayLists.Add("disconnect;");
            string[] string0 = new string[] { "connect ", string_0, "/", string_1, "@", string_2, " as sysdba;" };
            arrayLists.Add(string.Concat(string0));
            string0 = new string[]
            {
                "CREATE TABLESPACE \"", string_3, "\"  DATAFILE '", string_4, "' SIZE ", string_5,
                "M reuse autoextend off;"
            };
            arrayLists.Add(string.Concat(string0));
            arrayLists.Add("disconnect;");
            arrayLists.Add("Exit;");
            for (i = 0; i < arrayLists.Count; i++)
            {
                clsReadWriteTxt.AppendTextToFile(startupPath, arrayLists[i].ToString());
            }
            str = Application.StartupPath;
            str = (str.Substring(str.Length - 1, 1) != "\\"
                ? string.Concat(str, "\\CreateTableSpace.bat")
                : string.Concat(str, "CreateTableSpace.bat"));
            clsReadWriteTxt = new ClsReadWriteTxt();
            clsReadWriteTxt.DeleteTextFile(str);
            clsReadWriteTxt.CreateTextFile(str);
            arrayLists.Clear();
            arrayLists.Add("@echo on");
            string0 = new string[] { "\"sqlplus\" ", string_0, "/", string_1, "@", string_2, " @", startupPath };
            arrayLists.Add(string.Concat(string0));
            for (i = 0; i < arrayLists.Count; i++)
            {
                clsReadWriteTxt.AppendTextToFile(str, arrayLists[i].ToString());
            }
            OracleFuctions.ExecuteWindowExe(str, "创建Oracle表空间成功");
        }
示例#7
0
        private void bExportion_Click(object sender, EventArgs e)
        {
            string str  = this.userID.Text.Trim();
            string str1 = this.passWord.Text.Trim();
            string str2 = this.exportDir.Text.Trim();
            string str3 = this.exportUserID.Text.Trim();
            string str4 = this.serverName.Text.Trim();

            if ((str2.Substring(str2.Length - 1, 1) == "\\"
                ? false
                : !(str2.Substring(str2.Length - 4, 4).ToLower() != ".dmp")))
            {
                OracleFuctions.ExportUsers(str, str1, str2, str3, str4);
            }
            else
            {
                MessageBox.Show("必须输入完整并且正确的数据库文件名!");
            }
        }
示例#8
0
        private void serverName_Leave(object sender, EventArgs e)
        {
            string oraHome;

            try
            {
                oraHome = OracleFuctions.getOraHome();
                this.tabSpaceDir.Text = oraHome;
                if (this.tabSpaceDir.Text.Trim().IndexOf(this.serverName.Text.Trim()) < 0)
                {
                    TextBox textBox = this.tabSpaceDir;
                    textBox.Text = string.Concat(textBox.Text, this.serverName.Text, '\\');
                }
            }
            catch (Exception exception)
            {
                oraHome = exception.Message.ToString();
            }
        }
示例#9
0
 private void bexpDir_Click(object sender, EventArgs e)
 {
     if (this.exportUserID.Text != "")
     {
         FolderBrowser folderBrowser = new FolderBrowser()
         {
             Description   = "请选择目标目录",
             StartLocation = FolderBrowser.fbFolder.Desktop,
             Style         = FolderBrowser.fbStyles.BrowseForEverything
         };
         if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string str  = OracleFuctions.isFileOrFolder(folderBrowser.DirectoryPath);
             string str1 = OracleFuctions.addUserList(this.exportUserID.Text.Trim(), str);
             this.exportDir.Text = str1;
         }
     }
     else
     {
         MessageBox.Show("导出Oracle用户列表不能为空");
     }
 }
示例#10
0
        private void btabSpaceCreate_Click(object sender, EventArgs e)
        {
            string str   = this.userID.Text.Trim();
            string str1  = this.passWord.Text.Trim();
            string str2  = this.serverName.Text.Trim();
            string upper = this.tabSpace.Text.Trim().ToUpper();
            string str3  = this.tabSpaceDir.Text.Trim();
            string str4  = this.tabSpaceSize.Text.Trim();

            if (!(str == null ? false : !(str == "")))
            {
                MessageBox.Show("用户名不能为空");
            }
            else if (!(str1 == null ? false : !(str1 == "")))
            {
                MessageBox.Show("密码不能为空");
            }
            else if (!(str2 == null ? false : !(str2 == "")))
            {
                MessageBox.Show("Oracle服务名不能为空");
            }
            else if (!(upper == null ? false : !(upper == "")))
            {
                MessageBox.Show("表空间名不能为空");
            }
            else if (!(str3 == null ? false : !(str3 == "")))
            {
                MessageBox.Show("表空间路径不能为空");
            }
            else if ((str4 == null ? false : !(str4 == "")))
            {
                OracleFuctions.CreateTableSpace(str, str1, str2, upper, str3, str4);
            }
            else
            {
                MessageBox.Show("表空间大小不能为空");
            }
        }
示例#11
0
        private void bImportion_Click(object sender, EventArgs e)
        {
            string str  = this.userID.Text.Trim();
            string str1 = this.passWord.Text.Trim();
            string str2 = this.serverName.Text.Trim();
            string str3 = this.importDir.Text.Trim();
            string str4 = this.fromUser.Text.Trim();
            string str5 = this.toUser.Text.Trim();

            if (!(str3 == null ? false : !(str3 == "")))
            {
                MessageBox.Show("导入的数据库文件路径不能为空!");
            }
            else if ((str3.Substring(str3.Length - 1, 1) == "\\"
                ? false
                : !(str3.Substring(str3.Length - 4, 4).ToLower() != ".dmp")))
            {
                OracleFuctions.ImportUsers(str, str1, str2, str3, str4, str5);
            }
            else
            {
                MessageBox.Show("必须输入完整并且正确的数据库文件名!");
            }
        }
示例#12
0
        public static void DeleteUsers(string string_0, string string_1, string string_2, string string_3)
        {
            int i;

            if (!(string_0 == null ? false : !(string_0.Trim() == "")))
            {
                MessageBox.Show("用户名不能为空");
            }
            else if (!(string_1 == null ? false : !(string_1.Trim() == "")))
            {
                MessageBox.Show("用户名密码不能为空");
            }
            else if (!(string_2 == null ? false : !(string_2.Trim() == "")))
            {
                MessageBox.Show("服务名不能为空");
            }
            else if ((string_3 == null ? false : !(string_3.Trim() == "")))
            {
                string    startupPath = "";
                string    str         = "";
                ArrayList arrayLists  = new ArrayList();
                startupPath = Application.StartupPath;
                startupPath = (startupPath.Substring(startupPath.Length - 1, 1) != "\\"
                    ? string.Concat(startupPath, "\\dropUsers.par")
                    : string.Concat(startupPath, "dropUsers.par"));
                ClsReadWriteTxt clsReadWriteTxt = new ClsReadWriteTxt();
                clsReadWriteTxt.DeleteTextFile(startupPath);
                clsReadWriteTxt.CreateTextFile(startupPath);
                arrayLists.Clear();
                arrayLists.Add("disconnect;");
                string[] string0 = new string[] { "connect ", string_0, "/", string_1, "@", string_2, " as sysdba;" };
                arrayLists.Add(string.Concat(string0));
                if ((string_3 == null ? false : string_3 != ""))
                {
                    arrayLists.Add(string.Concat("drop user ", string_3, " cascade;"));
                }
                arrayLists.Add("disconnect;");
                arrayLists.Add("exit;");
                for (i = 0; i < arrayLists.Count; i++)
                {
                    clsReadWriteTxt.AppendTextToFile(startupPath, arrayLists[i].ToString());
                }
                str = Application.StartupPath;
                str = (str.Substring(str.Length - 1, 1) != "\\"
                    ? string.Concat(str, "\\dropUsers.bat")
                    : string.Concat(str, "dropUsers.bat"));
                clsReadWriteTxt = new ClsReadWriteTxt();
                clsReadWriteTxt.DeleteTextFile(str);
                clsReadWriteTxt.CreateTextFile(str);
                arrayLists.Clear();
                arrayLists.Add("@echo off");
                string0 = new string[] { "\"sqlplus\" ", string_0, "/", string_1, "@", string_2, " @", startupPath };
                arrayLists.Add(string.Concat(string0));
                for (i = 0; i < arrayLists.Count; i++)
                {
                    clsReadWriteTxt.AppendTextToFile(str, arrayLists[i].ToString());
                }
                OracleFuctions.ExecuteWindowExe(str, string.Concat("删除用户 ", string_0, " "));
            }
            else
            {
                MessageBox.Show("待删除的用户名不能为空");
            }
        }
示例#13
0
        public static void CreateOracleUsers(string string_0, string string_1, string string_2, string string_3,
                                             string string_4, string string_5)
        {
            int i;

            if (!(string_0 == null ? false : !(string_0.Trim() == "")))
            {
                MessageBox.Show("用户名不能为空");
            }
            else if (!(string_1 == null ? false : !(string_1.Trim() == "")))
            {
                MessageBox.Show("用户名密码不能为空");
            }
            else if (!(string_2 == null ? false : !(string_2.Trim() == "")))
            {
                MessageBox.Show("Oracle服务名不能为空");
            }
            else if (!(string_3 == null ? false : !(string_3.Trim() == "")))
            {
                MessageBox.Show("创建用户名不能为空");
            }
            else if ((string_4 == null ? false : !(string_4.Trim() == "")))
            {
                ArrayList arrayLists  = new ArrayList();
                string    startupPath = "";
                string    str         = "";
                startupPath = Application.StartupPath;
                startupPath = (startupPath.Substring(startupPath.Length - 1, 1) != "\\"
                    ? string.Concat(startupPath, "\\create_kdgis_user.par")
                    : string.Concat(startupPath, "create_kdgis_user.par"));
                ClsReadWriteTxt clsReadWriteTxt = new ClsReadWriteTxt();
                clsReadWriteTxt.DeleteTextFile(startupPath);
                clsReadWriteTxt.CreateTextFile(startupPath);
                arrayLists.Clear();
                if ((string_5 == null ? true : string_5 == ""))
                {
                    string_5 = "SPWORKFLOW";
                }
                OracleFuctions.CallCreateUserParFileConntion(ref arrayLists, string_0, string_1, string_2, string_3,
                                                             string_4, string_5);
                for (i = 0; i < arrayLists.Count; i++)
                {
                    clsReadWriteTxt.AppendTextToFile(startupPath, arrayLists[i].ToString());
                }
                str = Application.StartupPath;
                str = (str.Substring(str.Length - 1, 1) != "\\"
                    ? string.Concat(str, "\\createUsers.bat")
                    : string.Concat(str, "createUsers.bat"));
                clsReadWriteTxt = new ClsReadWriteTxt();
                clsReadWriteTxt.DeleteTextFile(str);
                clsReadWriteTxt.CreateTextFile(str);
                arrayLists.Clear();
                arrayLists.Add("@echo on");
                string[] string0 = new string[]
                { "\"sqlplus\" ", string_0, "/", string_1, "@", string_2, " @", startupPath };
                arrayLists.Add(string.Concat(string0));
                for (i = 0; i < arrayLists.Count; i++)
                {
                    clsReadWriteTxt.AppendTextToFile(str, arrayLists[i].ToString());
                }
                OracleFuctions.ExecuteWindowExe(str, "创建用户成功");
            }
            else
            {
                MessageBox.Show("创建用户名密码不能为空");
            }
        }