Exemplo n.º 1
0
        /// <summary>
        /// 获取所有资源类型
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0:数据库类型
        /// 1:数据库连接串
        /// 2:租户编码
        /// </param>
        /// <returns></returns>
        private OperationDataArgs11111 OperationA01(List <string> AListStringArgs)
        {
            OperationDataArgs11111 LOperationReturn = new OperationDataArgs11111();
            string LStrDynamicSQL = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01          LDataOperations01          = new DataOperations01();

                LStrDynamicSQL             = "SELECT * FROM T_00_010";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(int.Parse(AListStringArgs[0]), AListStringArgs[1], LStrDynamicSQL);
                if (LDatabaseOperation01Return.BoolReturn)
                {
                    LOperationReturn.DataSetReturn = LDatabaseOperation01Return.DataSetReturn;
                    LOperationReturn.StringReturn  = LDatabaseOperation01Return.StrReturn;
                }
                else
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = LDatabaseOperation01Return.StrReturn;
                }
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = ex.ToString();
            }

            return(LOperationReturn);
        }
Exemplo n.º 2
0
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            DataOperations01          LDataOperation     = new DataOperations01();
            DatabaseOperation01Return LDBOperationReturn = new DatabaseOperation01Return();

            //LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(3, "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.4.182) (PORT=1521)))(CONNECT_DATA=(SERVICE_NAME= PFOrcl)));User Id=PFDEV; Password=PF,123", 11, 901, "00000", DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
            LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(2, "Data Source=192.168.4.186,1433;Initial Catalog=UMPDataDB;User Id=PFDEV;Password=PF,123", 11, 901, "00000", DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
        }
Exemplo n.º 3
0
        private void IBackgroundWorkerApplyAdminStatus_DoWork(object sender, DoWorkEventArgs e)
        {
            List <string> LListStrResetObject = e.Argument as List <string>;
            string        LStrRentToken       = IDataRowRentInfo["C021"].ToString();

            List <string> LListStrResetReturn = new List <string>();

            string LStrConnectParam = string.Empty;
            string LStrDynamicSQL = string.Empty;
            string LStrDBType = string.Empty, LStrServerName = string.Empty, LStrServerPort = string.Empty, LStrLoginAccount = string.Empty, LStrLoginPwd = string.Empty, LStrDBOrServiceName = string.Empty;

            DatabaseOperation01Return LDatabaseOperation = new DatabaseOperation01Return();
            DataOperations01          LDataOperations01 = new DataOperations01();

            LStrDBType          = IDataTableDatabaseProfile.Rows[0]["DBType"].ToString();
            LStrServerName      = IDataTableDatabaseProfile.Rows[0]["ServerHost"].ToString();
            LStrServerPort      = IDataTableDatabaseProfile.Rows[0]["ServerPort"].ToString();
            LStrLoginAccount    = IDataTableDatabaseProfile.Rows[0]["LoginID"].ToString();
            LStrLoginPwd        = IDataTableDatabaseProfile.Rows[0]["LoginPwd"].ToString();
            LStrDBOrServiceName = IDataTableDatabaseProfile.Rows[0]["NameService"].ToString();

            if (LStrDBType == "2")
            {
                LStrConnectParam = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", LStrServerName, LStrServerPort, LStrDBOrServiceName, LStrLoginAccount, LStrLoginPwd);
            }
            if (LStrDBType == "3")
            {
                LStrConnectParam = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", LStrServerName, LStrServerPort, LStrDBOrServiceName, LStrLoginAccount, LStrLoginPwd);
            }

            if (!string.IsNullOrEmpty(LListStrResetObject[0]))
            {
                if (LListStrResetObject[0] == "U")
                {
                    LStrDynamicSQL = "UPDATE T_11_005_" + LStrRentToken + " SET C008 = '1', C009 = '" + LListStrResetObject[0] + "' WHERE C001 = 102" + LStrRentToken + "00000000001";
                }
                else
                {
                    LStrDynamicSQL = "UPDATE T_11_005_" + LStrRentToken + " SET C008 = '0', C009 = '" + LListStrResetObject[0] + "', C024 = 0 WHERE C001 = 102" + LStrRentToken + "00000000001";
                }
                LDatabaseOperation = LDataOperations01.SelectDataByDynamicSQL(int.Parse(LStrDBType), LStrConnectParam, LStrDynamicSQL);
                if (!LDatabaseOperation.BoolReturn)
                {
                    LListStrResetReturn.Add(LListStrResetObject[0]);
                }
            }
            if (!string.IsNullOrEmpty(LListStrResetObject[1]))
            {
                LStrDynamicSQL     = "UPDATE T_11_002_" + LStrRentToken + " SET C008 = '1' WHERE C001 = 102" + LStrRentToken + "00000000001";
                LDatabaseOperation = LDataOperations01.SelectDataByDynamicSQL(int.Parse(LStrDBType), LStrConnectParam, LStrDynamicSQL);
                if (!LDatabaseOperation.BoolReturn)
                {
                    LListStrResetReturn.Add(LListStrResetObject[1]);
                }
            }
            e.Result = LListStrResetReturn;
        }
Exemplo n.º 4
0
        private void DeleteCompleteEncryptionData()
        {
            string LStrDynamicSQL = string.Empty;
            string LStr21998001 = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DatabaseOperation01Return LDatabaseOperation02Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();

                while (IBoolCanContinue)
                {
                    if (IIntDatabaseType == 0 || string.IsNullOrEmpty(IStrDatabaseProfile)) { IBoolInDeleteEncryption = false; Thread.Sleep(2000); continue; }

                    IBoolInDeleteEncryption = true;
                    if (IIntDatabaseType == 2)
                    {
                        LStrDynamicSQL = "SELECT TOP 500 C001 FROM T_21_998 WHERE C019 <> 'E'";
                    }
                    else
                    {
                        LStrDynamicSQL = "SELECT * FROM T_21_998 WHERE C019 <> 'E' AND ROWNUM <= 500";
                    }

                    LDatabaseOperation02Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                    if (LDatabaseOperation02Return.BoolReturn)
                    {
                        foreach (DataRow LDataRowSingleRow in LDatabaseOperation02Return.DataSetReturn.Tables[0].Rows)
                        {
                            LStr21998001 = LDataRowSingleRow["C001"].ToString();
                            LStrDynamicSQL = "DELETE FROM T_21_998 WHERE C001 = '" + LStr21998001 + "'";
                            LDatabaseOperation01Return = LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                            if (!LDatabaseOperation01Return.BoolReturn)
                            {
                                WriteEntryLog("DeleteCompleteEncryptionData()\n" + LDatabaseOperation01Return.StrReturn, EventLogEntryType.Error);
                            }
                        }
                    }
                    System.Threading.Thread.Sleep(1500);
                    IBoolInDeleteEncryption = false;
                    IBoolCanAbortDeleteEncryption = true;
                }
                IBoolInDeleteEncryption = false;
                IBoolCanAbortDeleteEncryption = true;
            }
            catch (Exception ex)
            {
                IBoolInDeleteEncryption = false;
                IBoolCanAbortDeleteEncryption = true;
                WriteEntryLog("DeleteCompleteEncryptionData()\n" + ex.ToString(), EventLogEntryType.Error);
            }
            
        }
Exemplo n.º 5
0
        private long GetSerialIDByType(int AIntDBType, string AStrDBProfile, string AStrRentToken, int AIntModule, int AIntType)
        {
            long LLongSerialID = 0;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();
                LDatabaseOperation01Return = LDataOperations01.GetSerialNumberByProcedure(AIntDBType, AStrDBProfile, AIntModule, AIntType, AStrRentToken, "20140101000000");
                if (!LDatabaseOperation01Return.BoolReturn) { LLongSerialID = 0; }
                else { LLongSerialID = long.Parse(LDatabaseOperation01Return.StrReturn); }
            }
            catch { LLongSerialID = 0; }

            return LLongSerialID;
        }
Exemplo n.º 6
0
        private long GetSerialIDByType(List<string> AListStringArgs, int AIntModule, int AIntType)
        {
            long LLongSerialID = 0;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();
                LDatabaseOperation01Return = LDataOperations01.GetSerialNumberByProcedure(int.Parse(AListStringArgs[0]), AListStringArgs[1], AIntModule, AIntType, AListStringArgs[2], "20140101000000");
                if (!LDatabaseOperation01Return.BoolReturn) { LLongSerialID = 0; }
                else { LLongSerialID = long.Parse(LDatabaseOperation01Return.StrReturn); }
            }
            catch { LLongSerialID = 0; }

            return LLongSerialID;
        }
