Beispiel #1
0
        public bool IsSatisfiedBy(ReceiptFacts facts)
        {
            if (!IsSerialized(facts))
            {
                return(false);
            }
            if (!IsExpectedPartNumber(facts))
            {
                return(true);
            }
            if (!LineItemIsOpen(facts))
            {
                return(true);
            }
            if (!IsExpectedOnPreAlert(facts))
            {
                return(true);
            }
            if (!PreAlertPartNumberMatchesItem(facts))
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        private bool IsSerialized(ReceiptFacts facts)
        {
            if (!string.IsNullOrEmpty(facts.SerialNumber) && facts.SerialNumber != "NON SERIALIZED")
            {
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        private bool LineItemIsOpen(ReceiptFacts facts)
        {
            if (facts.PurchaseLineItem.Status != LineItemStatus.Open)
            {
                m_message = new UserMessage("The line item is not open", UserMessageType.Validation);
                return(false);
            }

            return(true);
        }
Beispiel #4
0
        private bool IsExpectedOnPreAlert(ReceiptFacts facts)
        {
            if (!facts.PurchaseOrder.IsExpectedPreAlertItem(facts.SerialNumber))
            {
                m_message = new UserMessage
                                ("This serial number is not expected on the pre-alert", UserMessageType.Validation);
                return(false);
            }

            return(true);
        }
Beispiel #5
0
        private bool IsExpectedPartNumber(ReceiptFacts facts)
        {
            if (facts.PurchaseOrder.GetLineByPart(facts.Part) == null)
            {
                m_message = new UserMessage
                                ("This part number is not expected", UserMessageType.Error);

                return(false);
            }

            return(true);
        }
Beispiel #6
0
        private bool PreAlertPartNumberMatchesItem(ReceiptFacts facts)
        {
            IPreAlertItem preAlertItem = facts.PurchaseOrder.GetPreAlertItem(facts.SerialNumber);

            if (preAlertItem == null)
            {
                return(true);
            }

            if (string.IsNullOrEmpty(preAlertItem.PartNumber))
            {
                return(true);
            }

            if (preAlertItem.PartNumber != facts.Part.PartNumber)
            {
                m_message =
                    new UserMessage("This part number does not match the pre-alert part number - "
                                    + preAlertItem.PartNumber, UserMessageType.Validation);

                return(false);
            }
            return(true);
        }
Beispiel #7
0
 public ReceiptValidator(ReceiptFacts facts)
 {
     m_facts = facts;
 }