private void HandleUnsetDistribution() { List <YellowstonePathology.Business.MasterAccessionNo> caseList = YellowstonePathology.Business.Gateway.AccessionOrderGateway.GetCasesWithUnsetDistributions(); foreach (YellowstonePathology.Business.MasterAccessionNo masterAccessionNo in caseList) { YellowstonePathology.Business.Test.AccessionOrder accessionOrder = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.PullAccessionOrder(masterAccessionNo.Value, this); if (accessionOrder.AccessionLock.IsLockAquiredByMe == true) { foreach (YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder in accessionOrder.PanelSetOrderCollection) { if (panelSetOrder.Final == true && panelSetOrder.Distribute == true) { if (panelSetOrder.TestOrderReportDistributionCollection.Count == 0) { YellowstonePathology.Business.Client.Model.PhysicianClientDistributionList physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.ReportDistributionGateway.GetPhysicianClientDistributionCollection(accessionOrder.PhysicianId, accessionOrder.ClientId); bool canSetDistribution = false; string reason = "No Distribution Defined"; if (physicianClientDistributionCollection.Count != 0) { YellowstonePathology.Business.Audit.Model.CanSetDistributionAudit canSetDistributionAudit = new Business.Audit.Model.CanSetDistributionAudit(accessionOrder, physicianClientDistributionCollection); canSetDistributionAudit.Run(); if (canSetDistributionAudit.Status == YellowstonePathology.Business.Audit.Model.AuditStatusEnum.OK) { physicianClientDistributionCollection.SetDistribution(panelSetOrder, accessionOrder); this.m_ReportDistributionLogEntryCollection.AddEntry("INFO", "Handle Unset Distribution", null, panelSetOrder.ReportNo, panelSetOrder.MasterAccessionNo, accessionOrder.PhysicianName, accessionOrder.ClientName, "Distribution Set"); canSetDistribution = true; } else { reason = "Missing MRN and/or AccountNo."; } } if (canSetDistribution == false) { this.m_ReportDistributionLogEntryCollection.AddEntry("ERROR", "Handle Unset Distribution", null, panelSetOrder.ReportNo, panelSetOrder.MasterAccessionNo, accessionOrder.PhysicianName, accessionOrder.ClientName, reason); System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("*****@*****.**", "*****@*****.**", System.Windows.Forms.SystemInformation.UserName, reason + ": " + panelSetOrder.ReportNo); System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("10.1.2.111"); Uri uri = new Uri("http://tempuri.org/"); System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials; System.Net.NetworkCredential credential = credentials.GetCredential(uri, "Basic"); client.Credentials = credential; client.Send(message); } } } } } } YellowstonePathology.Business.Persistence.DocumentGateway.Instance.Push(this); }
private void SetDistribution() { YellowstonePathology.Business.Client.Model.PhysicianClientDistributionList physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.ReportDistributionGateway.GetPhysicianClientDistributionCollection(this.m_AccessionOrder.PhysicianId, this.m_AccessionOrder.ClientId); YellowstonePathology.Business.Audit.Model.CanSetDistributionAudit canSetDistributionAudit = new Business.Audit.Model.CanSetDistributionAudit(this.m_AccessionOrder, physicianClientDistributionCollection); canSetDistributionAudit.Run(); if (canSetDistributionAudit.Status == Business.Audit.Model.AuditStatusEnum.OK) { physicianClientDistributionCollection.SetDistribution(this.m_PanelSetOrder, this.m_AccessionOrder); this.NotifyPropertyChanged(""); } else { MessageBox.Show(canSetDistributionAudit.Message.ToString()); } }