public static YellowstonePathology.Business.Client.Model.Client GetClientByClientId(int clientId) { #if MONGO return PhysicianClientGatewayMongo.GetClientByClientId(clientId); #else SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT c.*, (SELECT * from tblClientLocation where ClientId = c.ClientId for xml path('ClientLocation'), type) ClientLocationCollection " + " FROM tblClient c where c.ClientId = @ClientId for xml Path('Client'), type"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId; ClientBuilder builder = new ClientBuilder(); XElement document = PhysicianClientGateway.GetXElementFromCommand(cmd); builder.Build(document); return builder.Client; #endif }
private static YellowstonePathology.Business.Client.Model.ClientCollection BuildClientCollection(XElement sourceElement) { YellowstonePathology.Business.Client.Model.ClientCollection clientCollection = new YellowstonePathology.Business.Client.Model.ClientCollection(); if (sourceElement != null) { foreach (XElement clientElement in sourceElement.Elements("Client")) { ClientBuilder builder = new ClientBuilder(); builder.Build(clientElement); YellowstonePathology.Business.Client.Model.Client client = builder.Client; clientCollection.Add(client); } } return clientCollection; }