public void GoNext()
        {
            YellowstonePathology.Business.View.ClientLocationView clientLocationView = null;
            if (this.ListViewFavoriteClients.SelectedItem != null)
            {
                clientLocationView = this.ListViewFavoriteClients.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }
            else if (this.ListViewClientSearch.SelectedItem != null)
            {
                clientLocationView = this.ListViewClientSearch.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }

            if (clientLocationView != null)
            {
                this.m_Client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(clientLocationView.ClientId);
                this.m_FavoriteClientCollection.AddRecent(this.m_Client);

                if (this.m_Client != null)
                {
                    this.m_Client.ClientLocationCollection.SetCurrentLocation(clientLocationView.ClientLocationId);
                    bool useRequisition = false;
                    if (this.CheckBoxUseRequisition.IsChecked == true)
                    {
                        useRequisition = true;
                    }
                    List <object> returnData = new List <object>();
                    returnData.Add(this.m_Client);
                    returnData.Add(useRequisition);
                    UI.Navigation.PageNavigationReturnEventArgs args = new UI.Navigation.PageNavigationReturnEventArgs(UI.Navigation.PageNavigationDirectionEnum.Next, returnData);
                    this.Return(this, args);
                }
            }
            this.ListViewFavoriteClients.SelectedIndex = -1;
        }
Beispiel #2
0
        public ClientEntry(YellowstonePathology.Business.Client.Model.Client client)
        {
            this.m_Client = client;
            this.m_SystemIdentity = Business.User.SystemIdentity.Instance;

            this.m_ClientPhysicianView = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientPhysicianViewByClientIdV2(this.m_Client.ClientId);

            if (this.m_ClientPhysicianView == null)
            {
                this.m_ClientPhysicianView = new Business.View.ClientPhysicianView();
            }

            this.m_InsuranceTypeCollection = new Business.Billing.Model.InsuranceTypeCollection(true);

            this.m_FacilityTypes = new List<string>();
            this.m_FacilityTypes.Add("Hospital");
            this.m_FacilityTypes.Add("Hospital Owned Clinic");
            this.m_FacilityTypes.Add("Non-Grandfathered Hospital");
            this.m_FacilityTypes.Add("Non-Hospital");

            this.m_DistributionTypeList = new YellowstonePathology.Business.ReportDistribution.Model.DistributionTypeList();
            this.m_BillingRuleSetCollection = YellowstonePathology.Business.Billing.Model.BillingRuleSetCollection.GetAllRuleSets();
            this.m_ClientSupplyOrderCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientSupplyOrderCollectionByClientId(this.m_Client.ClientId);

            InitializeComponent();

            this.DataContext = this;
            Closing += ClientEntry_Closing;
        }
