コード例 #1
0
ファイル: DBConnectInOracle.cs プロジェクト: chenmj201601/UMP
        /// <summary>
        /// 更新数据库 修改语言
        /// </summary>
        /// <param name="strHost"></param>
        /// <param name="strPort"></param>
        /// <param name="strServiceName"></param>
        /// <param name="strUser"></param>
        /// <param name="strPwd"></param>
        /// <param name="strLanCode"></param>
        /// <param name="strMessageID"></param>
        /// <param name="strDisPaly1"></param>
        /// <param name="strDisPlay2"></param>
        /// <param name="strTip1"></param>
        /// <param name="strTip2"></param>
        /// <param name="strModuleID"></param>
        /// <param name="strChileModuleID"></param>
        /// <param name="strInFrame"></param>
        /// <returns></returns>
        public static ReturnResult UpdateLanguageItem(string strHost, string strPort, string strServiceName, string strUser, string strPwd, string strLanCode
                                                      , string strMessageID, string strDisPaly1, string strDisPlay2, string strTip1, string strTip2)
        {
            ReturnResult     result = new ReturnResult();
            OracleConnection conn   = CreateOracleConn(strHost, strPort, strServiceName, strUser, strPwd);

            try
            {
                OracleCommand com = conn.CreateCommand();
                com.CommandText = "UPDATE T_00_005 SET C005=:pDisPaly1,C006=:pDisPaly2,C007=:pTip1,C008=:pTip2 WHERE C001=TO_NUMBER(:pLanCode) AND C002=:pMessageID";
                com.Parameters.Add("pDisPaly1", OracleDbType.Varchar2).Value = strDisPaly1;
                com.Parameters.Add("pDisPaly2", OracleDbType.Varchar2).Value = strDisPlay2;
                com.Parameters.Add("pTip1", OracleDbType.Varchar2).Value     = strTip1;
                com.Parameters.Add("pTip2", OracleDbType.Varchar2).Value     = strTip2;
                int iLanCode = 1033;
                int.TryParse(strLanCode, out iLanCode);
                //result.ListStringReturn.Add(iLanCode.ToString());
                com.Parameters.Add("pLanCode", OracleDbType.Int16).Value      = iLanCode;
                com.Parameters.Add("pMessageID", OracleDbType.Varchar2).Value = strMessageID;
                conn.Open();
                result.StringReturn = com.ExecuteNonQuery().ToString();
                conn.Close();
                result.BoolReturn = true;
            }
            catch (Exception ex)
            {
                result.BoolReturn   = false;
                result.StringReturn = ex.Message;
            }
            finally
            {
                if (conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: DBConnectInOracle.cs プロジェクト: chenmj201601/UMP
        /// <summary>
        /// </summary>
        /// <param name="strType">数据库对象名</param>
        /// <param name="strName">数据库对象类型</param>
        /// <returns></returns>
        public static ReturnResult CreateDatabaseObject(string strType, string strName)
        {
            ReturnResult result = new ReturnResult();

            return(result);
        }
コード例 #3
0
ファイル: DBConnectInOracle.cs プロジェクト: chenmj201601/UMP
        /// <summary>
        /// 获得所有数据库对象(表、函数、存储过程)
        /// </summary>
        /// <returns></returns>
        public static ReturnResult GetAllDBObjects()
        {
            ReturnResult result = new ReturnResult();

            try
            {
                string        strPath         = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"App_Data\DBScripts\Oracle";
                DirectoryInfo lstDBScriptsDir = new DirectoryInfo(strPath);
                if (lstDBScriptsDir == null)
                {
                    result.BoolReturn   = false;
                    result.StringReturn = "Error017";
                }
                List <DirectoryInfo> lstChilds = lstDBScriptsDir.GetDirectories().ToList();
                DataTable            dt        = new DataTable();
                dt.TableName = "ScriptFilesInfo";
                dt.Columns.Add(new DataColumn("FileName"));
                dt.Columns.Add(new DataColumn("DataObjectype"));
                List <FileInfo> lstChildFiles = null;
                string          strSub        = string.Empty;
                for (int i = 0; i < lstChilds.Count; i++)
                {
                    lstChildFiles = lstChilds[i].GetFiles().ToList();
                    strSub        = lstChilds[i].Name.Substring(0, lstChilds[i].Name.IndexOf('-'));
                    DataRow row = null;
                    switch (strSub)
                    {
                    case "1":
                        for (int j = 0; j < lstChildFiles.Count; j++)
                        {
                            row    = dt.NewRow();
                            row[0] = lstChildFiles[j].Name;
                            row[1] = "Table";
                            dt.Rows.Add(row);
                        }
                        break;

                    case "2":
                        for (int j = 0; j < lstChildFiles.Count; j++)
                        {
                            row    = dt.NewRow();
                            row[0] = lstChildFiles[j].Name;
                            row[1] = "Function";
                            dt.Rows.Add(row);
                        }
                        break;

                    case "3":
                        for (int j = 0; j < lstChildFiles.Count; j++)
                        {
                            row    = dt.NewRow();
                            row[0] = lstChildFiles[j].Name;
                            row[1] = "3-Procedure";
                            dt.Rows.Add(row);
                        }
                        break;

                    default:
                        result.StringReturn = strSub;
                        break;
                    }
                }
                result.DataSetReturn.Tables.Add(dt);
                result.BoolReturn = true;
            }
            catch (Exception ex)
            {
                result.BoolReturn   = false;
                result.StringReturn = ex.Message;
            }
            return(result);
        }