예제 #1
0
        /// <summary>
        /// 获取证书信息
        /// 作者:苑峰      时间:2009-7-31
        /// 修改:          时间:
        /// CerType:0(公钥),1(私钥)
        /// </summary>
        public byte[] GetCAInfo(string SPID, int CerType, object SPDataObj, out string UserName, out string UserPassWord)
        {
            UserName     = "";
            UserPassWord = "";

            byte[]    Result   = null;
            DataTable dt       = new DataTable();
            SPCAData  SPCAData = (SPCAData)SPDataObj;

            dt = SPCAData.Tables[SPCAData.TableName];

            if (dt.Rows.Count == 0)
            {
                return(Result);
            }

            foreach (DataRow row in dt.Rows)
            {
                string str = Convert.ToString(row[SPData.Field_SPID]);
                int    a   = int.Parse(row[SPCAData.Field_CerType].ToString());
                if (SPID == Convert.ToString(row[SPData.Field_SPID]) & CerType == int.Parse(row[SPCAData.Field_CerType].ToString()))
                {
                    Result       = (byte[])row["CerInfo"];
                    UserName     = (string)row["CerUserName"];
                    UserPassWord = (string)row["CerPassword"];
                    break;
                }
            }

            return(Result);
        }
예제 #2
0
        /// <summary>
        /// �����ݿ��ȡSP���ݼ���
        /// ���ߣ�Է��      ʱ�䣺2009-7-31
        /// �޸ģ�          ʱ�䣺
        /// </summary>
        private object GetSPData( string SPDataCacheName)
        {
            object ResultData = null;
            DataSet tmpData = new DataSet();

            try
            {
                SqlCommand selCmd = new SqlCommand();
                selCmd.CommandType = CommandType.Text;
                DataTable dt = new DataTable();
                if (SPDataCacheName == "SPData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInfo;
                    SPData SPData = new SPData();
                    dt = SPData.Tables[SPData.TableName];
                    ResultData = SPData;
                }
                else if (SPDataCacheName == "SPIPListData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPIPList;
                    SPIPListData SPIPListData = new SPIPListData();
                    dt = SPIPListData.Tables[SPIPListData.TableName];
                    ResultData = SPIPListData;
                }
                else if (SPDataCacheName == "SPInterfaceLimitData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInterfaceLimit;
                    SPInterfaceLimitData SPInterfaceLimitData = new SPInterfaceLimitData();
                    dt = SPInterfaceLimitData.Tables[SPInterfaceLimitData.TableName];
                    ResultData = SPInterfaceLimitData;
                }
                else if (SPDataCacheName == "SPCAData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPCAInfo;
                    SPCAData SPCAData = new SPCAData();
                    dt = SPCAData.Tables[SPCAData.TableName];
                    ResultData = SPCAData;
                }

                // ��ȡ����
                tmpData = DBUtility.FillData(selCmd, DBUtility.BestToneCenterConStr);

                // ����ת��
                // DataSet --> Object

                int intTargetColumnCount = dt.Columns.Count;
                foreach (DataRow row in tmpData.Tables[0].Rows)
                {
                    object[] newRow = new object[intTargetColumnCount];
                    for (int j = 0; j < intTargetColumnCount; j++)
                    {
                        newRow[j] = row[j];
                    }
                    dt.Rows.Add(newRow);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return ResultData;
        }
예제 #3
0
        /// <summary>
        /// 从数据库获取SP数据集合
        /// 作者:苑峰      时间:2009-7-31
        /// 修改:          时间:
        /// </summary>
        private object GetSPData(string SPDataCacheName)
        {
            object  ResultData = null;
            DataSet tmpData    = new DataSet();

            try
            {
                SqlCommand selCmd = new SqlCommand();
                selCmd.CommandType = CommandType.Text;
                DataTable dt = new DataTable();
                if (SPDataCacheName == "SPData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInfo;
                    SPData SPData = new SPData();
                    dt         = SPData.Tables[SPData.TableName];
                    ResultData = SPData;
                }
                else if (SPDataCacheName == "SPIPListData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPIPList;
                    SPIPListData SPIPListData = new SPIPListData();
                    dt         = SPIPListData.Tables[SPIPListData.TableName];
                    ResultData = SPIPListData;
                }
                else if (SPDataCacheName == "SPInterfaceLimitData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInterfaceLimit;
                    SPInterfaceLimitData SPInterfaceLimitData = new SPInterfaceLimitData();
                    dt         = SPInterfaceLimitData.Tables[SPInterfaceLimitData.TableName];
                    ResultData = SPInterfaceLimitData;
                }
                else if (SPDataCacheName == "SPCAData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPCAInfo;
                    SPCAData SPCAData = new SPCAData();
                    dt         = SPCAData.Tables[SPCAData.TableName];
                    ResultData = SPCAData;
                }

                // 获取数据
                tmpData = DBUtility.FillData(selCmd, DBUtility.BestToneCenterConStr);

                // 数据转换
                // DataSet --> Object

                int intTargetColumnCount = dt.Columns.Count;
                foreach (DataRow row in tmpData.Tables[0].Rows)
                {
                    object[] newRow = new object[intTargetColumnCount];
                    for (int j = 0; j < intTargetColumnCount; j++)
                    {
                        newRow[j] = row[j];
                    }
                    dt.Rows.Add(newRow);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return(ResultData);
        }