Beispiel #3
0
        public void Create(string patientName, string providerName, YellowstonePathology.Business.Client.Model.Client client, string letterBody)
        {
            string templateName = @"\\CFileServer\documents\ReportTemplates\XmlTemplates\ClientMissingInfoBoldFax.1.xml";

            XmlDocument         xmlDocument      = new XmlDocument();
            XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(m_ReportXml.NameTable);

            nameSpaceManager.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");

            xmlDocument.Load(templateName);
            this.m_ReportXml = xmlDocument;

            this.ReplaceText("client_name", client.ClientName + " - " + providerName);
            this.ReplaceText("fax_number", YellowstonePathology.Business.Helper.PhoneNumberHelper.FormatWithDashes(client.Fax));
            this.ReplaceText("current_date", DateTime.Today.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
            this.ReplaceText("patient_name", patientName);

            this.ReplaceText("patient_name", patientName);
            this.ReplaceText("provider_name", providerName);
            this.SetXMLNodeParagraphData("letter_body", letterBody);

            string xmlDocumentFileName = YellowstonePathology.Properties.Settings.Default.ClientMissingInformationLetterFileName.Replace("doc", "xml");

            xmlDocument.Save(xmlDocumentFileName);

            Business.Helper.FileConversionHelper.ConvertXMLToDoc(xmlDocumentFileName, xmlDocumentFileName.Replace(".xml", ".doc"));
            Business.Helper.FileConversionHelper.ConvertDocToXPS(xmlDocumentFileName, xmlDocumentFileName.Replace(".xml", ".xps"));

            //YellowstonePathology.Business.Document.CaseDocument.SaveXMLAsDocFromFileName(xmlDocumentFileName);
            //YellowstonePathology.Business.Helper.FileConversionHelper.SaveDocAsXPS(xmlDocumentFileName.Replace(".DOC", ".XPS"));
        }
Beispiel #4
0
 public virtual void SetBillingType()
 {
     YellowstonePathology.Business.Client.Model.Client           client         = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(this.m_AccessionOrder.ClientId);
     YellowstonePathology.Business.Billing.Model.BillingRuleSet  billingRuleSet = YellowstonePathology.Business.Billing.Model.BillingRuleSetCollection.GetRuleSetByRuleSetId(client.BillingRuleSetId2);
     YellowstonePathology.Business.Billing.Model.BillingTypeEnum billingType    = billingRuleSet.GetBillingType(this.m_AccessionOrder.PatientType, this.m_AccessionOrder.PrimaryInsurance, this.m_AccessionOrder.SecondaryInsurance, this.m_PanelSetOrder.Ordered14DaysPostDischarge, this.m_PanelSetOrder.PanelSetId);
     this.m_PanelSetOrder.BillingType = billingType.ToString();
 }
Beispiel #5
0
        private void ButtonAddToDistribution_Click(object sender, RoutedEventArgs e)
        {
            if (this.ListBoxNewDistributionSelection.SelectedItem != null)
            {
                YellowstonePathology.Business.Client.Model.Client clientToAdd = (YellowstonePathology.Business.Client.Model.Client) this.ListBoxNewDistributionSelection.SelectedItem;
                if (this.ListBoxClientMembership.SelectedItems.Count != 0)
                {
                    YellowstonePathology.Business.Client.Model.Client clientExisting = (Business.Client.Model.Client) this.ListBoxClientMembership.SelectedItem;

                    YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_Physician.ObjectId, clientToAdd.ClientId);
                    string physicianClientId = physicianClient.PhysicianClientId;
                    foreach (YellowstonePathology.Business.Client.Model.PhysicianClientDistributionView physicianClientDistributionView in this.m_PhysicianClientDistributionViewList)
                    {
                        if (physicianClientDistributionView.PhysicianClientDistribution.DistributionID == physicianClientId)
                        {
                            MessageBox.Show("The item has already been added.");
                            return;
                        }
                    }

                    string distributionType = clientToAdd.DistributionType;
                    if (AreDistributionTypesIncompatible(clientExisting.DistributionType, clientToAdd.DistributionType) == true)
                    {
                        distributionType = clientToAdd.AlternateDistributionType;
                    }

                    string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
                    YellowstonePathology.Business.Client.Model.PhysicianClientDistribution physicianClientDistribution = new Business.Client.Model.PhysicianClientDistribution(objectId, this.m_PhysicianClientId, physicianClientId, distributionType);
                    YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClientDistribution, this);

                    this.m_PhysicianClientDistributionViewList = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionsV2(this.m_PhysicianClientId);
                    this.NotifyPropertyChanged("PhysicianClientDistributionViewList");
                }
            }
        }
        public void GoNext()
        {
            YellowstonePathology.Business.View.ClientLocationView clientLocationView = null;
            if (this.ListViewFavoriteClients.SelectedItem != null)
            {
                clientLocationView = this.ListViewFavoriteClients.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }
            else if (this.ListViewClientSearch.SelectedItem != null)
            {
                clientLocationView = this.ListViewClientSearch.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }

            if (clientLocationView != null)
            {
                this.m_Client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(clientLocationView.ClientId);
                this.m_FavoriteClientCollection.AddRecent(this.m_Client);

                if (this.m_Client != null)
                {
                    this.m_Client.ClientLocationCollection.SetCurrentLocation(clientLocationView.ClientLocationId);
                    UI.Navigation.PageNavigationReturnEventArgs args = new UI.Navigation.PageNavigationReturnEventArgs(UI.Navigation.PageNavigationDirectionEnum.Next, this.m_Client);
                    this.Return(this, args);
                }
            }
            this.ListViewFavoriteClients.SelectedIndex = -1;
        }
        public FacilityEntry(YellowstonePathology.Business.Facility.Model.Facility facility, bool isNewFacility)
        {
            this.m_IsNewFacility = isNewFacility;
            if (isNewFacility == true)
            {
                this.m_Facility = new Business.Facility.Model.Facility();
            }
            else
            {
                this.m_Facility = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.PullFacility(facility.FacilityId, this);
                if (this.m_Facility.ClientId != 0)
                {
                    this.m_Client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(this.m_Facility.ClientId);
                }
            }

            this.m_PaymentTypeList = new List <string>();
            this.m_PaymentTypeList.Add("SENDER");
            this.m_PaymentTypeList.Add("THIRD_PARTY");
            this.m_PaymentTypeList.Add("RECIPIENT");

            this.m_AccessioningFacilities = YellowstonePathology.Business.Facility.Model.FacilityCollection.GetAllYPFacilities();
            this.m_AccessioningFacilities.Insert(0, new Business.Facility.Model.Facility());

            InitializeComponent();
            this.DataContext = this;
            Closing         += FacilityEntry_Closing;
        }
 private void ButtonOK_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListViewClients.SelectedItem != null)
     {
         this.m_Client     = (YellowstonePathology.Business.Client.Model.Client) this.ListViewClients.SelectedItem;
         this.DialogResult = true;
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("No client is selected." + Environment.NewLine +
                                                   "Choosing Yes will close indicating a selection of no client, choosing No will just close, choosing Cancel will keep the dialog open.",
                                                   "No Client selected", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes);
         if (result == MessageBoxResult.Yes)
         {
             this.DialogResult = true;
         }
         if (result == MessageBoxResult.No)
         {
             this.DialogResult = false;
         }
         if (result == MessageBoxResult.Cancel)
         {
             return;
         }
     }
     Close();
 }
