Ejemplo n.º 1
0
        private PromotionResult PromoteToCertified()
        {
            PromotionResult promotionResult = new PromotionResult();

            promotionResult.Success = true;

            if (WorkOrderStatus != WorkOrderStatus.Certifying)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the work order to Certified status because its current status prevented it.";
            }
            if (String.IsNullOrWhiteSpace(CertificationRequirements))
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the work order to Certified status because Certification Requirements were not present.";
            }
            else if (Parts.Count == 0 || Labors.Count == 0)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the work order to Certified status because it did not contain at least one Part and labor.";
            }
            else if (Parts.Count(p => p.IsInstalled == false) > 0 || Labors.Count(l => l.PercentComplete < 100) > 0)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the work order to Certified status because not all Parts have been installed and ...";
            }

            if (promotionResult.Success)
            {
                WorkOrderStatus         = WorkOrderStatus.Certified;
                promotionResult.Message = String.Format("Work order {0} successfuly promoted to status {1}.", WorkOrderId, WorkOrderStatus);
            }
            return(promotionResult);
        }
Ejemplo n.º 2
0
 private PromotionResult PartsInstalledLaborCompleteTest(PromotionResult promotionResult)
 {
     if (Parts.Count(p => p.IsInstalled == false) > 0 || Labors.Count(l => l.PercentComplete < 100) > 0)
     {
         promotionResult.Success = false;
         promotionResult.Message = "Failed to promote the work order to Created status because not all parts have been installed or labors been completed.";
     }
     return(promotionResult);
 }
Ejemplo n.º 3
0
        private PromotionResult PromoteToCertified()
        {
            PromotionResult promotion = new PromotionResult();

            promotion.Success = true;

            if (WorkOrderStatus != WorkOrderStatus.Certifying)
            {
                promotion.Success = false;
                promotion.Message = "";
            }

            if (string.IsNullOrWhiteSpace(CertificationRequirements))
            {
                promotion.Success = false;
                promotion.Message = "";
            }

            else if (Parts.Count == 0 || Labors.Count == 0)
            {
                promotion.Success = false;
                promotion.Message = "Failed to promote the work order to Certified status because it did not contain at least one part and at least one labor item.";
            }

            else if (Parts.Count(p => p.IsInstalled == false) > 0 || Labors.Count(l => l.PercentComplete < 100) > 0)
            {
                promotion.Success = false;
                promotion.Message = "Failed to promote the work order to Certified status because not all parts have been installed and labor completed.";
            }

            if (promotion.Success)
            {
                WorkOrderStatus   = WorkOrderStatus.Certified;
                promotion.Message = $"Work order {WorkOrderId} successfully promoted to status {WorkOrderStatus}";
            }

            return(promotion);
        }