Exemplo n.º 1
0
        // -----------------------------------------------------
        //    List Documents
        // -----------------------------------------------------
        public static List <DocumentVersion> List(Model.ModelDocument.Document document)
        {
            var documentIssueList = new List <DocumentVersion>();

            using (var connection = new MySqlConnection(ConnString.ConnectionString))
            {
                var commandString = string.Format(
                    " SELECT " +
                    DocumentVersionFieldString() +
                    "  FROM " +
                    DocumentVersion.TableName +
                    " WHERE FKDocumentUID = '{0}'", document.UID);

                using (var command = new MySqlCommand(
                           commandString, connection))
                {
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DocumentVersion documentIssue = new DocumentVersion();
                            LoadObject(reader, documentIssue);

                            documentIssueList.Add(documentIssue);
                        }
                    }
                }
            }

            return(documentIssueList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Load reader information into object
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="documentIssue"></param>
 private static void LoadObject(MySqlDataReader reader, DocumentVersion documentIssue)
 {
     documentIssue.UID            = Convert.ToInt32(reader["UID"].ToString());
     documentIssue.FKDocumentUID  = Convert.ToInt32(reader["FKDocumentUID"].ToString());
     documentIssue.FKDocumentCUID = reader["FKDocumentCUID"].ToString();
     documentIssue.IssueNumber    = Convert.ToInt32(reader["IssueNumber"].ToString());
     documentIssue.Location       = reader["Location"].ToString();
     documentIssue.FileName       = reader["FileName"].ToString();
 }