public static Domain.PhysicianCollection GetPhysiciansByName(string firstName, string lastName) { YellowstonePathology.Business.Domain.PhysicianCollection result = new YellowstonePathology.Business.Domain.PhysicianCollection(); YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName); MongoCollection collection = server.Database.GetCollection <BsonDocument>("Physician"); MongoCursor cursor = null; if (string.IsNullOrEmpty(firstName) == false) { cursor = collection.FindAs <BsonDocument>(Query.And(Query.Matches("LastName", BsonRegularExpression.Create("^" + lastName + ".*", "i")), Query.Matches("FirstName", BsonRegularExpression.Create("^" + firstName + ".*", "i")))).SetSortOrder(SortBy.Ascending("LastName", "FirstName")); } else { cursor = collection.FindAs <BsonDocument>(Query.Matches("LastName", BsonRegularExpression.Create("^" + lastName + ".*", "i"))).SetSortOrder(SortBy.Ascending("LastName", "FirstName")); } foreach (BsonDocument bsonDocument in cursor) { YellowstonePathology.Business.Domain.Physician physician = new YellowstonePathology.Business.Domain.Physician(); YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, physician); result.Add(physician); } return(result); }
private void TextBoxProviderName_KeyUp(object sender, KeyEventArgs e) { if (this.TextBoxProviderName.Text.Length > 0) { string[] splitName = this.TextBoxProviderName.Text.Split(','); string lastName = splitName[0].Trim(); string firstName = null; if (splitName.Length > 1) { firstName = splitName[1].Trim(); } this.m_PhysicianCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysiciansByName(firstName, lastName); NotifyPropertyChanged("PhysicianCollection"); } }
public static Domain.PhysicianCollection GetPhysiciansByName(string firstName, string lastName) { YellowstonePathology.Business.Domain.PhysicianCollection result = new YellowstonePathology.Business.Domain.PhysicianCollection(); YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName); MongoCollection collection = server.Database.GetCollection<BsonDocument>("Physician"); MongoCursor cursor = null; if (string.IsNullOrEmpty(firstName) == false) { cursor = collection.FindAs<BsonDocument>(Query.And(Query.Matches("LastName", BsonRegularExpression.Create("^" + lastName + ".*", "i")), Query.Matches("FirstName", BsonRegularExpression.Create("^" + firstName + ".*", "i")))).SetSortOrder(SortBy.Ascending("LastName", "FirstName")); } else { cursor = collection.FindAs<BsonDocument>(Query.Matches("LastName", BsonRegularExpression.Create("^" + lastName + ".*", "i"))).SetSortOrder(SortBy.Ascending("LastName", "FirstName")); } foreach (BsonDocument bsonDocument in cursor) { YellowstonePathology.Business.Domain.Physician physician = new YellowstonePathology.Business.Domain.Physician(); YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, physician); result.Add(physician); } return result; }
public void GetPhysiciansByNameBothNamesTest() { YellowstonePathology.Business.Domain.PhysicianCollection result = YellowstonePathology.Business.Gateway.PhysicianClientGatewayMongo.GetPhysiciansByName("m", "brow"); Assert.IsTrue(result.Count > 0); }
public void GetPhysiciansByNameLastNameOnlyTest() { YellowstonePathology.Business.Domain.PhysicianCollection result = YellowstonePathology.Business.Gateway.PhysicianClientGatewayMongo.GetPhysiciansByName(string.Empty, "brow"); Assert.IsTrue(result.Count > 0); }
public void GetPhysiciansByClientIdTest() { YellowstonePathology.Business.Domain.PhysicianCollection physicianCollection = YellowstonePathology.Business.Gateway.PhysicianClientGatewayMongo.GetPhysiciansByClientId(558); Assert.IsTrue(physicianCollection.Count > 0); }