예제 #1
0
 public ServiceStatus GetByID(int id)
 {
     ServiceStatus item = null;
     using (StoredProcedure sp = new StoredProcedure("ServiceStatuses_GetByID"))
     {
         sp.Params.Add("@ID", System.Data.SqlDbType.Int).Value = id;
         using (SqlDataReader r = (SqlDataReader)sp.ExecuteReader())
         {
             if (r != null && r.Read())
             {
                 item = new ServiceStatus();
                 item.ID = Convert.ToInt32(r["ID"]);
                 item.Name = Convert.ToString(r["Name"]);
                 item.Description = Convert.ToString(r["Description"]);
             }
         }
     }
     return item;
 }
예제 #2
0
 public List<ServiceStatus> GetAll()
 {
     List<ServiceStatus> all = new List<ServiceStatus>();
     using (StoredProcedure sp = new StoredProcedure("ServiceStatuses_GetAll"))
     {
         using (SqlDataReader r = (SqlDataReader)sp.ExecuteReader())
         {
             if (r != null)
             {
                 while (r.Read())
                 {
                     ServiceStatus item = new ServiceStatus();
                     item.ID = Convert.ToInt32(r["ID"]);
                     item.Name = Convert.ToString(r["Name"]);
                     item.Description = Convert.ToString(r["Description"]);
                     all.Add(item);
                 }
             }
         }
     }
     return all;
 }