Beispiel #9
0
        public void Create(string patientName, YellowstonePathology.Business.Client.Model.Client client, string letterBody)
        {
            string templateName = @"\\CFileServer\documents\ReportTemplates\XmlTemplates\ClientMissingInfoFax.xml";

            XmlDocument         xmlDocument      = new XmlDocument();
            XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(m_ReportXml.NameTable);

            nameSpaceManager.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");

            xmlDocument.Load(templateName);
            this.m_ReportXml = xmlDocument;

            this.ReplaceText("client_name", client.ClientName);
            this.ReplaceText("fax_number", YellowstonePathology.Business.Domain.PhoneNumber.Format(client.Fax));
            this.ReplaceText("current_date", DateTime.Today.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
            this.ReplaceText("patient_name", patientName);

            this.SetXMLNodeParagraphData("letter_body", letterBody);

            string xmlDocumentFileName = YellowstonePathology.Business.Properties.Settings.Default.ClientMissingInformationLetterFileName.ToUpper().Replace("DOC", "XML");

            xmlDocument.Save(xmlDocumentFileName);

            YellowstonePathology.Business.Document.CaseDocument.SaveXMLAsDocFromFileName(xmlDocumentFileName);
        }
Beispiel #10
0
        public static Domain.ClientCollection GetClientsByPhysicianId(int physicianId)
        {
            Domain.ClientCollection result = new Domain.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection physicianClientCollection         = server.Database.GetCollection <BsonDocument>("PhysicianClient");
            MongoCursor     physicianClientCursor             = physicianClientCollection.FindAs <BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianId)));

            List <BsonValue> clientIdList = new List <BsonValue>();

            foreach (BsonDocument bsonDocument in physicianClientCursor)
            {
                clientIdList.Add(bsonDocument.GetValue("ClientId").AsInt32);
            }

            MongoCollection clientCollection = server.Database.GetCollection <BsonDocument>("Client");
            MongoCursor     clientCursor     = clientCollection.FindAs <BsonDocument>(Query.In("ClientId", clientIdList));

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

            return(result);
        }
Beispiel #11
0
        public static View.PhysicianClientView GetPhysicianClientView(int physicianId)
        {
            View.PhysicianClientView physicianClientView = new View.PhysicianClientView();

            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection physicianCollection = server.Database.GetCollection <BsonDocument>("Physician");
            BsonDocument    physicianDocument   = physicianCollection.FindOneAs <BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianId)));

            YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(physicianDocument, physicianClientView);

            MongoCollection  physicianClientCollection = server.Database.GetCollection <BsonDocument>("PhysicianClient");
            MongoCursor      physicianClientCursor     = physicianClientCollection.FindAs <BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianClientView.PhysicianId)));
            List <BsonValue> clientIdList = new List <BsonValue>();

            foreach (BsonDocument bsonDocument in physicianClientCursor)
            {
                clientIdList.Add(bsonDocument.GetValue("ClientId"));
            }

            MongoCollection clientCollection = server.Database.GetCollection <BsonDocument>("Client");
            MongoCursor     clientCursor     = clientCollection.FindAs <BsonDocument>(Query.In("ClientId", clientIdList));

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

            return(physicianClientView);
        }
