Пример #1
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("目标用户名不能为空");
     }
 }
Пример #2
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表空间成功");
        }
Пример #3
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("待删除的用户名不能为空");
            }
        }
Пример #4
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("创建用户名密码不能为空");
            }
        }