Exemplo n.º 7
0
        private long GetSerialIDByType(string AStrC000, int AIntDBType, string AStrDBProfile, string AStrRentToken, int AIntModule, int AIntType, string AStrTime)
        {
            long LLongSerialID = 0;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();
                LDatabaseOperation01Return = LDataOperations01.GetSerialNumberByProcedure(AIntDBType, AStrDBProfile, AIntModule, AIntType, AStrRentToken, AStrTime);
                if (!LDatabaseOperation01Return.BoolReturn) { LLongSerialID = 0; }
                else { LLongSerialID = long.Parse(LDatabaseOperation01Return.StrReturn); }
                //WriteEntryLog("GetSerialIDByType()\n" + LDatabaseOperation01Return.StrReturn, EventLogEntryType.Warning);
            }
            catch (Exception ex)
            {
                LLongSerialID = 0;
                WriteEntryLog("GetSerialIDByType()\nC000 = " + AStrC000 + "\nTime = " + AStrTime + "\n" + ex.ToString(), EventLogEntryType.Error);
            }

            return LLongSerialID;
        }
Exemplo n.º 8
0
 private void RunDataDelete(string strSql, string tableName)
 {
     try
     {
         DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
         DataOperations01          LDataOperations          = new DataOperations01();
         LDatabaseOperationReturn = LDataOperations.ExecuteDynamicSQL(IDatabaseConfig.IntDatabaseType, IDatabaseConfig.StrDatabaseProfile, strSql);
         if (!LDatabaseOperationReturn.BoolReturn)
         {
             FileLog.WriteInfo("DeleteData(),Error", strSql);
             return;
         }
         if (!string.IsNullOrWhiteSpace(LDatabaseOperationReturn.StrReturn) && Convert.ToInt32(LDatabaseOperationReturn.StrReturn) > 0)
         {
             FileLog.WriteInfo(string.Format("DeleteData({0})", tableName), LDatabaseOperationReturn.StrReturn);
         }
     }
     catch (Exception ex)
     {
         FileLog.WriteInfo("DeleteData()", "Error :" + ex.Message);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 根据资源ID获取资源信息
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0:数据库类型
        /// 1:数据库连接串
        /// 2:租户编码
        /// 3:资源ID编码(3位数)</param>
        /// <returns></returns>
        private OperationDataArgs11111 OperationA02(List <string> AListStringArgs)
        {
            OperationDataArgs11111 LOperationReturn = new OperationDataArgs11111();
            string LStrDynamicSQL = string.Empty;
            int    LIntTypeID = 0;
            string LStrIDBegin = string.Empty, LStrIDEnd = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01          LDataOperations01          = new DataOperations01();

                LIntTypeID                 = int.Parse(AListStringArgs[3]);
                LStrIDBegin                = LIntTypeID.ToString() + "0000000000000001";
                LStrIDEnd                  = (LIntTypeID + 1).ToString() + "0000000000000000";
                LStrDynamicSQL             = "SELECT * FROM T_11_101_" + AListStringArgs[2] + " WHERE C001 >= " + LStrIDBegin + " AND C001 < " + LStrIDEnd + " ORDER BY C001 ASC";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(int.Parse(AListStringArgs[0]), AListStringArgs[1], LStrDynamicSQL);
                if (LDatabaseOperation01Return.BoolReturn)
                {
                    LOperationReturn.DataSetReturn = LDatabaseOperation01Return.DataSetReturn;
                    LOperationReturn.StringReturn  = LDatabaseOperation01Return.StrReturn;
                }
                else
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = LDatabaseOperation01Return.StrReturn;
                }
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = ex.ToString();
            }

            return(LOperationReturn);
        }
Exemplo n.º 10
0
        public OperationsReturn GetParameterSettedValue(int AIntDBType, string AStrDBConnectProfile, string AStrRentToken, string AStrParameterID)
        {
            OperationsReturn LClassReturn = new OperationsReturn();

            string LStrDynamicSQL          = string.Empty;
            string LStrVerificationCode102 = string.Empty;
            string LStr11001006            = string.Empty;

            try
            {
                DataOperations01          LDataOperations  = new DataOperations01();
                DatabaseOperation01Return LOperationReturn = new DatabaseOperation01Return();

                LStrVerificationCode102 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M102);

                LStrDynamicSQL         = "SELECT C006 FROM T_11_001_" + AStrRentToken + " WHERE C003 = " + AStrParameterID;
                LOperationReturn       = LDataOperations.SelectDataByDynamicSQL(AIntDBType, AStrDBConnectProfile, LStrDynamicSQL);
                LClassReturn.StrReturn = LOperationReturn.StrReturn;
                if (!LOperationReturn.BoolReturn)
                {
                    LClassReturn.BoolReturn = false;
                    return(LClassReturn);
                }
                LStr11001006           = LOperationReturn.DataSetReturn.Tables[0].Rows[0][0].ToString();
                LStr11001006           = EncryptionAndDecryption.EncryptDecryptString(LStr11001006, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                LStr11001006           = LStr11001006.Substring(8);
                LClassReturn.StrReturn = LStr11001006;
            }
            catch (Exception ex)
            {
                LClassReturn.BoolReturn = false;
                LClassReturn.StrReturn  = "GlobalParametersOperations.GetParameterSettedValue()\n" + ex.ToString();
            }

            return(LClassReturn);
        }
