Example #1
0
        public PromotionResult RelinquishWorkListItem()
        {
            PromotionResult promotionResult = new PromotionResult {
                Success = true
            };

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

            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);
        }