Exemplo n.º 1
0
        private IssueViewModel ReadIssueFromSQL(SQLiteDataReader reader)
        {
            var issue = new IssueViewModel();

            issue.IssueID = Convert.ToInt32(reader[0]);
            issue.Description = reader[1].ToString();
            issue.UserCreated = reader[2].ToString();
            issue.UserClosed = reader[3].ToString();
            issue.DateCreated = ConvertToNullableDateTime(reader[4]);
            issue.DateClosed = ConvertToNullableDateTime(reader[5]);
            issue.PlantContact = reader[6].ToString();
            issue.IssueType = Convert.ToInt32(reader[7]);
            issue.IssueState = Convert.ToInt32(reader[8]);
            issue.IssueResolution = Convert.ToInt32(reader[9]);
            issue.Priority = Convert.ToInt32(reader[10]);
            issue.Severity = Convert.ToInt32(reader[11]);

            return issue;
        }
Exemplo n.º 2
0
        IssueViewModel IDataAccess.GetIssue(int id)
        {
            using (conn = new SQLiteConnection(connectionString))
            {
                conn.Open();

                var issue = new IssueViewModel();

                var reader = new SQLiteCommand(SQLFixedQueries.SelectIssue(id), conn)
                                                    .ExecuteReader();

                while (reader.Read())
                    issue = ReadIssueFromSQL(reader);

                return issue;
            }
        }