Beispiel #12
0
 private void BuildClient(YellowstonePathology.Business.Client.Model.Client client)
 {
     using (MySqlConnection cn = new MySqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
     {
         cn.Open();
         this.m_SQLCommand.Connection = cn;
         using (MySqlDataReader dr = this.m_SQLCommand.ExecuteReader(CommandBehavior.KeyInfo))
         {
             while (dr.Read())
             {
                 Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                 sqlDataReaderPropertyWriter.WriteProperties();
             }
             if (dr.IsClosed == false)
             {
                 dr.NextResult();
                 while (dr.Read())
                 {
                     YellowstonePathology.Business.Client.Model.ClientLocation clientLocation = new YellowstonePathology.Business.Client.Model.ClientLocation();
                     Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter      = new Persistence.SqlDataReaderPropertyWriter(clientLocation, dr);
                     sqlDataReaderPropertyWriter.WriteProperties();
                     client.ClientLocationCollection.Add(clientLocation);
                 }
             }
         }
     }
 }
        private void ButtonFaxLetter_Click(object sender, RoutedEventArgs e)
        {
            if (this.m_AccessionOrder.ClientId != 0)
            {
                YellowstonePathology.Business.Client.Model.Client client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(this.m_AccessionOrder.ClientId);
                string letterBody = this.TextBoxLetterBody.Text;

                if (this.m_FormatBold)
                {
                    MissingSignatureLetterBody missingSignatureLetterBody = new MissingSignatureLetterBody();
                    StringBuilder body = new StringBuilder();
                    letterBody = missingSignatureLetterBody.GetLetterBodyForFax(this.m_TestName);
                    YellowstonePathology.Business.Document.ClientLetterBold clientLetterBold = new YellowstonePathology.Business.Document.ClientLetterBold();
                    clientLetterBold.Create(this.m_PatientNameWithBirthDate, this.m_AccessionOrder.ClientName, client, letterBody);
                }
                else
                {
                    YellowstonePathology.Business.Document.ClientLetter clientLetter = new YellowstonePathology.Business.Document.ClientLetter();
                    clientLetter.Create(this.m_PatientNameWithBirthDate, client, letterBody);
                }

                DateTime timeToSchedule = DateTime.Parse(DateTime.Today.ToShortDateString() + " 13:00");
                if (DateTime.Now >= timeToSchedule)
                {
                    timeToSchedule = timeToSchedule.AddDays(1);
                }

                YellowstonePathology.Business.ReportDistribution.Model.ScheduledFaxSubmission.Submit(client.Fax, client.LongDistance, "Missing Information", @"C:\\Program Files\\Yellowstone Pathology Institute\\ClientMissingInformationLetter.xml", timeToSchedule);
            }
            else
            {
                MessageBox.Show("Client must be selected before a fax can be generated.");
            }
        }
Beispiel #14
0
 public void Build(SqlCommand cmd)
 {
     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())
             {
                 this.m_Client = new YellowstonePathology.Business.Client.Model.Client();
                 Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(this.m_Client, dr);
                 sqlDataReaderPropertyWriter.WriteProperties();
             }
             if (dr.IsClosed == false)
             {
                 dr.NextResult();
                 while (dr.Read())
                 {
                     YellowstonePathology.Business.Client.Model.ClientLocation clientLocation = new YellowstonePathology.Business.Client.Model.ClientLocation();
                     Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(clientLocation, dr);
                     sqlDataReaderPropertyWriter.WriteProperties();
                     this.m_Client.ClientLocationCollection.Add(clientLocation);
                 }
             }
         }
     }
 }
Beispiel #15
0
 private void HandleClientFound(UI.Navigation.PageNavigationReturnEventArgs e)
 {
     YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client)e.Data;
     this.m_ClientOrderReceivingHandler.IFoundAClient(client);
     Receiving.GetClientOrderPath getClientOrderPath = new Receiving.GetClientOrderPath(this.m_ClientOrderReceivingHandler, this.m_LoginPageWindow.PageNavigator);
     getClientOrderPath.Return += new Receiving.GetClientOrderPath.ReturnEventHandler(GetClientOrderPath_Return);
     getClientOrderPath.Start();
 }
Beispiel #16
0
 private void ComboBoxHomeBase_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.ComboBoxHomeBase.SelectedItem != null)
     {
         YellowstonePathology.Business.Client.Model.Client selectedHomeBaseClient = (YellowstonePathology.Business.Client.Model.Client) this.ComboBoxHomeBase.SelectedItem;
         this.m_Physician.HomeBaseClientId = selectedHomeBaseClient.ClientId;
     }
 }
