Esempio n. 1
0
        private string EncryptShaToDB(string strSource)
        {
            string strReturn = EncryptionAndDecryption.EncryptStringSHA512(strSource,
                                                                           CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M002),
                                                                           EncryptionAndDecryption.UMPKeyAndIVType.M002);

            return(strReturn);
        }
Esempio n. 2
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;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 根据租户信息,更改表中的初始化数据
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0-数据库类型
        /// 1-数据库服务器
        /// 2-端口
        /// 3-登录名
        /// 4-登录密码
        /// 5-数据库名或服务名
        /// 6-0租户名称
        /// 7-1租户Token
        /// 8-2超级系统管理员密码
        /// 9-3系统默认界面显示语言
        /// </param>
        /// <returns></returns>
        private OperationDataArgs OperationA15(List <string> AListStringArgs)
        {
            OperationDataArgs LOperationReturn        = new OperationDataArgs();
            List <string>     LListStrDatabaseProfile = new List <string>();
            List <string>     LListStrRentDataSetted  = new List <string>();

            string LStrXmlFileName         = string.Empty;
            string LStrVerificationCode001 = string.Empty;
            string LStrVerificationCode104 = string.Empty;
            string LStrUserID19            = string.Empty;
            string LStrXmlSAPassword       = string.Empty;
            string LStrA01 = string.Empty;

            try
            {
                for (int LIntLoopTemp = 0; LIntLoopTemp <= 5; LIntLoopTemp++)
                {
                    LListStrDatabaseProfile.Add(AListStringArgs[LIntLoopTemp]);
                }
                for (int LIntLoopTemp = 6; LIntLoopTemp <= 9; LIntLoopTemp++)
                {
                    LListStrRentDataSetted.Add(AListStringArgs[LIntLoopTemp]);
                }

                if (LListStrDatabaseProfile[0] == "2")
                {
                    LOperationReturn = DatabaseType2Operation.InitTableByRentInfo(LListStrDatabaseProfile, LListStrRentDataSetted);
                }
                if (LListStrDatabaseProfile[0] == "3")
                {
                    LOperationReturn = DatabaseType3Operation.InitTableByRentInfo(LListStrDatabaseProfile, LListStrRentDataSetted);
                }

                #region 修改XML文件的administrator的密码
                LStrVerificationCode001 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M001);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrUserID19            = "102" + AListStringArgs[7] + "00000000001";
                LStrXmlSAPassword       = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[8], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrXmlSAPassword       = EncryptionAndDecryption.EncryptStringSHA512(LStrUserID19 + LStrXmlSAPassword, LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M001);
                LStrXmlFileName         = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                LStrXmlFileName         = Path.Combine(LStrXmlFileName, @"UMP.Server\Args02.UMP.xml");
                XmlDocument LXmlDocArgs02 = new XmlDocument();
                LXmlDocArgs02.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListSAUsers = LXmlDocArgs02.SelectSingleNode("Parameters02").SelectSingleNode("SAUsers").ChildNodes;
                foreach (XmlNode LXmlNodeSingleUser in LXmlNodeListSAUsers)
                {
                    LStrA01 = LXmlNodeSingleUser.Attributes["A01"].Value;
                    if (LStrA01 != LStrUserID19)
                    {
                        continue;
                    }
                    LXmlNodeSingleUser.Attributes["A03"].Value = LStrXmlSAPassword;
                    break;
                }
                LXmlDocArgs02.Save(LStrXmlFileName);
                #endregion
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = "OperationA15()\n" + ex.ToString();
            }

            return(LOperationReturn);
        }
Esempio n. 4
0
        //在本机验证输入的用户名和密码
        private bool VerifyLoginIDAndPassword(ref string AStrReturn)
        {
            bool LBoolReturn = true;

            string LStrXmlFileName         = string.Empty;
            string LStrVerificationCode001 = string.Empty;
            string LStrVerificationCode101 = string.Empty;

            string LStrA01 = string.Empty, LStrA02 = string.Empty, LStrA03 = string.Empty, LStrA04 = string.Empty, LStrA05 = string.Empty, LStrA06 = string.Empty, LStrA07 = string.Empty;
            string LStrEncryptionPwd = string.Empty;

            try
            {
                App.GStrCatchException = string.Empty;
                LStrXmlFileName        = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                LStrXmlFileName        = System.IO.Path.Combine(LStrXmlFileName, @"UMP.Server\Args02.UMP.xml");

                LStrVerificationCode001 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M001);
                LStrVerificationCode101 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M101);

                XmlDocument LXmlDocArgs02 = new XmlDocument();
                LXmlDocArgs02.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListSAUsers = LXmlDocArgs02.SelectSingleNode("Parameters02").SelectSingleNode("SAUsers").ChildNodes;
                foreach (XmlNode LXmlNodeSingleUser in LXmlNodeListSAUsers)
                {
                    LStrA02 = LXmlNodeSingleUser.Attributes["A02"].Value;
                    LStrA02 = EncryptionAndDecryption.EncryptDecryptString(LStrA02, LStrVerificationCode101, EncryptionAndDecryption.UMPKeyAndIVType.M101);

                    if (LStrA02 == IListConnectArguments[2])
                    {
                        LStrA01 = LXmlNodeSingleUser.Attributes["A01"].Value;
                        LStrA03 = LXmlNodeSingleUser.Attributes["A03"].Value;
                        LStrA04 = LXmlNodeSingleUser.Attributes["A04"].Value;
                        LStrA05 = LXmlNodeSingleUser.Attributes["A05"].Value;
                        LStrA06 = LXmlNodeSingleUser.Attributes["A06"].Value;
                        LStrA07 = LXmlNodeSingleUser.Attributes["A07"].Value;
                        break;
                    }
                }
                if (string.IsNullOrEmpty(LStrA01))
                {
                    LBoolReturn = false;
                    AStrReturn  = "E00005";
                    return(LBoolReturn);
                }
                LStrEncryptionPwd = EncryptionAndDecryption.EncryptStringSHA512(LStrA01 + IListConnectArguments[3], LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M001);
                if (LStrEncryptionPwd != LStrA03)
                {
                    LBoolReturn = false;
                    AStrReturn  = "E00005";
                    return(LBoolReturn);
                }
                App.GStrLoginPassword = IListConnectArguments[3];
            }
            catch (Exception ex)
            {
                LBoolReturn            = false;
                AStrReturn             = "E00000";
                App.GStrCatchException = ex.ToString();
            }

            return(LBoolReturn);
        }