Exemplo n.º 1
0
        public static YellowstonePathology.Business.Client.Model.ClientCollection GetClientsByClientName(string clientName)
        {
            YellowstonePathology.Business.Client.Model.ClientCollection result = new YellowstonePathology.Business.Client.Model.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection = server.Database.GetCollection <BsonDocument>("Client");
            MongoCursor     cursor     = collection.FindAs <BsonDocument>(Query.Matches("ClientName", BsonRegularExpression.Create("^" + clientName + ".*", "i")));

            foreach (BsonDocument bsonDocument in cursor)
            {
                YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client)YellowstonePathology.Business.Mongo.BSONObjectBuilder.Build(bsonDocument, typeof(YellowstonePathology.Business.Client.Model.Client));
                result.Add(client);
            }

            return(result);
        }
        public static YellowstonePathology.Business.Client.Model.ClientCollection GetAllClients()
        {
            YellowstonePathology.Business.Client.Model.ClientCollection result = new YellowstonePathology.Business.Client.Model.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection = server.Database.GetCollection<BsonDocument>("Client");
            MongoCursor cursor = collection.FindAllAs<BsonDocument>();

            foreach (BsonDocument bsonDocument in cursor)
            {
                YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, client);
                result.Add(client);
            }

            return result;
        }
Exemplo n.º 3
0
        public static YellowstonePathology.Business.Client.Model.ClientCollection GetAllClients()
        {
            YellowstonePathology.Business.Client.Model.ClientCollection result = new YellowstonePathology.Business.Client.Model.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection = server.Database.GetCollection <BsonDocument>("Client");
            MongoCursor     cursor     = collection.FindAllAs <BsonDocument>();

            foreach (BsonDocument bsonDocument in cursor)
            {
                YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, client);
                result.Add(client);
            }

            return(result);
        }
        public static YellowstonePathology.Business.Client.Model.ClientCollection GetClientsByClientName(string clientName)
        {
            YellowstonePathology.Business.Client.Model.ClientCollection result = new YellowstonePathology.Business.Client.Model.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection = server.Database.GetCollection<BsonDocument>("Client");
            MongoCursor cursor = collection.FindAs<BsonDocument>(Query.Matches("ClientName", BsonRegularExpression.Create("^" + clientName + ".*", "i")));

            foreach (BsonDocument bsonDocument in cursor)
            {
                YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client)YellowstonePathology.Business.Mongo.BSONObjectBuilder.Build(bsonDocument, typeof(YellowstonePathology.Business.Client.Model.Client));
                result.Add(client);
            }

            return result;
        }
 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;
 }
Exemplo n.º 6
0
        /*private static YellowstonePathology.Business.Client.Model.ProviderClient BuildHomeBaseProviderClient(XElement providerElement)
        {
            YellowstonePathology.Business.Client.Model.ProviderClient result = new Client.Model.ProviderClient();
            YellowstonePathology.Business.Domain.Physician physician = new Domain.Physician();
            YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriterP = new Persistence.XmlPropertyWriter(providerElement, physician);
            xmlPropertyWriterP.Write();
            result.Physician = physician;

            XElement clientElement = providerElement.Element("Client");
            if (clientElement != null)
            {
                YellowstonePathology.Business.Client.Model.Client client = new Client.Model.Client();
                YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriterC = new Persistence.XmlPropertyWriter(clientElement, client);
                xmlPropertyWriterC.Write();
                result.Client = client;
            }

            XElement providerClientElement = providerElement.Element("ProviderClient");
            if (providerClientElement != null)
            {
                YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriterPC = new Persistence.XmlPropertyWriter(providerClientElement, result);
                xmlPropertyWriterPC.Write();
            }
            return result;
        }*/
        private static YellowstonePathology.Business.Client.Model.ProviderClientCollection BuildProviderClientCollection(SqlCommand cmd)
        {
            YellowstonePathology.Business.Client.Model.ProviderClientCollection result = new Client.Model.ProviderClientCollection();
            YellowstonePathology.Business.Client.Model.ClientCollection clientCollection = new YellowstonePathology.Business.Client.Model.ClientCollection();
            using (SqlConnection cn = new SqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.KeyInfo))
                {
                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Client.Model.ProviderClient providerClient = new Client.Model.ProviderClient();
                        YellowstonePathology.Business.Domain.Physician physician = new Domain.Physician();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(physician, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        providerClient.Physician = physician;
                        result.Add(providerClient);
                    }
                    dr.NextResult();
                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                        Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        clientCollection.Add(client);
                    }
                    dr.NextResult();
                    while (dr.Read())
                    {
                        string providerClientId = dr["PhysicianClientId"].ToString();
                        string physicianObjectId = dr["ProviderId"].ToString();
                        foreach(Client.Model.ProviderClient providerClient in result)
                        {
                            if(providerClient.Physician.ObjectId == physicianObjectId)
                            {
                                providerClient.PhysicianClientId = providerClientId;
                                break;
                            }
                        }
                    }
                }
            }

            foreach (Client.Model.ProviderClient providerClient in result)
            {
                foreach (Client.Model.Client client in clientCollection)
                {
                    if (client.ClientId == providerClient.Physician.HomeBaseClientId)
                    {
                        providerClient.Client = client;
                        break;
                    }
                }
            }

            return result;
        }