Ejemplo 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")
     });
 }
Ejemplo 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);
        }
Ejemplo 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);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <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));
 }
Ejemplo n.º 5
0
        /// <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));
        }