Esempio n. 1
0
        public PromotionResult RelinquishWorkListItem()
        {
            PromotionResult promotionResult = new PromotionResult {
                Success = true
            };

            if (CurrentWorkerId == null || Status.Substring(Status.Length - 3, 3) != "ing")
            {
                promotionResult.Success = false;
                promotionResult.Message = String.Format("Work Order {0} cannot be relinquished because it is not currently being worked on.", WorkOrderId);
            }

            if (promotionResult.Success)
            {
                CurrentWorker   = null;
                CurrentWorkerId = null;

                switch (WorkOrderStatus)
                {
                case WorkOrderStatus.Processing:
                    WorkOrderStatus = WorkOrderStatus.Created;
                    break;

                case WorkOrderStatus.Certifying:
                    WorkOrderStatus = WorkOrderStatus.Processed;
                    break;

                case WorkOrderStatus.Approving:
                    WorkOrderStatus = WorkOrderStatus.Certified;
                    break;
                }

                promotionResult.Message = String.Format("Work Order {0} was successfully relinquished and its status was reset to {1}.", WorkOrderId, WorkOrderStatus);
            }


            Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, WorkOrderId, HttpContext.Current.User.Identity.Name, null);

            return(promotionResult);
        }
Esempio n. 2
0
        public PromotionResult ClaimWorkListItem(string userId)
        {
            PromotionResult promotionResult = WorkListBusinessRules.CanClaimWorkListItem(userId);

            if (!promotionResult.Success)
            {
                return(promotionResult);
            }

            switch (WorkOrderStatus)
            {
            case WorkOrderStatus.Rejected:
                promotionResult = PromoteToProcessing();
                break;

            case WorkOrderStatus.Created:
                promotionResult = PromoteToProcessing();
                break;

            case WorkOrderStatus.Processed:
                promotionResult = PromoteToCertifying();
                break;

            case WorkOrderStatus.Certified:
                promotionResult = PromoteToApproving();
                break;
            }

            Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, "WorkOrders", WorkOrderId, HttpContext.Current.User.Identity.Name, null);


            if (promotionResult.Success)
            {
                CurrentWorkerId = userId;
            }

            return(promotionResult);
        }
Esempio n. 3
0
        private PromotionResult PromoteToApproved()
        {
            PromotionResult promotionResult = new PromotionResult();

            promotionResult.Success = true;

            if (WorkOrderStatus != WorkOrderStatus.Approving && WorkOrderStatus != WorkOrderStatus.Certified)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the work order to Approved status because its current status prevented it.";
            }


            if (promotionResult.Success)
            {
                WorkOrderStatus         = WorkOrderStatus.Approved;
                promotionResult.Message = String.Format("Work Order {0} successfully promortedto status {1}",
                                                        WorkOrderId,
                                                        WorkOrderStatus);
            }

            Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, WorkOrderId, HttpContext.Current.User.Identity.Name, null);
            return(promotionResult);
        }