Exemple #1
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");
                }
            }
        }
Exemple #2
0
        public static Domain.PhysicianClient GetPhysicianClient(int physicianId, int clientId)
        {
            YellowstonePathology.Business.Domain.PhysicianClient result = new YellowstonePathology.Business.Domain.PhysicianClient();

            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection   = server.Database.GetCollection <BsonDocument>("PhysicianClient");
            BsonDocument    bsonDocument = collection.FindOneAs <BsonDocument>(Query.And(Query.EQ("PhysicianId", BsonValue.Create(physicianId)), Query.EQ("ClientId", BsonValue.Create(clientId))));

            YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, result);
            return(result);
        }
Exemple #3
0
 private YellowstonePathology.Business.Rules.MethodResult CanRemoveMember(YellowstonePathology.Business.Domain.PhysicianClient physicianClient)
 {
     YellowstonePathology.Business.Rules.MethodResult result = new Business.Rules.MethodResult();
     YellowstonePathology.Business.Client.Model.PhysicianClientDistributionCollection physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionByPhysicianClientId(physicianClient.PhysicianClientId);
     if (physicianClientDistributionCollection.Count > 0)
     {
         result.Success = false;
         result.Message = "This provider has distributions for this client.  These distributions must be removed before the provider can be removed from the client membership.";
     }
     return(result);
 }
Exemple #4
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");
     }
 }
Exemple #5
0
        private bool PhysicianHasDistributionsForThisClient()
        {
            bool result = false;

            YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_Physician.ObjectId, this.m_ClientOrder.ClientId);
            if (physicianClient != null)
            {
                YellowstonePathology.Business.Client.Model.PhysicianClientDistributionCollection physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionByPhysicianClientId(physicianClient.PhysicianClientId);
                if (physicianClientDistributionCollection.Count > 0)
                {
                    result = true;
                }
            }

            return(result);
        }
Exemple #6
0
        public override void Run()
        {
            this.m_Status = AuditStatusEnum.OK;
            this.m_Message.Clear();
            this.m_Message.AppendLine(this.m_MessageBegining);

            foreach (YellowstonePathology.Business.Client.Model.Client client in this.m_PhysicianClientView.Clients)
            {
                YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_ProviderId, client.ClientId);
                List <YellowstonePathology.Business.Client.Model.PhysicianClientDistributionView> physicianClientDistributionViews = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionsV2(physicianClient.PhysicianClientId);
                if (physicianClientDistributionViews.Count == 0)
                {
                    this.m_Status = AuditStatusEnum.Failure;
                    this.m_Message.AppendLine(client.ClientName);
                }
            }
        }
Exemple #7
0
 private void ButtonRemoveFromClient_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListBoxClients.SelectedItem != null)
     {
         YellowstonePathology.Business.Client.Model.Client    client          = (YellowstonePathology.Business.Client.Model.Client) this.ListBoxClients.SelectedItem;
         YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_PhysicianClientView.ObjectId, client.ClientId);
         YellowstonePathology.Business.Rules.MethodResult     methodResult    = this.CanRemoveMember(physicianClient);
         if (methodResult.Success == true)
         {
             YellowstonePathology.Business.Persistence.DocumentGateway.Instance.DeleteDocument(physicianClient, this.m_ParentWindow);
             this.m_PhysicianClientView.Clients.Remove(client);
         }
         else
         {
             MessageBox.Show(methodResult.Message, "Unable to remove membership.", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
     }
 }
        private void AddDistribution(YellowstonePathology.Business.Domain.PhysicianClient newPhysicianClient)
        {
            bool oktoAdd = true;
            List <YellowstonePathology.Business.Client.Model.PhysicianClientDistributionView> physicianClientDistributionViewList = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionsV2(newPhysicianClient.PhysicianClientId);

            foreach (YellowstonePathology.Business.Client.Model.PhysicianClientDistributionView physicianClientDistributionView in physicianClientDistributionViewList)
            {
                if (physicianClientDistributionView.PhysicianClientDistribution.DistributionID == newPhysicianClient.PhysicianClientId)
                {
                    oktoAdd = false;
                    break;
                }
            }

            if (oktoAdd == true)
            {
                string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
                YellowstonePathology.Business.Client.Model.PhysicianClientDistribution physicianClientDistribution = new Business.Client.Model.PhysicianClientDistribution(objectId, newPhysicianClient.PhysicianClientId, newPhysicianClient.PhysicianClientId, this.m_Client.DistributionType);
                YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClientDistribution, this);
            }
        }
Exemple #9
0
 private void ButtonRemoveFromClient_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListBoxPhysicians.SelectedItem != null)
     {
         MessageBoxResult result = MessageBox.Show("Remove selected physician?", "Remove", MessageBoxButton.OKCancel);
         if (result == MessageBoxResult.OK)
         {
             YellowstonePathology.Business.Domain.Physician       physician       = (YellowstonePathology.Business.Domain.Physician) this.ListBoxPhysicians.SelectedItem;
             YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(physician.ObjectId, this.m_Client.ClientId);
             YellowstonePathology.Business.Rules.MethodResult     methodResult    = this.CanRemoveMember(physicianClient);
             if (methodResult.Success == true)
             {
                 YellowstonePathology.Business.Persistence.DocumentGateway.Instance.DeleteDocument(physicianClient, this);
                 this.m_ClientPhysicianView.Physicians.Remove(physician);
                 this.NotifyPropertyChanged("Physicians");
             }
             else
             {
                 MessageBox.Show(methodResult.Message, "Unable to remove membership.", MessageBoxButton.OK, MessageBoxImage.Exclamation);
             }
         }
     }
 }
        public static Domain.PhysicianClient GetPhysicianClient(int physicianId, int clientId)
        {
            YellowstonePathology.Business.Domain.PhysicianClient result = new YellowstonePathology.Business.Domain.PhysicianClient();

            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection collection = server.Database.GetCollection<BsonDocument>("PhysicianClient");
            BsonDocument bsonDocument = collection.FindOneAs<BsonDocument>(Query.And(Query.EQ("PhysicianId", BsonValue.Create(physicianId)), Query.EQ("ClientId", BsonValue.Create(clientId))));
            YellowstonePathology.Business.Mongo.BSONPropertyWriter.Write(bsonDocument, result);
            return result;
        }
 public void GetPhysicianClientTest()
 {
     YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGatewayMongo.GetPhysicianClient(310, 251);
     Assert.AreEqual(physicianClient.PhysicianId, 310);
     Assert.AreEqual(physicianClient.ClientId, 251);
 }