示例#1
0
        private PromotionResult PromoteToIntegrating()
        {
            if (WidgetStatus == WidgetStatus.Created)
            {
                WidgetStatus = WidgetStatus.Integrating;
            }

            PromotionResult promotionResult = new PromotionResult();
            promotionResult.Success = WidgetStatus == WidgetStatus.Integrating;

            if (promotionResult.Success)
                promotionResult.Message = String.Format("Widget {0} successfully claimed by {1} and promoted to status {2}.", WidgetId, HttpContext.Current.User.Identity.Name, WidgetStatus);
            else
                promotionResult.Message = "Failed to promote the widget to Integrating status because its current status prevented it.";

            return promotionResult;
        }
示例#2
0
        private PromotionResult PromoteToIntegrated()
        {
            PromotionResult promotionResult = new PromotionResult();
            promotionResult.Success = true;

            if (WidgetStatus != WidgetStatus.Integrating)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the widget to Integrated status because its current status prevented it.";
            }

            if (String.IsNullOrWhiteSpace(MainBusCode))
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the widget to Integrated status because Main Bus Code was not present.";
            }

            if (promotionResult.Success)
            {
                WidgetStatus = WidgetStatus.Integrated;
                promotionResult.Message = String.Format("Widget {0} successfully promoted to status {1}.", WidgetId, WidgetStatus);
            }

            return promotionResult;
        }
示例#3
0
        private PromotionResult DemoteToCanceled()
        {
            PromotionResult promotionResult = new PromotionResult();
            promotionResult.Success = true;

            if (WidgetStatus != WidgetStatus.Approving && WidgetStatus != WidgetStatus.Integrating)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to demote the widget to Canceled status because its current status prevented it.";
            }

            if (promotionResult.Success)
            {
                WidgetStatus = WidgetStatus.Canceled;
                promotionResult.Message = String.Format("Widget {0} successfully demoted to status {1}.", WidgetId, WidgetStatus);
            }

            return promotionResult;
        }
示例#4
0
        private PromotionResult PromoteToApproved()
        {
            PromotionResult promotionResult = new PromotionResult();
            promotionResult.Success = true;

            if (WidgetStatus != WidgetStatus.Approving)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the widget to Approved status because its current status prevented it.";
            }

            if (TestPassDateTime == null)
            {
                promotionResult.Success = false;
                promotionResult.Message = "Failed to promote the widget to Approved status because Test Pass Date was not present.";
            }

            if (promotionResult.Success)
            {
                WidgetStatus = WidgetStatus.Approved;
                promotionResult.Message = String.Format("Widget {0} successfully promoted to status {1}.", WidgetId, WidgetStatus);
            }

            return promotionResult;
        }
示例#5
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("Widget {0} cannot be relinquished because it is not currently being worked on.", WidgetId);
            }

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

                switch (WidgetStatus)
                {
                    case WidgetStatus.Integrating:
                        WidgetStatus = WidgetStatus.Created;
                        break;

                    case WidgetStatus.Approving:
                        WidgetStatus = WidgetStatus.Integrated;
                        break;
                }

                promotionResult.Message = String.Format("Widget {0} was successfully relinquished and its status was reset to {1}.", WidgetId, Status);
            }

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

            return promotionResult;
        }