internal static object ResolveInc() { using (SqlConnection conn = new SqlConnection(CONN_STRING)) { using (SqlCommand cmd = new SqlCommand(" Select ID,open_for,Short_Description,Description,GroupName,State,Category,Impact,Urgency from Incidents where State = 'Resolve'", conn)) { conn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { List <Tickets> tickets = new List <Tickets>(); while (dr.Read()) { Tickets ticket = new Tickets(dr.GetInt32(0), dr.GetString(1), dr.GetString(2), dr.GetString(3), dr.GetString(4), dr.GetString(5), dr.GetString(6), dr.GetInt16(7), dr.GetInt16(8)); tickets.Add(ticket); } return(tickets); } } } }
internal static object AssignToMe(string username) { using (SqlConnection conn = new SqlConnection(CONN_STRING)) { using (SqlCommand cmd = new SqlCommand(" Select ID,open_for,Short_Description,Description,GroupName,State,Category,Impact,Urgency,Assigned_to from Incidents where Assigned_to = @userName", conn)) { cmd.Parameters.AddWithValue("@userName", username); conn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { List <Tickets> tickets = new List <Tickets>(); while (dr.Read()) { Tickets ticket = new Tickets(dr.GetInt32(0), dr.GetString(1), dr.GetString(2), dr.GetString(3), dr.GetString(4), dr.GetString(5), dr.GetString(6), dr.GetInt16(7), dr.GetInt16(8), dr.GetString(9)); tickets.Add(ticket); } return(tickets); } } } }