Beispiel #17
0
        protected string ReplaceClientNameAddress(string text, YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
        {
            YellowstonePathology.Business.Client.Model.Client client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(accessionOrder.ClientId);
            string result = text.Replace("[clientname]", client.ClientName);

            result = result.Replace("[clientcitystate]", client.City + ", " + client.State);
            return(result);
        }
 private void DeleteClient(YellowstonePathology.Business.Client.Model.Client client)
 {
     YellowstonePathology.Business.Client.Model.ClientLocationCollection clientLocationCollection = client.ClientLocationCollection;
     for (int i = clientLocationCollection.Count - 1; i > -1; i--)
     {
         YellowstonePathology.Business.Persistence.DocumentGateway.Instance.DeleteDocument(clientLocationCollection[i], this);
     }
     YellowstonePathology.Business.Persistence.DocumentGateway.Instance.DeleteDocument(client, this);
 }
        public void FaxReport(YellowstonePathology.Business.Reports.Cytology.CytologyUnsatLetterItem item)
        {
            string path = @"\\CFileServer\documents\Reports\Cytology\CytologyAbnormalUnsatLetter\";

            YellowstonePathology.Business.Client.Model.Client client = Business.Gateway.PhysicianClientGateway.GetClientByClientId(item.ClientId);
            string fileName = path + item.PhysicianClientId.ToString() + ".doc";

            YellowstonePathology.Business.ReportDistribution.Model.FaxSubmission.Submit(client.Fax, "Cytology Unsat Letters", fileName);
        }
Beispiel #20
0
 private void HandleReferringProvider(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
 {
     YellowstonePathology.Business.Client.Model.Client client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(accessionOrder.ClientId);
     if (client.HasReferringProvider == true)
     {
         PhysicianClientDistributionListItem physicianClientDistribution = YellowstonePathology.Business.Gateway.ReportDistributionGateway.GetPhysicianClientDistributionCollection(client.ReferringProviderClientId);
         this.Add(physicianClientDistribution);
     }
 }
 public static YellowstonePathology.Business.Client.Model.Client GetClientByClientId(int clientId)
 {
     YellowstonePathology.Business.Client.Model.Client result = new YellowstonePathology.Business.Client.Model.Client();
     YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
     MongoCollection collection = server.Database.GetCollection<BsonDocument>("Client");
     BsonDocument bsonDocument = collection.FindOneAs<BsonDocument>(Query.EQ("ClientId", BsonValue.Create(clientId)));
     YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, result);
     return result;
 }
 private void ListViewClients_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (this.ListViewClients.SelectedItem != null)
     {
         this.m_Client     = (YellowstonePathology.Business.Client.Model.Client) this.ListViewClients.SelectedItem;
         this.DialogResult = true;
         Close();
     }
 }
Beispiel #23
0
 private void ButtonRemoveFromGroup_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListViewMembers.SelectedItem != null)
     {
         YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client) this.ListViewMembers.SelectedItem;
         YellowstonePathology.Business.Gateway.PhysicianClientGateway.DeleteClientGroupClient(client.ClientId, this.m_ClientGroup.ClientGroupId);
         this.m_MembersClientCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientCollectionByClientGroupId(this.m_ClientGroup.ClientGroupId);
         this.NotifyPropertyChanged("MembersClientCollection");
     }
 }
Beispiel #24
0
        public static YellowstonePathology.Business.Client.Model.Client GetClientByClientId(int clientId)
        {
            YellowstonePathology.Business.Client.Model.Client result = new YellowstonePathology.Business.Client.Model.Client();
            YellowstonePathology.Business.Mongo.Server        server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection   = server.Database.GetCollection <BsonDocument>("Client");
            BsonDocument    bsonDocument = collection.FindOneAs <BsonDocument>(Query.EQ("ClientId", BsonValue.Create(clientId)));

            YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, result);
            return(result);
        }
        private void ListBoxClients_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.ListViewClients.SelectedItem != null)
            {
                YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client) this.ListViewClients.SelectedItem;

                ClientEntryV2 clientEntry = new ClientEntryV2(client, false);
                clientEntry.ShowDialog();
            }
        }
        private void ListBoxClients_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.ListViewClients.SelectedItem != null)
            {
                YellowstonePathology.Business.Client.Model.Client listClient   = (YellowstonePathology.Business.Client.Model.Client) this.ListViewClients.SelectedItem;
                YellowstonePathology.Business.Client.Model.Client pulledClient = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.PullClient(listClient.ClientId, this);

                ClientEntry clientEntry = new ClientEntry(pulledClient);
                clientEntry.ShowDialog();
            }
        }
