private static YellowstonePathology.Business.Client.Model.PhysicianClient BuildPhysicianClient(BsonDocument clientDocument, BsonDocument physicianDocument, BsonValue physicianClientId) { YellowstonePathology.Business.Client.Model.PhysicianClient result = new Client.Model.PhysicianClient(); result.ClientId = clientDocument.GetValue("ClientId").AsInt32; result.ClientName = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("ClientName")); result.DistributionType = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("DistributionType")); result.FacilityType = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("FacilityType")); result.FaxNumber = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("Fax")); result.LongDistance = clientDocument.GetValue("LongDistance").AsBoolean; result.PhysicianClientId = Mongo.ValueHelper.GetStringValue(physicianClientId); result.PhysicianId = physicianDocument.GetValue("PhysicianId").AsInt32; result.PhysicianName = Mongo.ValueHelper.GetStringValue(physicianDocument.GetValue("DisplayName")); return result; }
public static YellowstonePathology.Business.Client.Model.PhysicianClientCollection GetPhysicianClientListByPhysicianLastNameV2(string physicianLastName) { YellowstonePathology.Business.Client.Model.PhysicianClientCollection result = new Client.Model.PhysicianClientCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select pp.PhysicianClientId, c.ClientId, c.ClientName, ph.PhysicianId, ph.ObjectId [ProviderId], ph.DisplayName [PhysicianName], c.DistributionType, c.Fax [FaxNumber], c.Telephone, c.LongDistance, c.FacilityType, ph.NPI " + "from tblClient c " + "join tblPhysicianClient pp on c.clientid = pp.clientid " + "Join tblPhysician ph on pp.ProviderId = ph.ObjectId " + "where ph.LastName like @LastName + '%' order by ph.LastName, ph.FirstName, c.ClientName"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add(@"LastName", SqlDbType.VarChar, 50).Value = physicianLastName; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Client.Model.PhysicianClient physicianClient = new Client.Model.PhysicianClient(); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(physicianClient, dr); sqlDataReaderPropertyWriter.WriteProperties(); result.Add(physicianClient); } } } return result; }