当前位置: 首页>>代码示例>>C#>>正文


C# SqliteDataReader.GetDateTime方法代码示例

本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetDateTime方法的具体用法?C# SqliteDataReader.GetDateTime怎么用?C# SqliteDataReader.GetDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Data.Sqlite.SqliteDataReader的用法示例。


在下文中一共展示了SqliteDataReader.GetDateTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseToUser

        internal bool ParseToUser(SqliteDataReader reader)
        {
            bool success = false;

            if (reader.HasRows)
            {
                reader.Read();

                // Follow the SQL -> Data object
                username = reader.GetString(0);
                password = reader.GetString(1);
                fullName = reader.GetString(2);
                dateJoined = reader.GetDateTime(3);

                success = true;
            }

            return success;
        }
开发者ID:pablok2,项目名称:Fridge,代码行数:19,代码来源:UserDefinition.cs

示例2: 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

示例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: GetTaskCoreFromCursor

        /// <summary>
        /// Gets the taskcore object from the sqlite cursor
        /// </summary>
        /// <param name="cursor">
        /// A <see cref="SqliteDataReader"/>. This won't be traversed, must be 
        /// called each time the cursor moves ahead
        /// </param>
        /// <returns>
        /// A <see cref="TaskCore"/> - allocated and re-created
        /// Returns null if reading failed
        /// </returns>
        public static TaskCore GetTaskCoreFromCursor(SqliteDataReader cursor)
        {
            // this assumes a single task exists

            // the task to be extracted from the cursor
            TaskCore task = new TaskCore ();

            try {
                task.Id = cursor.GetInt32 (cursor.GetOrdinal ("TaskId"));
                task.Depends = cursor.GetInt32 (cursor.GetOrdinal ("Depends"));
                task.Title = cursor.GetString (cursor.GetOrdinal ("Name"));
                task.Description = cursor.GetString (cursor.GetOrdinal ("Description"));
                task.Priority = cursor.GetInt32 (cursor.GetOrdinal ("Priority"));
                task.DueDate = cursor.GetDateTime (cursor.GetOrdinal ("DueDate"));
                task.CreateDate = cursor.GetDateTime (cursor.GetOrdinal ("CreateDate"));
            } catch {
                log.ERROR ("Reading from cursor failed");
                return null;
            }

            // now, extract the comments.
            SqliteCommand cmd = new SqliteCommand (conn);

            cmd.CommandText = String.Format ("SELECT * FROM Comments WHERE (TaskId = {0});", task.Id);
            log.WARN ("Trying to read comments with query - " + cmd.CommandText);

            SqliteDataReader commentCursor = cmd.ExecuteReader ();

            while (commentCursor.Read ()) {
                CommentData comment = new CommentData ();

                try {
                    comment.Id = commentCursor.GetInt32 (commentCursor.GetOrdinal ("CommentID"));
                    comment.TaskId = commentCursor.GetInt32 (commentCursor.GetOrdinal ("TaskId"));
                    comment.Title = commentCursor.GetString (commentCursor.GetOrdinal ("Subject"));
                    comment.Author = commentCursor.GetString (commentCursor.GetOrdinal ("Author"));
                    comment.Content = commentCursor.GetString (commentCursor.GetOrdinal ("Message"));
                    comment.PostDate = commentCursor.GetDateTime (commentCursor.GetOrdinal ("PostDate"));
                    log.DEBUG ("Extracted comment - " + comment.ToString ());
                } catch {
                    log.ERROR ("Something went wrong while retrieving comment");
                    return null;
                }
                task.Comments.Add (comment);
            }
            log.DEBUG ("Extracted task as : " + task.ToString ());
            return task;
        }
开发者ID:skyronic,项目名称:TFAddin,代码行数:59,代码来源:DBHelper.cs

示例5: 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

示例6: 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.GetDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。