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"); } } }
private void ButtonAddToClient_Click(object sender, RoutedEventArgs e) { if (this.ListBoxClientSelection.SelectedItem != null) { YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client) this.ListBoxClientSelection.SelectedItem; if (this.m_PhysicianClientView.ClientExists(client.ClientId) == false) { string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Domain.PhysicianClient physicianClient = new Business.Domain.PhysicianClient(objectId, objectId, this.m_Physician.PhysicianId, this.m_Physician.ObjectId, client.ClientId); YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClient, this.m_ParentWindow); this.m_PhysicianClientView.Clients.Add(client); string distributionObjectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Client.Model.PhysicianClientDistribution physicianClientDistribution = new Business.Client.Model.PhysicianClientDistribution(distributionObjectId, physicianClient.PhysicianClientId, physicianClient.PhysicianClientId, client.DistributionType); YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClientDistribution, this); } } }
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); } }
private void ButtonAddToDistribution_Click(object sender, RoutedEventArgs e) { if (this.ListBoxNewDistributionSelection.SelectedItem != null) { YellowstonePathology.Business.Client.Model.Client client = (YellowstonePathology.Business.Client.Model.Client)this.ListBoxNewDistributionSelection.SelectedItem; if (this.ListBoxClientMembership.SelectedItems.Count != 0) { YellowstonePathology.Business.Domain.PhysicianClient physicianClient = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClient(this.m_Physician.ObjectId, client.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 objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Client.Model.PhysicianClientDistribution physicianClientDistribution = new Business.Client.Model.PhysicianClientDistribution(objectId, this.m_PhysicianClientId, physicianClientId); YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClientDistribution, this); this.m_PhysicianClientDistributionViewList = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionsV2(this.m_PhysicianClientId); this.NotifyPropertyChanged("PhysicianClientDistributionViewList"); } } }
private void ButtonAddToClient_Click(object sender, RoutedEventArgs e) { if (this.ListBoxAvailableProviders.SelectedItem != null) { YellowstonePathology.Business.Domain.Physician physician = (YellowstonePathology.Business.Domain.Physician) this.ListBoxAvailableProviders.SelectedItem; if (this.m_ClientPhysicianView.PhysicianExists(physician.PhysicianId) == false) { string objectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Domain.PhysicianClient physicianClient = new Business.Domain.PhysicianClient(objectId, objectId, physician.PhysicianId, physician.ObjectId, this.m_Client.ClientId); YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClient, this); this.m_ClientPhysicianView.Physicians.Add(physician); this.NotifyPropertyChanged("Physicians"); string distributionObjectId = MongoDB.Bson.ObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Client.Model.PhysicianClientDistribution physicianClientDistribution = new Business.Client.Model.PhysicianClientDistribution(distributionObjectId, physicianClient.PhysicianClientId, physicianClient.PhysicianClientId, this.m_Client.DistributionType); YellowstonePathology.Business.Persistence.DocumentGateway.Instance.InsertDocument(physicianClientDistribution, this); } } }