private YellowstonePathology.Business.Rules.MethodResult CanDeleteClient(YellowstonePathology.Business.Client.Model.Client client)
        {
            YellowstonePathology.Business.Rules.MethodResult result = new Business.Rules.MethodResult();
            int accessionCount = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetAccessionCountByClientId(client.ClientId);

            if (accessionCount > 0)
            {
                result.Success = false;
                result.Message = client.ClientName + " has accessions and can not be deleted.";
            }
            else
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendLine(client.ClientName);
                YellowstonePathology.Business.Domain.PhysicianClientCollection physicianClientCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientCollectionByClientId(client.ClientId);
                foreach (YellowstonePathology.Business.Domain.PhysicianClient physicianClient in physicianClientCollection)
                {
                    YellowstonePathology.Business.Client.Model.PhysicianClientDistributionCollection physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionByPhysicianClientId(physicianClient.PhysicianClientId);
                    if (physicianClientDistributionCollection.Count > 0)
                    {
                        result.Success = false;
                        msg.AppendLine("- has distributions.  The distributions must be removed before the client can be deleted.");
                        break;
                    }
                }

                if (physicianClientCollection.Count > 0)
                {
                    result.Success = false;
                    msg.AppendLine("- has membereship.  The membership must be removed before the client can be deleted.");
                }
                result.Message = msg.ToString();
            }

            return(result);
        }
Ejemplo n.º 2
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);
 }
        private YellowstonePathology.Business.Rules.MethodResult CanDeleteProvider(YellowstonePathology.Business.Domain.Physician physician)
        {
            YellowstonePathology.Business.Rules.MethodResult result = new Business.Rules.MethodResult();
            int accessionCount = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetAccessionCountByPhysicianId(physician.PhysicianId);

            if (accessionCount > 0)
            {
                result.Success = false;
                result.Message = physician.DisplayName + " has accessions and can not be deleted.";
            }
            else
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendLine(physician.DisplayName);
                YellowstonePathology.Business.Domain.PhysicianClientCollection physicianClientCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientCollectionByProviderId(physician.ObjectId);
                foreach (YellowstonePathology.Business.Domain.PhysicianClient physicianClient in physicianClientCollection)
                {
                    YellowstonePathology.Business.Client.Model.PhysicianClientDistributionCollection physicianClientDistributionCollection = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianClientDistributionByPhysicianClientId(physicianClient.PhysicianClientId);
                    if (physicianClientDistributionCollection.Count > 0)
                    {
                        result.Success = false;
                        msg.AppendLine("- has existing distributions.  The distributions must be removed before the provider may be deleted.");
                        break;
                    }
                }

                if (physicianClientCollection.Count > 0)
                {
                    result.Success = false;
                    msg.Append("- is a member of " + physicianClientCollection.Count.ToString() + " client/s.  The membership must be removed before the provider may be deleted.");
                }
                result.Message = msg.ToString();
            }

            return(result);
        }
Ejemplo n.º 4
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);
        }