當前位置: 首頁>>代碼示例>>C#>>正文


C# SqliteDataReader.GetBoolean方法代碼示例

本文整理匯總了C#中Mono.Data.Sqlite.SqliteDataReader.GetBoolean方法的典型用法代碼示例。如果您正苦於以下問題:C# SqliteDataReader.GetBoolean方法的具體用法?C# SqliteDataReader.GetBoolean怎麽用?C# SqliteDataReader.GetBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Data.Sqlite.SqliteDataReader的用法示例。


在下文中一共展示了SqliteDataReader.GetBoolean方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetUserFromReader

		/// <summary>
		/// A helper function that takes the current row from the SqliteDataReader
		/// and hydrates a MembershipUser from the values. Called by the 
		/// MembershipUser.GetUser implementation.
		/// </summary>
		/// <param name="reader">SqliteDataReader object</param>
		/// <returns>MembershipUser object</returns>
		MembershipUser GetUserFromReader(SqliteDataReader reader)
		{
			object providerUserKey = reader.GetValue(0);
			string username = reader.GetString(1);
			string email = string.Empty;
			if (!reader.IsDBNull(2))
				email = reader.GetString(2);

			string passwordQuestion = string.Empty;
			if (!reader.IsDBNull(3))
				passwordQuestion = reader.GetString(3);
			
			string comment = string.Empty;
			if (!reader.IsDBNull(4))
				comment = reader.GetString(4);

			bool isApproved = reader.GetBoolean(5);
			bool isLockedOut = reader.GetBoolean(6);
			DateTime creationDate = reader.GetDateTime(7);

			DateTime lastLoginDate = new DateTime();
			if (!reader.IsDBNull(8))
				lastLoginDate = reader.GetDateTime(8);

			DateTime lastActivityDate = reader.GetDateTime(9);
			DateTime lastPasswordChangedDate = reader.GetDateTime(10);

			DateTime lastLockedOutDate = new DateTime();
			if (!reader.IsDBNull(11))
				lastLockedOutDate = reader.GetDateTime(11);

			MembershipUser u = new MembershipUser(this.Name,
												  username,
												  providerUserKey,
												  email,
												  passwordQuestion,
												  comment,
												  isApproved,
												  isLockedOut,
												  creationDate,
												  lastLoginDate,
												  lastActivityDate,
												  lastPasswordChangedDate,
												  lastLockedOutDate);
			
			return u;
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:54,代碼來源:SqliteMembershipProvider.cs

示例2: LoadCrlRecord

        X509CrlRecord LoadCrlRecord(SqliteDataReader reader, X509CrlParser parser, ref byte[] buffer)
        {
            var record = new X509CrlRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CRL":
                    record.Crl = DecodeX509Crl (reader, parser, i, ref buffer);
                    break;
                case "THISUPDATE":
                    record.ThisUpdate = reader.GetDateTime (i);
                    break;
                case "NEXTUPDATE":
                    record.NextUpdate = reader.GetDateTime (i);
                    break;
                case "DELTA":
                    record.IsDelta = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }
開發者ID:vdaron,項目名稱:MimeKit,代碼行數:26,代碼來源:X509CertificateDatabase.cs

示例3: GetUserFromReader

        //
        // GetUserFromReader
        //    A helper function that takes the current row from the SQLiteDataReader
        // and hydrates a MembershipUser from the values. Called by the
        // MembershipUser.GetUser implementation.
        //
        private MembershipUser GetUserFromReader(SqliteDataReader reader)
        {
            if (reader.GetString(1)=="") return null;
            object providerUserKey=null;
            string strGooid=Guid.NewGuid().ToString();
            if (reader.GetValue(0).ToString().Length > 0)
                providerUserKey = new Guid(reader.GetValue(0).ToString());
            else
                providerUserKey = new Guid(strGooid);
            string username = reader.GetString(1);
            string email = reader.GetString(2);

            string passwordQuestion = "";
            if (reader.GetValue(3) != DBNull.Value)
                passwordQuestion = reader.GetString(3);

            string comment = "";
            if (reader.GetValue(4) != DBNull.Value)
                comment = reader.GetString(4);

            bool tmpApproved = (reader.GetValue(5) == null);
             bool isApproved=false;
            if(tmpApproved)
            isApproved = reader.GetBoolean(5);

            bool tmpLockedOut = (reader.GetValue(6) == null);
            bool isLockedOut = false;
            if(tmpLockedOut)
            isLockedOut = reader.GetBoolean(6);

            DateTime creationDate = DateTime.Now;
            try
            {
                if (reader.GetValue(6) != DBNull.Value)
                    creationDate = reader.GetDateTime(7);
            }
            catch { }

            DateTime lastLoginDate = DateTime.Now;
            try
            {
                if (reader.GetValue(8) != DBNull.Value)
                    lastLoginDate = reader.GetDateTime(8);
            }
            catch { }

            DateTime lastActivityDate = DateTime.Now;
            try
            {
                if (reader.GetValue(9) != DBNull.Value)
                    lastActivityDate = reader.GetDateTime(9);
            }
            catch { }
            DateTime lastPasswordChangedDate = DateTime.Now;
            try
            {
                if (reader.GetValue(10) != DBNull.Value)
                    lastPasswordChangedDate = reader.GetDateTime(10);
            }
            catch { }

            DateTime lastLockedOutDate = DateTime.Now;
            try
            {
                if (reader.GetValue(11) != DBNull.Value)
                    lastLockedOutDate = reader.GetDateTime(11);
            }
            catch { }

            MembershipUser u = new MembershipUser(this.Name,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
開發者ID:samwa,項目名稱:mcms,代碼行數:91,代碼來源:SQLiteMembershipProvider.cs

示例4: LoadCertificateRecord

        X509CertificateRecord LoadCertificateRecord(SqliteDataReader reader, X509CertificateParser parser, ref byte[] buffer)
        {
            var record = new X509CertificateRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CERTIFICATE":
                    record.Certificate = DecodeCertificate (reader, parser, i, ref buffer);
                    break;
                case "PRIVATEKEY":
                    record.PrivateKey = DecodePrivateKey (reader, i, ref buffer);
                    break;
                case "ALGORITHMS":
                    record.Algorithms = DecodeEncryptionAlgorithms (reader, i);
                    break;
                case "ALGORITHMSUPDATED":
                    record.AlgorithmsUpdated = reader.GetDateTime (i);
                    break;
                case "TRUSTED":
                    record.IsTrusted = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }
開發者ID:vdaron,項目名稱:MimeKit,代碼行數:29,代碼來源:X509CertificateDatabase.cs


注:本文中的Mono.Data.Sqlite.SqliteDataReader.GetBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。