public static YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection GetPhysicianNameViewCollectionByPhysicianLastName(string physicianLastName) { YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection result = new YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection(); YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName); MongoCollection clientCollection = server.Database.GetCollection <BsonDocument>("Client"); MongoCollection collection = server.Database.GetCollection <BsonDocument>("Physician"); MongoCursor cursor = collection.FindAs <BsonDocument>(Query.Matches("LastName", BsonRegularExpression.Create("^" + physicianLastName + ".*", "i"))).SetSortOrder(SortBy.Ascending("FirstName")); foreach (BsonDocument physicianDocument in cursor) { BsonDocument clientDocument = clientCollection.FindOneAs <BsonDocument>(Query.EQ("ClientId", physicianDocument.GetValue("HomeBaseClientId"))); YellowstonePathology.Business.Client.Model.PhysicianNameView physicianNameView = new YellowstonePathology.Business.Client.Model.PhysicianNameView(); physicianNameView.PhysicianId = physicianDocument.GetValue("PhysicianId").AsInt32; physicianNameView.FirstName = Mongo.ValueHelper.GetStringValue(physicianDocument.GetValue("FirstName")); physicianNameView.LastName = Mongo.ValueHelper.GetStringValue(physicianDocument.GetValue("LastName")); physicianNameView.HomeBaseFax = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("Fax")); physicianNameView.HomeBasePhone = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("Telephone")); result.Add(physicianNameView); } return(result); }
public static YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection GetPhysicianNameViewCollectionByPhysicianLastName(string physicianLastName) { YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection result = new YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection(); YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName); MongoCollection clientCollection = server.Database.GetCollection<BsonDocument>("Client"); MongoCollection collection = server.Database.GetCollection<BsonDocument>("Physician"); MongoCursor cursor = collection.FindAs<BsonDocument>(Query.Matches("LastName", BsonRegularExpression.Create("^" + physicianLastName + ".*", "i"))).SetSortOrder(SortBy.Ascending("FirstName")); foreach (BsonDocument physicianDocument in cursor) { BsonDocument clientDocument = clientCollection.FindOneAs<BsonDocument>(Query.EQ("ClientId", physicianDocument.GetValue("HomeBaseClientId"))); YellowstonePathology.Business.Client.Model.PhysicianNameView physicianNameView = new YellowstonePathology.Business.Client.Model.PhysicianNameView(); physicianNameView.PhysicianId = physicianDocument.GetValue("PhysicianId").AsInt32; physicianNameView.FirstName = Mongo.ValueHelper.GetStringValue(physicianDocument.GetValue("FirstName")); physicianNameView.LastName = Mongo.ValueHelper.GetStringValue(physicianDocument.GetValue("LastName")); physicianNameView.HomeBaseFax = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("Fax")); physicianNameView.HomeBasePhone = Mongo.ValueHelper.GetStringValue(clientDocument.GetValue("Telephone")); result.Add(physicianNameView); } return result; }
public static YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection GetPhysicianNameViewCollectionByPhysicianLastNameV2(string physicianLastName) { YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection result = new YellowstonePathology.Business.Client.Model.PhysicianNameViewCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select ph.PhysicianId, ph.ObjectId as ProviderId, ph.FirstName, ph.LastName, c.Telephone [HomeBasePhone], c.Fax [HomeBaseFax] " + "from tblPhysician ph " + "left outer join tblClient c on ph.HomeBaseClientId = c.ClientId " + "where ph.LastName like @LastName + '%' order by ph.FirstName "; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = physicianLastName; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.BaseData.SqlConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.Client.Model.PhysicianNameView physicianNameView = new YellowstonePathology.Business.Client.Model.PhysicianNameView(); YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(physicianNameView, dr); sqlDataReaderPropertyWriter.WriteProperties(); result.Add(physicianNameView); } } } return result; }