public PromotionResult RelinquishWorkListItem() { PromotionResult promotionResult = new PromotionResult { Success = true }; if (CurrentWorkerId == null || Status.Substring(Status.Length - 3, 3) != "ing") { promotionResult.Message = String.Format("Widget {0} can not be relinquished because it is not currently being worked on.", WidgetId); promotionResult.Success = false; } 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, WidgetStatus); } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, WidgetId, HttpContext.Current.User.Identity.Name, null); return(promotionResult); }
public PromotionResult PromoteWorkListItem(string command) { PromotionResult promotionResult = new PromotionResult(); switch (command) { case "PromoteToIntegrated": promotionResult = PromoteToIntegrated(); break; case "PromoteToApproved": promotionResult = PromoteToApproved(); break; case "DemoteToCanceled": promotionResult = DemoteToCanceled(); break; } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, WidgetId, HttpContext.Current.User.Identity.Name, null); if (promotionResult.Success) { CurrentWorker = null; CurrentWorkerId = null; } return(promotionResult); }
public PromotionResult ClaimWorkListItem(string userId) { PromotionResult promotionResult = WorkListBusinessRules.CanClaimWorkListItem(userId); if (!promotionResult.Success) { Log4NetHelper.Log(promotionResult.Message, LogLevel.WARN, EntityFormalNamePlural, WidgetId, HttpContext.Current.User.Identity.Name, null); return(promotionResult); } switch (WidgetStatus) { case WidgetStatus.Created: promotionResult = PromoteToIntegrating(); break; case WidgetStatus.Integrated: promotionResult = PromoteToApproving(); break; } if (promotionResult.Success) { CurrentWorkerId = userId; } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, WidgetId, HttpContext.Current.User.Identity.Name, null); return(promotionResult); }
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; } if (promotionResult.Success) { CurrentWorkerId = userId; } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, EntityFormalNamePlural, Id, HttpContext.Current.User.Identity.Name, null); return(promotionResult); }
public PromotionResult PromoteWorkListItem(string command) { PromotionResult promotionResult = new PromotionResult(); switch (command) { case "PromoteToCreated": promotionResult = PromoteToCreated(); break; case "PromoteToProcessed": promotionResult = PromoteToProcessed(); break; case "PromoteToCertified": promotionResult = PromoteToCertified(); break; case "PromoteToApproved": promotionResult = PromoteToApproved(); break; case "DemoteToCreated": promotionResult = DemoteToCreated(); break; case "DemoteToRejected": promotionResult = DemoteToRejected(); break; case "DemoteToCanceled": promotionResult = DemoteToCanceled(); break; } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, "WorkOrders", WorkOrderId, HttpContext.Current.User.Identity.Name, null); if (promotionResult.Success) { CurrentWorker = null; CurrentWorkerId = null; // Attempt to auto-promotion from Certified To Approved if (WorkOrderStatus == WorkOrderStatus.Certified && Parts.Sum(p => p.ExtendedPrice) + Labors.Sum(l => l.ExtendedPrice) < 5000) { PromotionResult autoPromotionResult = PromoteToApproved(); if (autoPromotionResult.Success) { promotionResult = autoPromotionResult; promotionResult.Message = "AUTOMATIC PROMOTION: " + promotionResult.Message; } } } return(promotionResult); }