public static YellowstonePathology.Business.Domain.PhysicianClientCollection GetPhysicianClientCollectionByProviderId(string objectId) { YellowstonePathology.Business.Domain.PhysicianClientCollection result = new Domain.PhysicianClientCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblPhysicianClient where ProviderId = @ProviderId"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@ProviderId", SqlDbType.VarChar).Value = objectId; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Domain.PhysicianClient physicianClient = new Domain.PhysicianClient(); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(physicianClient, dr); sqlDataReaderPropertyWriter.WriteProperties(); result.Add(physicianClient); } } } return result; }
public static Domain.PhysicianClient GetPhysicianClient(string providerId, int clientId) { Domain.PhysicianClient result = null; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tblPhysicianClient where ProviderId = @ProviderId and ClientId = @ClientId"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@ProviderId", SqlDbType.VarChar).Value = providerId; cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.BaseData.SqlConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { result = new Domain.PhysicianClient(); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(result, dr); sqlDataReaderPropertyWriter.WriteProperties(); } } } return result; }