Exemplo n.º 11
0
        private bool AtServerWriteLogicPartionSetting2Database(string AStr00000001)
        {
            bool   LBooReturn = true;
            string LStrSetted = string.Empty;
            string LStrDBType = string.Empty;
            string LStrServerName = string.Empty, LStrServerPort = string.Empty, LStrLoginID = string.Empty, LStrLoginPwd = string.Empty;
            string LStrServiceName  = string.Empty;
            string LStrDepentColumn = string.Empty;

            string LStrConnectParam = string.Empty;
            string LStrDynamicSQL   = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation = new DatabaseOperation01Return();
                DataOperations01          LDataOperations01  = new DataOperations01();

                #region 创建数据库连接串
                LStrDBType      = IDataTableDatabaseProfile.Rows[0]["DBType"].ToString();
                LStrServerName  = IDataTableDatabaseProfile.Rows[0]["ServerHost"].ToString();
                LStrServerPort  = IDataTableDatabaseProfile.Rows[0]["ServerPort"].ToString();
                LStrLoginID     = IDataTableDatabaseProfile.Rows[0]["LoginID"].ToString();
                LStrLoginPwd    = IDataTableDatabaseProfile.Rows[0]["LoginPwd"].ToString();
                LStrServiceName = IDataTableDatabaseProfile.Rows[0]["NameService"].ToString();
                if (LStrDBType == "2")
                {
                    LStrConnectParam = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", LStrServerName, LStrServerPort, LStrServiceName, LStrLoginID, LStrLoginPwd);
                }
                else
                {
                    LStrConnectParam = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", LStrServerName, LStrServerPort, LStrServiceName, LStrLoginID, LStrLoginPwd);
                }
                #endregion

                #region 将设置数据写入数据库
                LStrSetted       = IDataRowLogicPartition["S00"].ToString();
                LStrDepentColumn = IDataRowLogicPartition["P03"].ToString();
                if (LStrSetted == "0")
                {
                    if (LStrDBType == "2")
                    {
                        LStrDynamicSQL = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005, C006, C007, C008) VALUES('" + IStrRentToken + "', '" + AStr00000001 + "', '" + App.GStrApplicationVersion + "', 'LP', '" + IStrSettedStatus + "', GETUTCDATE(), GETUTCDATE(), '1', '" + LStrDepentColumn + "')";
                    }
                    else
                    {
                        LStrDynamicSQL = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005, C006, C007, C008) VALUES('" + IStrRentToken + "', '" + AStr00000001 + "', '" + App.GStrApplicationVersion + "', 'LP', '" + IStrSettedStatus + "', F_00_004(), F_00_004(), '1', '" + LStrDepentColumn + "')";
                    }
                }
                else
                {
                    if (LStrDBType == "2")
                    {
                        LStrDynamicSQL = "UPDATE T_00_000 SET C004 = '" + IStrSettedStatus + "', C006 = GETUTCDATE() WHERE C000 = '" + IStrRentToken + "' AND C001 = '" + AStr00000001 + "'";
                    }
                    else
                    {
                        LStrDynamicSQL = "UPDATE T_00_000 SET C004 = '" + IStrSettedStatus + "', C006 = F_00_004() WHERE C000 = '" + IStrRentToken + "' AND C001 = '" + AStr00000001 + "'";
                    }
                }

                LDatabaseOperation = LDataOperations01.ExecuteDynamicSQL(int.Parse(LStrDBType), LStrConnectParam, LStrDynamicSQL);
                LBooReturn         = LDatabaseOperation.BoolReturn;
                IStrApplyReturn    = LDatabaseOperation.StrReturn;
                #endregion

                #region 从数据库中读取新的设置信息
                LStrDynamicSQL              = "SELECT * FROM T_00_000 WHERE C000 = '" + IStrRentToken + "' AND C001 = '" + AStr00000001 + "'";
                LDatabaseOperation          = LDataOperations01.SelectDataByDynamicSQL(int.Parse(LStrDBType), LStrConnectParam, LStrDynamicSQL);
                IDataTableNewLogicPartition = LDatabaseOperation.DataSetReturn.Tables[0];
                #endregion
            }
            catch (Exception ex)
            {
                LBooReturn      = false;
                IStrApplyReturn = "AtServerWriteLogicPartionSetting2Database()\n" + ex.ToString();
            }

            return(LBooReturn);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 写入操作日志
        /// </summary>
        /// <param name="AListStrOperationInfo">
        /// 0:客户端SessionID
        /// 1:模块ID                      2:功能操作编号                3:租户Token(5位)          4:操作用户ID
        /// 5:当前操作角色                6:机器名                      7:机器IP                    8:操作时间 UTC
        /// 9:操作结果                    10:操作内容对应的语言包ID     11:替换参数                 12:异常错误
        /// </param>
        /// <param name="AStrReturnCode"></param>
        /// <param name="AStrReturnMessage"></param>
        /// <returns></returns>
        public bool S01BOperation01(List <string> AListStrOperationInfo, ref string AStrReturnCode, ref string AStrReturnMessage)
        {
            bool             LBoolReturn             = true;
            string           LStrVerificationCode004 = string.Empty;
            string           LStrVerificationCode104 = string.Empty;
            SqlConnection    LSqlConnection          = null;
            OracleConnection LOracleConnection       = null;
            string           LStrSelectSQL           = string.Empty;
            List <string>    LListStrReplaceArgs     = new List <string>();
            List <string>    LListStrException       = new List <string>();

            try
            {
                #region 局部变量初始化、定义
                LStrVerificationCode004 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                DataOperations01          LDataOperation     = new DataOperations01();
                DatabaseOperation01Return LDBOperationReturn = new DatabaseOperation01Return();
                #endregion

                #region 获取操作日志流水号
                string LStrOperationSerialID = string.Empty;
                if (AListStrOperationInfo[1] == "11000")
                {
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(IIntDBType, IStrDBConnectProfile, 11, 901, AListStrOperationInfo[3], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                }
                else
                {
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(IIntDBType, IStrDBConnectProfile, 11, 902, AListStrOperationInfo[3], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                }
                if (!LDBOperationReturn.BoolReturn)
                {
                    //系统分配操作日志流水号失败
                    AStrReturnCode    = EncryptionAndDecryption.EncryptDecryptString("E01B01", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    AStrReturnMessage = LDBOperationReturn.StrReturn;
                    return(false);
                }
                else
                {
                    LStrOperationSerialID = LDBOperationReturn.StrReturn;
                }
                #endregion

                #region 拆分替换参数和异常出错
                string LStrReplaceArgs = string.Empty;
                string LStrException   = string.Empty;
                LStrReplaceArgs = AListStrOperationInfo[11];
                LStrException   = AListStrOperationInfo[12];
                while (LStrReplaceArgs.Length > 1024)
                {
                    LListStrReplaceArgs.Add(LStrReplaceArgs.Substring(0, 1024));
                    LStrReplaceArgs = LStrReplaceArgs.Substring(1024);
                }
                if (!string.IsNullOrEmpty(LStrReplaceArgs))
                {
                    LListStrReplaceArgs.Add(LStrReplaceArgs);
                }
                while (LListStrReplaceArgs.Count < 5)
                {
                    LListStrReplaceArgs.Add("");
                }

                while (LStrException.Length > 1024)
                {
                    LListStrException.Add(LStrException.Substring(0, 1024));
                    LStrException = LStrException.Substring(1024);
                }
                if (!string.IsNullOrEmpty(LStrException))
                {
                    LListStrException.Add(LStrException);
                }
                while (LListStrException.Count < 5)
                {
                    LListStrException.Add("");
                }
                #endregion

                #region 将日志写入DataSet中
                //LStrSelectSQL = "SELECT * FROM T_11_901_" + AListStrOperationInfo[3] + " WHERE 1 = 2";
                LStrSelectSQL      = "SELECT * FROM T_11_901 WHERE 1 = 2";
                LDBOperationReturn = LDataOperation.SelectDataByDynamicSQL(IIntDBType, IStrDBConnectProfile, LStrSelectSQL);
                DataSet LDataSetSave2DB = LDBOperationReturn.DataSetReturn;
                LDataSetSave2DB.Tables[0].TableName = "T_11_901";
                DataRow LDataRowNewLog = LDataSetSave2DB.Tables[0].NewRow();
                LDataRowNewLog.BeginEdit();
                LDataRowNewLog["C001"] = long.Parse(LStrOperationSerialID);
                LDataRowNewLog["C002"] = long.Parse(AListStrOperationInfo[0]);
                LDataRowNewLog["C003"] = Int16.Parse(AListStrOperationInfo[1]);
                LDataRowNewLog["C004"] = long.Parse(AListStrOperationInfo[2]);
                LDataRowNewLog["C005"] = long.Parse(AListStrOperationInfo[4]);
                LDataRowNewLog["C006"] = AListStrOperationInfo[6];
                LDataRowNewLog["C007"] = AListStrOperationInfo[7];
                LDataRowNewLog["C008"] = long.Parse((DateTime.Parse(AListStrOperationInfo[8])).ToString("yyyyMMddHHmmss"));
                LDataRowNewLog["C009"] = AListStrOperationInfo[9];
                LDataRowNewLog["C010"] = AListStrOperationInfo[10];
                LDataRowNewLog["C011"] = LListStrReplaceArgs[0];
                LDataRowNewLog["C012"] = LListStrReplaceArgs[1];
                LDataRowNewLog["C013"] = LListStrReplaceArgs[2];
                LDataRowNewLog["C014"] = LListStrReplaceArgs[3];
                LDataRowNewLog["C015"] = LListStrReplaceArgs[4];
                LDataRowNewLog["C016"] = LListStrException[0];
                LDataRowNewLog["C017"] = LListStrException[1];
                LDataRowNewLog["C018"] = LListStrException[2];
                LDataRowNewLog["C019"] = LListStrException[3];
                LDataRowNewLog["C020"] = LListStrException[4];
                LDataRowNewLog["C021"] = long.Parse(AListStrOperationInfo[5]);
                LDataRowNewLog["C022"] = AListStrOperationInfo[3];
                LDataRowNewLog.EndEdit();
                LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewLog);
                #endregion

                #region 将操作日志写入MSSQL数据库
                if (IIntDBType == 2)
                {
                    LSqlConnection = new SqlConnection(IStrDBConnectProfile);
                    SqlDataAdapter    LSqlDataAdapter    = new SqlDataAdapter(LStrSelectSQL, LSqlConnection);
                    SqlCommandBuilder LSqlCommandBuilder = new SqlCommandBuilder();

                    LSqlCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LSqlCommandBuilder.SetAllValues   = false;
                    LSqlCommandBuilder.DataAdapter    = LSqlDataAdapter;
                    LSqlDataAdapter.Update(LDataSetSave2DB, "T_11_901");
                    LDataSetSave2DB.AcceptChanges();
                    LSqlCommandBuilder.Dispose();
                    LSqlDataAdapter.Dispose();
                }
                #endregion

                #region 将操作日志写入Oracle数据库
                if (IIntDBType == 3)
                {
                    LOracleConnection = new OracleConnection(IStrDBConnectProfile);
                    OracleDataAdapter    LOracleDataAdapter    = new OracleDataAdapter(LStrSelectSQL, LOracleConnection);
                    OracleCommandBuilder LOracleCommandBuilder = new OracleCommandBuilder();

                    LOracleCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LOracleCommandBuilder.SetAllValues   = false;
                    LOracleCommandBuilder.DataAdapter    = LOracleDataAdapter;
                    LOracleDataAdapter.Update(LDataSetSave2DB, "T_11_901");
                    LDataSetSave2DB.AcceptChanges();
                    LOracleCommandBuilder.Dispose();
                    LOracleDataAdapter.Dispose();
                }
                #endregion
            }
            catch (Exception ex)
            {
                LBoolReturn       = false;
                AStrReturnCode    = EncryptionAndDecryption.EncryptDecryptString("E01B99", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                AStrReturnMessage = "S01BOperations.S01BOperation01()\n" + ex.Message;
            }
            finally
            {
                if (LSqlConnection != null)
                {
                    if (LSqlConnection.State == System.Data.ConnectionState.Open)
                    {
                        LSqlConnection.Close();
                    }
                    LSqlConnection.Dispose();
                }
                if (LOracleConnection != null)
                {
                    if (LOracleConnection.State == ConnectionState.Open)
                    {
                        LOracleConnection.Close();
                    }
                    LOracleConnection.Dispose(); LOracleConnection = null;
                }
            }

            return(LBoolReturn);
        }
Exemplo n.º 13
0
        private void ActionSynchronousExtensionData()
        {
            string LStrDynamicSQL = string.Empty;
            string LStrTemp = string.Empty;
            string LStrUserDefaultPwd = string.Empty;
            string LStrVerificationCode002 = string.Empty;
            string LStrVerificationCode102 = string.Empty;
            string LStrDataTimeNow = string.Empty;
            string LStrDataID = string.Empty;
            SqlConnection LSqlConnection = null;
            OracleConnection LOracleConnection = null;

            string LStr11101001 = string.Empty;
            string LStr11101002 = string.Empty;
            string LStr11101012 = string.Empty;
            string LStr11101013 = string.Empty;
            string LStr11101014 = string.Empty;
            string LStr11101015 = string.Empty;
            string LStr11101017 = string.Empty;

            string LStrStep = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();

                LStrVerificationCode002 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M002);
                LStrVerificationCode102 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M102);

                #region 获取租户列表
                LStrDynamicSQL = "SELECT * FROM T_00_121 ORDER BY C001";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);

                //租户列表
                DataSet LDataSet00121 = LDatabaseOperation01Return.DataSetReturn;
                #endregion

                #region 获取所有录音服务器和录音、录屏通道
                List<string> LListStrServerRentInfo = new List<string>();

                LStrDynamicSQL = "SELECT * FROM T_11_101_00000 WHERE (C001 > 2210000000000000000 AND C001 < 2220000000000000000 AND C002 = 1) OR (C001 > 2310000000000000000 AND C001 < 2320000000000000000 AND C002 = 1)";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                //所有录音录屏服务器
                DataSet LDataSet11101AllLGServer = LDatabaseOperation01Return.DataSetReturn;
                foreach (DataRow LDataRowSingleServer in LDataSet11101AllLGServer.Tables[0].Rows)
                {
                    LStr11101001 = LDataRowSingleServer["C001"].ToString();
                    LStr11101017 = LDataRowSingleServer["C017"].ToString();
                    LStr11101017 = LStr11101017.Substring(9);
                    LStr11101017 = EncryptionAndDecryption.EncryptDecryptString(LStr11101017, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LDataRowSingleServer["C017"] = LStr11101017;
                    //服务器19位编码 + char(27) + 服务器IP + char(27) + "未被分配"
                    LListStrServerRentInfo.Add(LStr11101001 + IStrSpliterChar + LStr11101017 + IStrSpliterChar + "0");
                }

                LStrDynamicSQL = "SELECT * FROM T_11_101_00000 WHERE (C001 > 2250000000000000000 AND C001 < 2260000000000000000 AND (C002 = 1 OR C002 = 2)) OR (C001 > 2320000000000000000 AND C001 < 2330000000000000000 AND (C002 = 1 OR C002 = 2)) ORDER BY C001, C002";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                //所有录音录屏通道
                DataSet LDataSet11101AllLGChannel = LDatabaseOperation01Return.DataSetReturn;
                for (int LIntLoopChannel = 0; LIntLoopChannel < LDataSet11101AllLGChannel.Tables[0].Rows.Count; LIntLoopChannel++)
                {
                    //C001:通道编码 19 位
                    //C012:通道ID 0~2000
                    //C013:录音服务器IP
                    //C014:分机号
                    //C015:通道名
                    LStr11101002 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C002"].ToString();
                    if (LStr11101002 == "1")
                    {
                        LStr11101013 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C013"].ToString();
                        DataRow[] LDataRowArray = LDataSet11101AllLGServer.Tables[0].Select("C001 = " + LStr11101013);
                        LStr11101017 = LDataRowArray[0]["C017"].ToString();
                        LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C017"] = LStr11101017;
                    }
                    if (LStr11101002 == "2")
                    {
                        LStr11101001 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C001"].ToString();
                        LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel - 1]["C014"] = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C012"].ToString();
                        if (LStr11101001.Substring(0, 3) == "225")
                        {
                            LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel - 1]["C015"] = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C011"].ToString();
                        }
                    }
                }

                #endregion

                #region 获取租户租用的服务器
                string LStrRentBegin = string.Empty, LStrRentEnd = string.Empty;
                string LStr11201004 = string.Empty;

                List<string> LListStrRentToken = new List<string>();
                List<List<string>> LListListRentServer = new List<List<string>>();

                foreach (DataRow LDataRowSingleRent in LDataSet00121.Tables[0].Rows)
                {
                    LStrRentBegin = LDataRowSingleRent["C011"].ToString();
                    LStrRentEnd = LDataRowSingleRent["C012"].ToString();
                    LStrRentBegin = EncryptionAndDecryption.EncryptDecryptString(LStrRentBegin, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrRentEnd = EncryptionAndDecryption.EncryptDecryptString(LStrRentEnd, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);

                    LStrTemp = LDataRowSingleRent["C021"].ToString();
                    LStrTemp = EncryptionAndDecryption.EncryptDecryptString(LStrTemp, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrDataID = LDataRowSingleRent["C001"].ToString();

                    //租户Token + char(27) + 租户19位编码
                    LListStrRentToken.Add(LStrTemp + IStrSpliterChar + LStrDataID);

                    List<string> LListStrRentServerInfo = new List<string>();

                    if (DateTime.Parse(LStrRentBegin) <= DateTime.UtcNow && DateTime.Parse(LStrRentEnd) >= DateTime.UtcNow)
                    {
                        LStrDynamicSQL = "SELECT * FROM T_11_201_" + LStrTemp + " WHERE C003 = " + LStrDataID + " AND ((C004 > 2210000000000000000 AND C004 < 2220000000000000000) OR (C004 > 2310000000000000000 AND C004 < 2320000000000000000))";
                        LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);

                        foreach (DataRow LDataRowRentSingleServer in LDatabaseOperation01Return.DataSetReturn.Tables[0].Rows)
                        {
                            LStr11201004 = LDataRowRentSingleServer["C004"].ToString();
                            DataRow[] LDataRowArray = LDataSet11101AllLGServer.Tables[0].Select("C001 = " + LStr11201004);
                            if (LDataRowArray.Length > 0)
                            {
                                LStr11101017 = LDataRowArray[0]["C017"].ToString();
                                //服务器19位编码 + char(27) + 服务器IP
                                LListStrRentServerInfo.Add(LStr11201004 + IStrSpliterChar + LStr11101017);
                            }
                        }
                    }
                    LListListRentServer.Add(LListStrRentServerInfo);
                }
                #endregion

                #region 将未分配给租户的服务器全部分配给顶级租户

                for (int LIntLoopServer = 0; LIntLoopServer < LListStrServerRentInfo.Count; LIntLoopServer++)
                {
                    foreach (List<string> LListStrRentServerInfo in LListListRentServer)
                    {
                        foreach (string LStrsingleServer in LListStrRentServerInfo)
                        {
                            if ((LStrsingleServer + IStrSpliterChar + "0") == LListStrServerRentInfo[LIntLoopServer])
                            {
                                string[] LStrArrayTemp = LStrsingleServer.Split(IStrSpliterChar.ToCharArray());
                                LListStrServerRentInfo[LIntLoopServer] = LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1] + IStrSpliterChar + "1";
                            }
                        }
                    }
                }

                foreach (string LStrUnRentServer in LListStrServerRentInfo)
                {
                    string[] LStrArrayTemp = LStrUnRentServer.Split(IStrSpliterChar.ToCharArray());
                    if (LStrArrayTemp[2] == "0")
                    {
                        //List<string> LListTemp = new List<string>();
                        //LListTemp.Add(LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1]);
                        LListListRentServer[0].Add(LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1]);
                    }
                }
                #endregion

                #region 检查租户分机资源是否在原始配置资源中,如果不在,则从表中删除
                bool LBoolRented = false;
                List<string> LListStrRentServers = new List<string>();
                for (int LIntLoopRent = 0; LIntLoopRent < LListStrRentToken.Count; LIntLoopRent++)
                {
                    LListStrRentServers.Clear();
                    string[] LStrRentBasicArray = LListStrRentToken[LIntLoopRent].Split(IStrSpliterChar.ToCharArray());
                    foreach (string LStrRentServices in LListListRentServer[LIntLoopRent])
                    {
                        string[] LStrServerArray = LStrRentServices.Split(IStrSpliterChar.ToCharArray());
                        LListStrRentServers.Add(LStrServerArray[1]);
                    }
                    LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 > 1040000000000000000 AND C001 < 1050000000000000000 AND C002 = 1";
                    LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                    if (!LDatabaseOperation01Return.BoolReturn) { continue; }
                    foreach (DataRow LDataRowSingleChannel in LDatabaseOperation01Return.DataSetReturn.Tables[0].Rows)
                    {
                        LStr11101001 = LDataRowSingleChannel["C001"].ToString();
                        LStr11101017 = LDataRowSingleChannel["C017"].ToString();
                        LStrStep = LStr11101017;
                        LStr11101017 = EncryptionAndDecryption.EncryptDecryptString(LStr11101017, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        string[] LStrExtensionServerIP = LStr11101017.Split(IStrSpliterChar.ToCharArray());
                        if (LStrExtensionServerIP.Length < 2)
                        {
                            //WriteEntryLog("ActionSynchronousExtensionData()\nError Extension\n{" + LStrStep + "}", EventLogEntryType.Warning);
                            continue;
                        }
                        
                        LBoolRented = false;
                        foreach (string LStrSingleServer in LListStrRentServers)
                        {
                            if (LStrSingleServer == LStrExtensionServerIP[1]) { LBoolRented = true; break; }
                        }
                        if (!LBoolRented)
                        {
                            LStrDynamicSQL = "UPDATE T_11_101_" + LStrRentBasicArray[0] + " SET C012 = '0' WHERE C001 = " + LStr11101001;
                            LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                        }
                        else
                        {
                            DataRow[] LDataRowFindChannel = LDataSet11101AllLGChannel.Tables[0].Select("C002 = 1 AND C013 = '" + LStrExtensionServerIP[1] + "' AND C014 = '" + LStrExtensionServerIP[0] + "'");
                            if (LDataRowFindChannel == null || LDataRowFindChannel.Length <= 0)
                            {
                                LStrDynamicSQL = "UPDATE T_11_101_" + LStrRentBasicArray[0] + " SET C012 = '0' WHERE C001 = " + LStr11101001;
                                LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                            }
                        }
                    }
                }
                #endregion

                #region 遍历所有Channel,添加到对应的租户中
                //C001:通道编码 19 位
                //C012:通道ID 0~2000
                //C017:录音服务器IP
                //C014:分机号
                //C015:通道名
                for (int LIntLoopRent = 0; LIntLoopRent < LListStrRentToken.Count; LIntLoopRent++)
                {
                    string[] LStrRentBasicArray = LListStrRentToken[LIntLoopRent].Split(IStrSpliterChar.ToCharArray());

                    #region 获取新用户默认密码
                    LStrDynamicSQL = "SELECT C006 FROM T_11_001_" + LStrRentBasicArray[0] + " WHERE C003 = 11010501";
                    LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                    DataSet LDataSet11010501 = LDatabaseOperation01Return.DataSetReturn;
                    LStrUserDefaultPwd = LDataSet11010501.Tables[0].Rows[0][0].ToString();
                    LStrUserDefaultPwd = EncryptionAndDecryption.EncryptDecryptString(LStrUserDefaultPwd, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrUserDefaultPwd = LStrUserDefaultPwd.Substring(8);
                    #endregion

                    foreach (string LStrRentServices in LListListRentServer[LIntLoopRent])
                    {
                        string[] LStrServerArray = LStrRentServices.Split(IStrSpliterChar.ToCharArray());

                        DataRow[] LDataRowChannelBasic = LDataSet11101AllLGChannel.Tables[0].Select("C002 = 1 AND C017 = '" + LStrServerArray[1] + "'");
                        foreach (DataRow LDataRowSingleChannel in LDataRowChannelBasic)
                        {
                            LStr11101014 = LDataRowSingleChannel["C014"].ToString();
                            LStr11101013 = LStrServerArray[1];
                            LStr11101001 = LDataRowSingleChannel["C001"].ToString();
                            LStr11101012 = LDataRowSingleChannel["C012"].ToString();
                            LStr11101015 = LDataRowSingleChannel["C015"].ToString();
                            LStr11101017 = LDataRowSingleChannel["C017"].ToString();

                            LStrTemp = EncryptionAndDecryption.EncryptDecryptString(LStr11101014 + IStrSpliterChar + LStr11101013, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002);
                            LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 IN (SELECT C001 FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 > 1040000000000000000 AND C001 < 1050000000000000000 AND C017 = '" + LStrTemp + "') ORDER BY C002";

                            LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                            DataSet LDataSetSave2DBBI = LDatabaseOperation01Return.DataSetReturn;
                            LDataSetSave2DBBI.Tables[0].TableName = "T_11_101_" + LStrRentBasicArray[0];
                            if (LDataSetSave2DBBI.Tables[0].Rows.Count <= 0)
                            {
                                LStrDataID = GetSerialIDByType(IIntDatabaseType, IStrDatabaseProfile, LStrRentBasicArray[0], 11, 104).ToString();
                                //LStrUserDefaultPwd = EncryptionAndDecryption.EncryptDecryptString(LStrDataID + LStrUserDefaultPwd, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002);
                                #region 如果是新增分机,初始化2行数据
                                for (int LIntAddRow = 1; LIntAddRow <= 2; LIntAddRow++)
                                {
                                    DataRow LDataRowNewData = LDataSetSave2DBBI.Tables[0].NewRow();
                                    LDataRowNewData.BeginEdit();
                                    LDataRowNewData["C001"] = long.Parse(LStrDataID);
                                    LDataRowNewData["C002"] = LIntAddRow;
                                    if (LIntAddRow == 1)
                                    {
                                        LDataRowNewData["C011"] = "101" + LStrRentBasicArray[0] + "00000000001";
                                        LDataRowNewData["C012"] = "1";
                                        LDataRowNewData["C013"] = "1";
                                        LDataRowNewData["C014"] = "0";
                                        LDataRowNewData["C015"] = "N";
                                        LDataRowNewData["C016"] = "09";
                                        LDataRowNewData["C017"] = LStrTemp;
                                        LDataRowNewData["C020"] = EncryptionAndDecryption.EncryptStringSHA512(LStrDataID + LStrUserDefaultPwd, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002); ;
                                    }
                                    if (LIntAddRow == 2)
                                    {
                                        LDataRowNewData["C011"] = "2014/01/01 00:00:00";
                                        LDataRowNewData["C012"] = "0";
                                        LDataRowNewData["C013"] = "0";
                                    }
                                    LDataRowNewData.EndEdit();
                                    LDataSetSave2DBBI.Tables[0].Rows.Add(LDataRowNewData);

                                    if (IIntDatabaseType == 2)
                                    {
                                        LStrDynamicSQL = "INSERT INTO T_11_201_" + LStrRentBasicArray[0] + " VALUES(0, 0, 102" + LStrRentBasicArray[0] + "00000000001, " + LStrDataID + ", '2014-01-01 00:00:00', '2199-12-31 23:59:59')";
                                    }
                                    else
                                    {
                                        LStrDynamicSQL = "INSERT INTO T_11_201_" + LStrRentBasicArray[0] + " VALUES(0, 0, 102" + LStrRentBasicArray[0] + "00000000001, " + LStrDataID + ", TO_DATE('2014-01-01 00:00:00','yyyy-MM-dd HH24:mi:ss'), TO_DATE('2199-12-31 23:59:59','yyyy-MM-dd HH24:mi:ss'))";
                                    }
                                    LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                                }
                                #endregion

                            }
                            LStrDataID = LDataSetSave2DBBI.Tables[0].Rows[0]["C001"].ToString();

                            #region 更新分机信息
                            LDataSetSave2DBBI.Tables[0].Rows[0]["C012"] = "1";
                            LDataSetSave2DBBI.Tables[0].Rows[0]["C018"] = LStr11101015;
                            LStr11101013 = LDataRowSingleChannel["C013"].ToString();
                            //WriteEntryLog("LStr11101013 = " + LStr11101013, EventLogEntryType.Warning);
                            if (LStr11101013.Substring(0, 3) == "221")
                            {
                                //LDataSetSave2DBBI.Tables[0].Rows[1]["C015"] = LStr11101017;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C015"] = LStr11101013;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C016"] = LStr11101012;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C017"] = LStr11101001;
                            }
                            else
                            {
                                //LDataSetSave2DBBI.Tables[0].Rows[1]["C018"] = LStr11101017;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C018"] = LStr11101013;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C019"] = LStr11101012;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C020"] = LStr11101001;
                            }
                            #endregion

                            #region 将数据保存到MSSQL数据库
                            if (IIntDatabaseType == 2)
                            {
                                LSqlConnection = new SqlConnection(IStrDatabaseProfile);

                                LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 = " + LStrDataID + " ORDER BY C002 ASC";
                                SqlDataAdapter LSqlDataAdapter1 = new SqlDataAdapter(LStrDynamicSQL, LSqlConnection);
                                SqlCommandBuilder LSqlCommandBuilder1 = new SqlCommandBuilder();

                                LSqlCommandBuilder1.ConflictOption = ConflictOption.OverwriteChanges;
                                LSqlCommandBuilder1.SetAllValues = false;
                                LSqlCommandBuilder1.DataAdapter = LSqlDataAdapter1;
                                LSqlDataAdapter1.Update(LDataSetSave2DBBI, "T_11_101_" + LStrRentBasicArray[0]);
                                LDataSetSave2DBBI.AcceptChanges();
                                LSqlCommandBuilder1.Dispose();
                                LSqlDataAdapter1.Dispose();
                            }
                            #endregion

                            #region 将数据保存到Oracle数据库
                            if (IIntDatabaseType == 3)
                            {
                                LOracleConnection = new OracleConnection(IStrDatabaseProfile);

                                LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 = " + LStrDataID + " ORDER BY C002 ASC";
                                OracleDataAdapter LOracleDataAdapter1 = new OracleDataAdapter(LStrDynamicSQL, LOracleConnection);
                                OracleCommandBuilder LOracleCommandBuilder1 = new OracleCommandBuilder();

                                LOracleCommandBuilder1.ConflictOption = ConflictOption.OverwriteChanges;
                                LOracleCommandBuilder1.SetAllValues = false;
                                LOracleCommandBuilder1.DataAdapter = LOracleDataAdapter1;
                                LOracleDataAdapter1.Update(LDataSetSave2DBBI, "T_11_101_" + LStrRentBasicArray[0]);
                                LDataSetSave2DBBI.AcceptChanges();
                                LOracleCommandBuilder1.Dispose();
                                LOracleDataAdapter1.Dispose();
                            }
                            #endregion
                        }
                    }
                }
                #endregion

            }
            catch (Exception ex)
            {
                IBooInSynchronous = false;
                IBoolCanAbortSynchronous = true;
                WriteEntryLog("ActionSynchronousExtensionData()\n" + LStrStep + "\n" + ex.ToString(), EventLogEntryType.Error);
            }
            finally
            {
                if (LSqlConnection != null)
                {
                    if (LSqlConnection.State == System.Data.ConnectionState.Open) { LSqlConnection.Close(); }
                    LSqlConnection.Dispose();
                }
                if (LOracleConnection != null)
                {
                    if (LOracleConnection.State == ConnectionState.Open) { LOracleConnection.Close(); }
                    LOracleConnection.Dispose(); LOracleConnection = null;
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 向XML文件中写入数据库连接参数信息,通知 Service 00 重新获得数据库连接参数
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0-数据库类型
        /// 1-数据库服务器
        /// 2-端口
        /// 3-登录名
        /// 4-登录密码
        /// 5-数据库名或服务名
        /// 6-当前版本
        /// </param>
        /// <returns></returns>
        private OperationDataArgs OperationA90(List <string> AListStringArgs)
        {
            OperationDataArgs LOperationReturn        = new OperationDataArgs();
            string            LStrXmlFileName         = string.Empty;
            string            LStrVerificationCode004 = string.Empty;
            string            LStrVerificationCode104 = string.Empty;
            string            LStrP02 = string.Empty;
            string            LStrP04 = string.Empty, LStrP05 = string.Empty, LStrP06 = string.Empty, LStrP07 = string.Empty, LStrP08 = string.Empty;
            string            LStrP09           = string.Empty;
            string            LStrLoginPassword = string.Empty;

            string LStrDBConnectProfile = string.Empty;
            string LStrDynamicSQL       = string.Empty;

            int       LIntHttpBindingPort = 0;
            int       LIntService01Port   = 0;
            string    LStrCallReturn      = string.Empty;
            string    LStrSendMessage     = string.Empty;
            TcpClient LTcpClient          = null;
            SslStream LSslStream          = null;

            try
            {
                LStrVerificationCode004 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                LStrLoginPassword = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[4], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);

                #region 保存数据库连接信息至 UMP.Server\Args01.UMP.xml
                LStrXmlFileName = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                LStrXmlFileName = Path.Combine(LStrXmlFileName, @"UMP.Server\Args01.UMP.xml");

                XmlDocument LXmlDocArgs01 = new XmlDocument();
                LXmlDocArgs01.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListDatabaseParameters = LXmlDocArgs01.SelectSingleNode("DatabaseParameters").ChildNodes;
                foreach (XmlNode LXmlNodeSingleDatabaseParameter in LXmlNodeListDatabaseParameters)
                {
                    LXmlNodeSingleDatabaseParameter.Attributes["P03"].Value = EncryptionAndDecryption.EncryptDecryptString("0", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP02 = LXmlNodeSingleDatabaseParameter.Attributes["P02"].Value;
                    LStrP02 = EncryptionAndDecryption.EncryptDecryptString(LStrP02, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    if (LStrP02 != AListStringArgs[0])
                    {
                        continue;
                    }
                    LXmlNodeSingleDatabaseParameter.Attributes["P03"].Value = EncryptionAndDecryption.EncryptDecryptString("1", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP04 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[1], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP05 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[2], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP06 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[5], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP07 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[3], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP08 = EncryptionAndDecryption.EncryptDecryptString(LStrLoginPassword, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP09 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[6], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);

                    LXmlNodeSingleDatabaseParameter.Attributes["P04"].Value = LStrP04;
                    LXmlNodeSingleDatabaseParameter.Attributes["P05"].Value = LStrP05;
                    LXmlNodeSingleDatabaseParameter.Attributes["P06"].Value = LStrP06;
                    LXmlNodeSingleDatabaseParameter.Attributes["P07"].Value = LStrP07;
                    LXmlNodeSingleDatabaseParameter.Attributes["P08"].Value = LStrP08;
                    LXmlNodeSingleDatabaseParameter.Attributes["P09"].Value = LStrP09;
                }
                LXmlDocArgs01.Save(LStrXmlFileName);
                #endregion

                #region 将创建的版本信息写入到 T_00_000
                string LStrSelectC000 = AscCodeToChr(27) + AscCodeToChr(27) + AscCodeToChr(27) + AscCodeToChr(27) + "1";
                if (AListStringArgs[0] == "2")
                {
                    LStrDBConnectProfile = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", AListStringArgs[1], AListStringArgs[2], AListStringArgs[5], AListStringArgs[3], LStrLoginPassword);
                    LStrDynamicSQL       = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005) VALUES('" + LStrSelectC000 + "', 'CreateDB', '" + AListStringArgs[6] + "', 'CREATEDB', '1', GETUTCDATE())";
                }
                if (AListStringArgs[0] == "3")
                {
                    LStrDBConnectProfile = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", AListStringArgs[1], AListStringArgs[2], AListStringArgs[5], AListStringArgs[3], LStrLoginPassword);
                    LStrDynamicSQL       = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005) VALUES('" + LStrSelectC000 + "', 'CreateDB', '" + AListStringArgs[6] + "', 'CREATEDB', '1', F_00_004())";
                }
                DataOperations01          LDataOperations            = new DataOperations01();
                DatabaseOperation01Return LDatabaseOperation01Return = LDataOperations.SelectDataByDynamicSQL(int.Parse(AListStringArgs[0]), LStrDBConnectProfile, LStrDynamicSQL);
                if (!LDatabaseOperation01Return.BoolReturn)
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = LDatabaseOperation01Return.StrReturn;
                    return(LOperationReturn);
                }
                #endregion

                #region 通知 Service 00 重新获得数据库连接参数
                LStrSendMessage = EncryptionAndDecryption.EncryptDecryptString("M01C01", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                foreach (string LStrSingleArgs in AListStringArgs)
                {
                    LStrSendMessage += AscCodeToChr(27) + LStrSingleArgs;
                }
                LIntHttpBindingPort = GetIISHttpBindingPort(ref LStrCallReturn);
                if (LIntHttpBindingPort <= 0)
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = "GetIISHttpBindingPort()\n" + LStrCallReturn;
                    return(LOperationReturn);
                }
                LIntService01Port = LIntHttpBindingPort - 1;
                if (LIntService01Port == 8009)
                {
                    LIntService01Port = 8008;
                }
                try
                {
                    LTcpClient = new TcpClient("127.0.0.1", LIntService01Port);
                    LSslStream = new SslStream(LTcpClient.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
                    LSslStream.AuthenticateAsClient("VoiceCyber.PF", null, SslProtocols.Default, false);
                    byte[] LByteMesssage = Encoding.UTF8.GetBytes(LStrSendMessage + "\r\n");
                    LSslStream.Write(LByteMesssage); LSslStream.Flush();
                }
                catch { }
                #endregion
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = "OperationA90()\n" + ex.ToString();
            }
            finally
            {
                if (LSslStream != null)
                {
                    LSslStream.Close();
                }
                if (LTcpClient != null)
                {
                    LTcpClient.Close();
                }
            }

            return(LOperationReturn);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 查询操作日志
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0:数据库类型
        /// 1:数据库连接串
        /// 2:租户Token
        /// 3~N:查询条件</param>
        /// <returns></returns>
        private OperationDataArgs OperationA02(List <string> AListStringArgs)
        {
            OperationDataArgs LOperationReturn = new OperationDataArgs();

            string        LStrFirst4Char          = string.Empty;
            string        LStrAfter4Char          = string.Empty;
            string        LStr11901008B           = string.Empty; //开始时间 yyyy/MM/dd HH:mm:ss
            string        LStr11901008E           = string.Empty; //结束时间 yyyy/MM/dd HH:mm:ss
            List <string> LListStrOperationID     = new List <string>();
            List <string> LListStrUserID          = new List <string>();
            List <string> LListStrOperationResult = new List <string>();
            List <string> LListStrHostName        = new List <string>();
            List <string> LListStrHostIPAddress   = new List <string>();

            string LStrOP911 = string.Empty, LStrUA911 = string.Empty, LStrOR911 = string.Empty, LStrHN911 = string.Empty, LStrIP911 = string.Empty;

            int    LIntDBType    = 0;
            string LStrDBProfile = string.Empty;
            string LStrSelectSQL = string.Empty;
            int    LIntTempID    = 0;

            SqlConnection    LSqlConnection    = null;
            OracleConnection LOracleConnection = null;

            try
            {
                LIntDBType    = int.Parse(AListStringArgs[0]);
                LStrDBProfile = AListStringArgs[1];

                DataOperations01          LDataOperation     = new DataOperations01();
                DatabaseOperation01Return LDBOperationReturn = new DatabaseOperation01Return();

                #region 分析日志查询条件
                foreach (string LStrSelectSingleArgs in AListStringArgs)
                {
                    if (LStrSelectSingleArgs.Length < 4)
                    {
                        continue;
                    }
                    LStrFirst4Char = LStrSelectSingleArgs.Substring(0, 4);
                    LStrAfter4Char = LStrSelectSingleArgs.Substring(4);
                    if (LStrFirst4Char == AscCodeToChr(27) + "BT" + AscCodeToChr(27))
                    {
                        LStr11901008B = (DateTime.Parse(LStrAfter4Char)).ToString("yyyyMMddHHmmss");
                        continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "ET" + AscCodeToChr(27))
                    {
                        LStr11901008E = (DateTime.Parse(LStrAfter4Char)).ToString("yyyyMMddHHmmss");
                        continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "OP" + AscCodeToChr(27))
                    {
                        LListStrOperationID.Add(LStrAfter4Char); continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "UA" + AscCodeToChr(27))
                    {
                        LListStrUserID.Add(LStrAfter4Char); continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "OR" + AscCodeToChr(27))
                    {
                        LListStrOperationResult.Add(LStrAfter4Char); continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "HN" + AscCodeToChr(27))
                    {
                        LListStrHostName.Add(LStrAfter4Char); continue;
                    }
                    if (LStrFirst4Char == AscCodeToChr(27) + "IP" + AscCodeToChr(27))
                    {
                        LListStrHostIPAddress.Add(LStrAfter4Char); continue;
                    }
                }
                #endregion

                #region 保存数据查询条件
                LStrSelectSQL      = "SELECT * FROM T_00_901 WHERE 1 = 2";
                LDBOperationReturn = LDataOperation.SelectDataByDynamicSQL(LIntDBType, LStrDBProfile, LStrSelectSQL);
                DataSet LDataSetSave2DB = LDBOperationReturn.DataSetReturn;
                LDataSetSave2DB.Tables[0].TableName = "T_00_901";

                if (LListStrOperationID.Count > 0)
                {
                    LIntTempID         = 0;
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(LIntDBType, LStrDBProfile, 11, 911, AListStringArgs[2], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                    if (LDBOperationReturn.BoolReturn)
                    {
                        LStrOP911 = LDBOperationReturn.StrReturn;
                    }
                    else
                    {
                        LOperationReturn.BoolReturn = false; LOperationReturn.StringReturn = LDBOperationReturn.StrReturn; return(LOperationReturn);
                    }
                    foreach (string LStrSingleOperation in LListStrOperationID)
                    {
                        LIntTempID += 1;
                        DataRow LDataRowNewOperation = LDataSetSave2DB.Tables[0].NewRow();
                        LDataRowNewOperation.BeginEdit();
                        LDataRowNewOperation["C001"] = long.Parse(LStrOP911);
                        LDataRowNewOperation["C002"] = LIntTempID;
                        LDataRowNewOperation["C011"] = LStrSingleOperation;
                        LDataRowNewOperation.EndEdit();
                        LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewOperation);
                    }
                }

                if (LListStrUserID.Count > 0)
                {
                    LIntTempID         = 0;
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(LIntDBType, LStrDBProfile, 11, 911, AListStringArgs[2], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                    if (LDBOperationReturn.BoolReturn)
                    {
                        LStrUA911 = LDBOperationReturn.StrReturn;
                    }
                    else
                    {
                        LOperationReturn.BoolReturn = false; LOperationReturn.StringReturn = LDBOperationReturn.StrReturn; return(LOperationReturn);
                    }
                    foreach (string LStrSingleUser in LListStrUserID)
                    {
                        LIntTempID += 1;
                        DataRow LDataRowNewOperation = LDataSetSave2DB.Tables[0].NewRow();
                        LDataRowNewOperation.BeginEdit();
                        LDataRowNewOperation["C001"] = long.Parse(LStrUA911);
                        LDataRowNewOperation["C002"] = LIntTempID;
                        LDataRowNewOperation["C011"] = LStrSingleUser;
                        LDataRowNewOperation.EndEdit();
                        LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewOperation);
                    }
                }

                if (LListStrOperationResult.Count > 0)
                {
                    LIntTempID         = 0;
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(LIntDBType, LStrDBProfile, 11, 911, AListStringArgs[2], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                    if (LDBOperationReturn.BoolReturn)
                    {
                        LStrOR911 = LDBOperationReturn.StrReturn;
                    }
                    else
                    {
                        LOperationReturn.BoolReturn = false; LOperationReturn.StringReturn = LDBOperationReturn.StrReturn; return(LOperationReturn);
                    }
                    foreach (string LStrSingleResult in LListStrOperationResult)
                    {
                        LIntTempID += 1;
                        DataRow LDataRowNewOperation = LDataSetSave2DB.Tables[0].NewRow();
                        LDataRowNewOperation.BeginEdit();
                        LDataRowNewOperation["C001"] = long.Parse(LStrOR911);
                        LDataRowNewOperation["C002"] = LIntTempID;
                        LDataRowNewOperation["C011"] = LStrSingleResult;
                        LDataRowNewOperation.EndEdit();
                        LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewOperation);
                    }
                }

                if (LListStrHostName.Count > 0)
                {
                    LIntTempID         = 0;
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(LIntDBType, LStrDBProfile, 11, 911, AListStringArgs[2], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                    if (LDBOperationReturn.BoolReturn)
                    {
                        LStrHN911 = LDBOperationReturn.StrReturn;
                    }
                    else
                    {
                        LOperationReturn.BoolReturn = false; LOperationReturn.StringReturn = LDBOperationReturn.StrReturn; return(LOperationReturn);
                    }
                    foreach (string LStrSingleHost in LListStrHostName)
                    {
                        LIntTempID += 1;
                        DataRow LDataRowNewOperation = LDataSetSave2DB.Tables[0].NewRow();
                        LDataRowNewOperation.BeginEdit();
                        LDataRowNewOperation["C001"] = long.Parse(LStrHN911);
                        LDataRowNewOperation["C002"] = LIntTempID;
                        LDataRowNewOperation["C011"] = LStrSingleHost;
                        LDataRowNewOperation.EndEdit();
                        LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewOperation);
                    }
                }

                if (LListStrHostIPAddress.Count > 0)
                {
                    LIntTempID         = 0;
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(LIntDBType, LStrDBProfile, 11, 911, AListStringArgs[2], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                    if (LDBOperationReturn.BoolReturn)
                    {
                        LStrIP911 = LDBOperationReturn.StrReturn;
                    }
                    else
                    {
                        LOperationReturn.BoolReturn = false; LOperationReturn.StringReturn = LDBOperationReturn.StrReturn; return(LOperationReturn);
                    }
                    foreach (string LStrSingleIPAddress in LListStrHostIPAddress)
                    {
                        LIntTempID += 1;
                        DataRow LDataRowNewOperation = LDataSetSave2DB.Tables[0].NewRow();
                        LDataRowNewOperation.BeginEdit();
                        LDataRowNewOperation["C001"] = long.Parse(LStrIP911);
                        LDataRowNewOperation["C002"] = LIntTempID;
                        LDataRowNewOperation["C011"] = LStrSingleIPAddress;
                        LDataRowNewOperation.EndEdit();
                        LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewOperation);
                    }
                }

                if (LIntDBType == 2)
                {
                    LSqlConnection = new SqlConnection(LStrDBProfile);
                    SqlDataAdapter    LSqlDataAdapter    = new SqlDataAdapter(LStrSelectSQL, LSqlConnection);
                    SqlCommandBuilder LSqlCommandBuilder = new SqlCommandBuilder();

                    LSqlCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LSqlCommandBuilder.SetAllValues   = false;
                    LSqlCommandBuilder.DataAdapter    = LSqlDataAdapter;
                    LSqlDataAdapter.Update(LDataSetSave2DB, "T_00_901");
                    LDataSetSave2DB.AcceptChanges();
                    LSqlCommandBuilder.Dispose();
                    LSqlDataAdapter.Dispose();
                }

                if (LIntDBType == 3)
                {
                    LOracleConnection = new OracleConnection(LStrDBProfile);
                    OracleDataAdapter    LOracleDataAdapter    = new OracleDataAdapter(LStrSelectSQL, LOracleConnection);
                    OracleCommandBuilder LOracleCommandBuilder = new OracleCommandBuilder();

                    LOracleCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LOracleCommandBuilder.SetAllValues   = false;
                    LOracleCommandBuilder.DataAdapter    = LOracleDataAdapter;
                    LOracleDataAdapter.Update(LDataSetSave2DB, "T_00_901");
                    LDataSetSave2DB.AcceptChanges();
                    LOracleCommandBuilder.Dispose();
                    LOracleDataAdapter.Dispose();
                }

                #endregion

                #region 创建查询SQL语句
                LStrSelectSQL = "SELECT * FROM T_11_901_" + AListStringArgs[2] + " WHERE C008 >= " + LStr11901008B + " AND C008 <= " + LStr11901008E;
                if (!string.IsNullOrEmpty(LStrOP911))
                {
                    if (LIntDBType == 2)
                    {
                        LStrSelectSQL += " AND (C004 IN (SELECT CONVERT(BIGINT, C011) FROM T_00_901 WHERE C001 = " + LStrOP911 + "))";
                    }
                    else
                    {
                        LStrSelectSQL += " AND (C004 IN (SELECT TO_NUMBER(C011) FROM T_00_901 WHERE C001 = " + LStrOP911 + "))";
                    }
                }

                if (!string.IsNullOrEmpty(LStrUA911))
                {
                    if (LIntDBType == 2)
                    {
                        LStrSelectSQL += " AND (C005 IN (SELECT CONVERT(BIGINT, C011) FROM T_00_901 WHERE C001 = " + LStrUA911 + "))";
                    }
                    else
                    {
                        LStrSelectSQL += " AND (C005 IN (SELECT TO_NUMBER(C011) FROM T_00_901 WHERE C001 = " + LStrUA911 + "))";
                    }
                }

                if (!string.IsNullOrEmpty(LStrOR911))
                {
                    LStrSelectSQL += " AND (C009 IN (SELECT C011 FROM T_00_901 WHERE C001 = " + LStrOR911 + "))";
                }

                if (!string.IsNullOrEmpty(LStrHN911))
                {
                    LStrSelectSQL += " AND (C006 IN (SELECT C011 FROM T_00_901 WHERE C001 = " + LStrHN911 + "))";
                }

                if (!string.IsNullOrEmpty(LStrIP911))
                {
                    LStrSelectSQL += " AND (C007 IN (SELECT C011 FROM T_00_901 WHERE C001 = " + LStrIP911 + "))";
                }
                #endregion

                #region 根据SQL语句查询操作日志
                LDBOperationReturn = LDataOperation.SelectDataByDynamicSQL(LIntDBType, LStrDBProfile, LStrSelectSQL);
                if (LDBOperationReturn.BoolReturn)
                {
                    LOperationReturn.DataSetReturn = LDBOperationReturn.DataSetReturn;
                    LOperationReturn.StringReturn  = LDBOperationReturn.StrReturn;
                    LOperationReturn.ListStringReturn.Add(LStrSelectSQL);
                }
                else
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = LDBOperationReturn.StrReturn;
                }
                #endregion
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = ex.ToString();
            }
            finally
            {
                if (LSqlConnection != null)
                {
                    if (LSqlConnection.State == System.Data.ConnectionState.Open)
                    {
                        LSqlConnection.Close();
                    }
                    LSqlConnection.Dispose();
                }
                if (LOracleConnection != null)
                {
                    if (LOracleConnection.State == ConnectionState.Open)
                    {
                        LOracleConnection.Close();
                    }
                    LOracleConnection.Dispose(); LOracleConnection = null;
                }
            }

            return(LOperationReturn);
        }