Beispiel #27
0
        private void SetClient()
        {
            this.m_ClientOrderReceivingHandler = new Receiving.ClientOrderReceivingHandler(this.m_LoginPageWindow);
            this.m_ClientOrderReceivingHandler.IFoundAClientOrder(this.m_ClientOrder);

            YellowstonePathology.Business.Client.Model.Client client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(this.m_ClientOrderReceivingHandler.ClientOrder.ClientId);
            client.ClientLocationCollection.SetCurrentLocation(client.ClientLocationCollection[0].ClientLocationId);
            this.m_ClientOrderReceivingHandler.IFoundAClient(client);

            this.ShowItemsReceivedPage();
        }
Beispiel #28
0
 private void ListBoxClientMembership_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.ListBoxClientMembership.SelectedItem != null)
     {
         YellowstonePathology.Business.Client.Model.Client    client          = (YellowstonePathology.Business.Client.Model.Client) this.ListBoxClientMembership.SelectedItem;
         YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_Physician.ObjectId, client.ClientId);
         this.m_PhysicianClientId = physicianClient.PhysicianClientId;
         this.m_PhysicianClientDistributionViewList = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionsV2(this.m_PhysicianClientId);
         this.NotifyPropertyChanged("PhysicianClientDistributionViewList");
     }
 }
        private void ResetDistributionWhenIncompatible(YellowstonePathology.Business.Client.Model.PhysicianClientDistributionListItem physicianClientDistribution)
        {
            YellowstonePathology.Business.Client.Model.Client accessionClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(this.m_AccessionOrder.ClientId);
            YellowstonePathology.Business.ReportDistribution.Model.IncompatibleDistributionTypeCollection incompatibleDistributionTypeCollection = new Business.ReportDistribution.Model.IncompatibleDistributionTypeCollection();
            bool distributionsAreIncompatible = incompatibleDistributionTypeCollection.TypesAreIncompatible(accessionClient.DistributionType, physicianClientDistribution.DistributionType);

            if (distributionsAreIncompatible == true)
            {
                YellowstonePathology.Business.Client.Model.Client distributionClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(physicianClientDistribution.ClientId);
                physicianClientDistribution.DistributionType = distributionClient.AlternateDistributionType;
            }
        }
        private void HandleClientFound(UI.Navigation.PageNavigationReturnEventArgs e)
        {
            List <object> returnData = (List <object>)e.Data;

            YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client)returnData[0];
            bool useRequisition = (bool)returnData[1];

            this.m_ClientOrderReceivingHandler.IFoundAClient(client, useRequisition);
            Receiving.GetClientOrderPath getClientOrderPath = new Receiving.GetClientOrderPath(this.m_ClientOrderReceivingHandler, this.m_LoginPageWindow.PageNavigator);
            getClientOrderPath.Return += new Receiving.GetClientOrderPath.ReturnEventHandler(GetClientOrderPath_Return);
            getClientOrderPath.Start();
        }
        private void ButtonNewClient_Click(object sender, RoutedEventArgs e)
        {
            string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            int    clientId = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetLargestClientId() + 1;

            YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client(objectId, "New Client", clientId);

            ClientEntryV2 clientEntry = new ClientEntryV2(client, true);

            clientEntry.ShowDialog();
            this.m_ClientCollection.Insert(0, client);
        }
Beispiel #32
0
        public void PullClient(YellowstonePathology.Business.Client.Model.Client client, object writer)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "SELECT c.*, (SELECT * from tblClientLocation where ClientId = c.ClientId order by Location 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 = client.ClientId;
            ClientDocumentBuilder builder = new ClientDocumentBuilder(cmd);

            DocumentId documentId = new DocumentId(client, writer);
            Document   document   = this.m_Stack.Pull(documentId, builder);
        }
Beispiel #33
0
        private void BuildLocation(YellowstonePathology.Business.Client.Model.Client client, XElement clientElement)
        {
            List <XElement> clientLocationElements = (from item in clientElement.Elements("ClientLocationCollection")
                                                      select item).ToList <XElement>();

            foreach (XElement clientLocationElement in clientLocationElements.Elements("ClientLocation"))
            {
                YellowstonePathology.Business.Client.Model.ClientLocation   clientLocation    = new YellowstonePathology.Business.Client.Model.ClientLocation();
                YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriter = new YellowstonePathology.Business.Persistence.XmlPropertyWriter(clientLocationElement, clientLocation);
                xmlPropertyWriter.Write();
                client.ClientLocationCollection.Add(clientLocation);
            }
        }
