Esempio n. 1
0
 private static ListedAccount ReadAccount(System.Data.Common.DbDataReader reader)
 {
     return(new ListedAccount()
     {
         ProtectionId = reader.GetInt64("protection"),
         AccountName = reader.GetString("account"),
         Reason = reader.GetString("reason")
     });
 }
Esempio n. 2
0
        public static long?GetReaderValueInt64(System.Data.Common.DbDataReader reader, string name)
        {
            var ordinal = reader.GetOrdinal(name);

            if (reader.IsDBNull(ordinal))
            {
                return(null);
            }
            try
            {
                return(reader.GetInt64(ordinal));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(null);
        }
Esempio n. 3
0
        protected override void BeforeStarting()
        {
            MySqlHelper db = DbHelper.CreateMySqlHelper("host=localhost;database=liba_user;uid=root;pwd=123456;charset=utf8") as MySqlHelper;

            using (System.Data.Common.DbDataReader reader = db.ExecuteReader("SELECT uid,uname from users where email='' order by uid asc", System.Data.CommandBehavior.CloseConnection))
            {
                //and uname REGEXP('^[0-9a-z_-]+$')
                while (reader.Read())
                {
                    string   uid   = reader.GetInt64(0).ToString();
                    string   uname = reader.GetString(1).Trim();
                    FinalUrl url   = Url.CreateFinalUrl(String.Format("http://bbs.sh.libaclub.com/sendpass.php?action=sendme&username1={0}&id={1}", System.Web.HttpUtility.UrlEncode(Encoding.Default.GetBytes(uname)), uid), null) as FinalUrl;
                    url.UriEscape = false;
                    if (null != url)
                    {
                        url.ContentHandlers.Add(new Libahander2());
                        this.ManualQueue(url, false);
                    }
                }
            }
        }
 /// <summary>
 /// Gets an int64 column.
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="ordinal"></param>
 /// <returns></returns>
 public static Int64?GetNInt64(this System.Data.Common.DbDataReader reader, int ordinal)
 {
     return(reader.IsDBNull(ordinal) ? (long?)null : reader.GetInt64(ordinal));
 }
        /// <summary>
        /// Gets an int64 column. Slower then GetOrdinal + GetInt64
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Int64?GetNInt64(this System.Data.Common.DbDataReader reader, string name)
        {
            int ordinal = reader.GetOrdinal(name);

            return(reader.IsDBNull(ordinal) ? (long?)null : reader.GetInt64(ordinal));
        }