示例#1
0
        public DataTable TokenGetCredencDt(string tokenValue)
        {
            DataTable dt = new DataTable();

            dt.TableName = "Joson";

            #region Columns

            //dt.Columns.Add("TokenVal", Type.GetType("System.String"));
            //dt.Columns["TokenVal"].Unique = true;

            //dt.Columns.Add("ID", Type.GetType("System.String"));
            //dt.Columns["ID"].DefaultValue = null;

            //dt.Columns.Add("AccountID", Type.GetType("System.String"));
            //dt.Columns["AccountID"].DefaultValue = null;

            //dt.Columns.Add("AccountName", Type.GetType("System.String"));
            //dt.Columns["AccountName"].DefaultValue = null;

            //dt.Columns.Add("AccountPassWords", Type.GetType("System.String"));
            //dt.Columns["AccountPassWords"].DefaultValue = null;

            //dt.Columns.Add("isLogin", Type.GetType("System.String"));
            //dt.Columns["isLogin"].DefaultValue = null;

            //DataColumn[] keys = new DataColumn[1];
            //keys[0] = dt.Columns["TokenVal"];
            //dt.PrimaryKey = keys;

            #endregion

            DataTable CacheTable = TokenCache.GetCacheTable();

            if (dt != null)
            {
                DataRow[] dr = CacheTable.Select("token = '" + tokenValue + "'");

                #region Temp

                //int i = 0;
                //foreach (DataRow dtRow in dr)
                //{
                //    OAuthToken OAuth = (OAuthToken)dr[i]["info"];

                //    DataRow DtNewRow = dt.NewRow();

                //    DtNewRow["TokenVal"] = dr[i]["token"];

                //    DtNewRow["ID"] = OAuth.ID;
                //    DtNewRow["AccountID"] = OAuth.AccountID;
                //    DtNewRow["AccountName"] = OAuth.AccountName;
                //    DtNewRow["AccountPassWords"] = OAuth.AccountPassWords;

                //    DtNewRow["isLogin"] = OAuth.isLogin;

                //    dt.Rows.Add(DtNewRow);

                //    i++;

                //}

                #endregion

                OAuthToken OAuth = dr[0]["info"].ToStrings().Deserialize <OAuthToken>();

                dt           = OAuth.ToDataTable();
                dt.TableName = "OAuth";
            }

            return(dt);

            //DataSet DtSet = new DataSet();
            //DtSet.Tables.Add(dt);
            //return DtSet;
        }