Beispiel #34
0
        public void Build(XElement rootElement)
        {
            if (rootElement != null)
            {
                YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                YellowstonePathology.Business.Persistence.XmlPropertyWriter xmlPropertyWriter = new Persistence.XmlPropertyWriter(rootElement, client);
                xmlPropertyWriter.Write();

                BuildLocation(client, rootElement);
                this.m_Client = client;
            }
            else
            {
                this.m_Client = null;
            }
        }
        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;
        }
        private void ButtonNewClient_Click(object sender, RoutedEventArgs e)
        {
            string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            int clientId = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetLargestClientId() + 1;
            YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client(objectId, "New Client", clientId);

            ClientEntryV2 clientEntry = new ClientEntryV2(client, true);
            clientEntry.ShowDialog();
            this.m_ClientCollection.Insert(0, client);
        }
 private static YellowstonePathology.Business.Client.Model.ClientCollection BuildClientCollection(SqlCommand cmd)
 {
     Client.Model.ClientCollection result = new 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())
             {
                 Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                 Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                 sqlDataReaderPropertyWriter.WriteProperties();
                 result.Add(client);
             }
             if (dr.IsClosed == false)
             {
                 dr.NextResult();
                 while (dr.Read())
                 {
                     YellowstonePathology.Business.Client.Model.ClientLocation clientLocation = new YellowstonePathology.Business.Client.Model.ClientLocation();
                     Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(clientLocation, dr);
                     sqlDataReaderPropertyWriter.WriteProperties();
                     foreach (Client.Model.Client client in result)
                     {
                         if (client.ClientId == clientLocation.ClientId)
                         {
                             client.ClientLocationCollection.Add(clientLocation);
                             break;
                         }
                     }
                 }
             }
         }
     }
     return result;
 }
        public static View.PhysicianClientView GetPhysicianClientView(int physicianId)
        {
            View.PhysicianClientView physicianClientView = new View.PhysicianClientView();

            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection physicianCollection = server.Database.GetCollection<BsonDocument>("Physician");
            BsonDocument physicianDocument = physicianCollection.FindOneAs<BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianId)));
            YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(physicianDocument, physicianClientView);

            MongoCollection physicianClientCollection = server.Database.GetCollection<BsonDocument>("PhysicianClient");
            MongoCursor physicianClientCursor = physicianClientCollection.FindAs<BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianClientView.PhysicianId)));
            List<BsonValue> clientIdList = new List<BsonValue>();
            foreach (BsonDocument bsonDocument in physicianClientCursor)
            {
                clientIdList.Add(bsonDocument.GetValue("ClientId"));
            }

            MongoCollection clientCollection = server.Database.GetCollection<BsonDocument>("Client");
            MongoCursor clientCursor = clientCollection.FindAs<BsonDocument>(Query.In("ClientId", clientIdList));
            foreach (BsonDocument bsonDocument in clientCursor)
            {
                YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, client);
                physicianClientView.Clients.Add(client);
            }

            return physicianClientView;
        }
        public void GoNext()
        {
            YellowstonePathology.Business.View.ClientLocationView clientLocationView = null;
            if (this.ListViewFavoriteClients.SelectedItem != null)
            {
                clientLocationView = this.ListViewFavoriteClients.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }
            else if (this.ListViewClientSearch.SelectedItem != null)
            {
                clientLocationView = this.ListViewClientSearch.SelectedItem as YellowstonePathology.Business.View.ClientLocationView;
            }

            if (clientLocationView != null)
            {
                this.m_Client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(clientLocationView.ClientId);
                this.m_FavoriteClientCollection.AddRecent(this.m_Client);

                if (this.m_Client != null)
                {
                    this.m_Client.ClientLocationCollection.SetCurrentLocation(clientLocationView.ClientLocationId);
                    UI.Navigation.PageNavigationReturnEventArgs args = new UI.Navigation.PageNavigationReturnEventArgs(UI.Navigation.PageNavigationDirectionEnum.Next, this.m_Client);
                    this.Return(this, args);
                }
            }
            this.ListViewFavoriteClients.SelectedIndex = -1;
        }
        public static Domain.ClientCollection GetClientsByPhysicianId(int physicianId)
        {
            Domain.ClientCollection result = new Domain.ClientCollection();
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection physicianClientCollection = server.Database.GetCollection<BsonDocument>("PhysicianClient");
            MongoCursor physicianClientCursor = physicianClientCollection.FindAs<BsonDocument>(Query.EQ("PhysicianId", BsonValue.Create(physicianId)));

            List<BsonValue> clientIdList = new List<BsonValue>();
            foreach (BsonDocument bsonDocument in physicianClientCursor)
            {
                clientIdList.Add(bsonDocument.GetValue("ClientId").AsInt32);
            }

            MongoCollection clientCollection = server.Database.GetCollection<BsonDocument>("Client");
            MongoCursor clientCursor = clientCollection.FindAs<BsonDocument>(Query.In("ClientId", clientIdList));
            foreach (BsonDocument bsonDocument in clientCursor)
            {
                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 GetClientCollectionByClientGroupId(int clientGroupId)
        {
            YellowstonePathology.Business.Client.Model.ClientCollection result = new Client.Model.ClientCollection();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "select c.* " +
                "from tblClientGroup cg " +
                "join tblClientGroupClient cgc on cg.ClientGroupId = cgc.ClientGroupId " +
                "join tblclient c on cgc.ClientId = c.ClientId " +
                "where cgc.ClientGroupId = @ClientGroupId order by c.ClientName";

            cmd.Parameters.Add("@ClientGroupId", SqlDbType.Int).Value = clientGroupId;
            cmd.CommandType = CommandType.Text;

            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.Client client = new YellowstonePathology.Business.Client.Model.Client();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(client);
                    }
                }
            }
            return result;
        }
        public static Domain.ClientCollection GetClientsByProviderId(string objectId)
        {
            Domain.ClientCollection result = new Domain.ClientCollection();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "select c.* " +
               "from tblClient c " +
               "join tblPhysicianClient pc on c.ClientId = pc.ClientId " +
               "where pc.ProviderId = @ObjectId order by ClientName ";
            cmd.Parameters.Add("@ObjectId", SqlDbType.VarChar).Value = objectId;
            cmd.CommandType = CommandType.Text;

            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.Client client = new YellowstonePathology.Business.Client.Model.Client();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Add(client);
                    }
                }
            }
            return result;
        }
        private static View.PhysicianClientView BuildPhysicianClientView(SqlCommand cmd)
        {
            View.PhysicianClientView result = new View.PhysicianClientView();
            using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ProductionConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(result, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                    }

                    dr.NextResult();

                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Clients.Add(client);
                    }
                }
            }
            return result;
        }
 public void IFoundAClient(YellowstonePathology.Business.Client.Model.Client client)
 {
     this.m_Client = client;
     this.m_AClientHasBeenFound = true;
     this.m_ExpectedOrderType = (OrderTypeEnum)Enum.Parse(typeof(OrderTypeEnum), client.ClientLocationCollection.CurrentLocation.OrderType, true);
 }
        private void BarcodeScanPort_ClientScanReceived(Business.BarcodeScanning.Barcode barcode)
        {
            this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Input, new System.Threading.ThreadStart(delegate()
            {
                int clientId = Convert.ToInt32(barcode.ID);
                this.m_Client = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientByClientId(clientId);
                this.m_Client.ClientLocationCollection.SetCurrentLocationToMedicalRecordsOrFirst();

                UI.Navigation.PageNavigationReturnEventArgs args = new UI.Navigation.PageNavigationReturnEventArgs(UI.Navigation.PageNavigationDirectionEnum.Next, this.m_Client);
                this.Return(this, args);
            }
            ));
        }
        public static View.PhysicianClientView GetPhysicianClientView(string physicianId)
        {
            View.PhysicianClientView result = new View.PhysicianClientView();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "select * from tblPhysician where ObjectId = @ObjectId;" +
                " select c.* from tblClient c join tblPhysicianClient pc on c.ClientId = pc.ClientId where pc.ProviderId = @ObjectId order by ClientName";
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@ObjectId", SqlDbType.VarChar).Value = physicianId;
            using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ProductionConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(result, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                    }

                    dr.NextResult();

                    while (dr.Read())
                    {
                        YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter sqlDataReaderPropertyWriter = new Persistence.SqlDataReaderPropertyWriter(client, dr);
                        sqlDataReaderPropertyWriter.WriteProperties();
                        result.Clients.Add(client);
                    }
                }
            }
            return result;
        }
        private void ButtonNewClient_Click(object sender, RoutedEventArgs e)
        {
            string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            int clientId = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetLargestClientId() + 1;
            YellowstonePathology.Business.Client.Model.Client client = new YellowstonePathology.Business.Client.Model.Client(objectId, "New Client", clientId);
            YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(client, this);

            ClientEntry clientEntry = new ClientEntry(client);
            clientEntry.ShowDialog();
            if (this.m_ClientCollection == null)
            {
                this.m_ClientCollection = new Business.Client.Model.ClientCollection();
            }

            this.m_ClientCollection.Insert(0, client);
        }
        /*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;
        }