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); }
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); }
public Subject(string Name, IList <Labor> LaborList) { SubjectName = Name; foreach (Labor objective in LaborList) { objective.Scope = Scope; objective.Subject = this; Labors.Put(objective.Name, objective); } LaborersCount = 1; }
public Subject(string Name, IList <IDeputy> MethodList) { SubjectName = Name; foreach (IDeputy method in MethodList) { Labor objective = new Labor($"{method.Info.Name}", method); objective.Scope = Scope; objective.Subject = this; Labors.Put($"{method.Info.Name}", objective); } LaborersCount = 1; }
public List <Labors> GetLaborsByQuetionID(string question_id) { List <Labors> llb = new List <Labors>(); DataTable dt = new DAL().GetLaborsListByQuestionID(question_id); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { Labors lbr = new Labors(); lbr.Question_id = Convert.ToInt32(dt.Rows[i]["question_id"]); lbr.Alias = dt.Rows[i]["alias"].ToString(); //System.Web.HttpContext.Current.User.Identity.Name.Substring(System.Web.HttpContext.Current.User.Identity.Name.IndexOf("\\") + 1);// lbr.UT = Convert.ToInt32(dt.Rows[i]["UT"]); lbr.LogDate = new CommonOperation().UnixStamptoDateTime(Convert.ToInt32(dt.Rows[i]["LogDate"])).ToString(); lbr.UTComments = dt.Rows[i]["UTComments"].ToString(); llb.Add(lbr); } } return(llb); }
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); }
public PromotionResult PromoteWorkListItem(string command) { var 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 = DemoteToCancelled(); break; } Log4NetHelper.Log(promotionResult.Message, LogLevel.INFO, "WorkOrders", WorkOrderId, HttpContext.Current.User.Identity.Name, null); if (promotionResult.Success) { CurrentWorker = null; CurrentWorkerId = null; // Attempt auto-promotion from Certified to Approved if the total value of Parts & Labors // is less than $5000. 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); }
public Job(Labors laborType, string inQueueDescription, string inProgressDescription) { LaborType = laborType; InQueueDescription = inQueueDescription; InProgressDescription = inProgressDescription; }
public void DisableLabor(Labors l) { enabledLabors &= ~l; }
public void EnableLabor(Labors l) { enabledLabors |= l; }
public bool HasLabor(Labors l) { return (int)(enabledLabors & l) > 0; }
public PromotionResult PromoteWorkOrder(string command) { PromotionResult promotion = new PromotionResult(); switch (command) { case "PromoteToCreated": promotion = PromoteToCreated(); break; case "PromoteToProcessed": promotion = PromoteToProcessed(); break; case "PromoteToCertified": promotion = PromoteToCertified(); break; case "PromoteToApproved": promotion = PromoteToApproved(); break; case "DemoteToCreated": promotion = DemoteToCreated(); break; case "DemoteToRejected": promotion = DemoteToRejected(); break; case "DemoteToCanceled": promotion = DemoteToCanceled(); break; } if (promotion.Success) { CurrentWorker = null; CurrentWorkerId = null; // Attempt to auto-promote from certified to Approved if (WorkOrderStatus == WorkOrderStatus.Certified && Parts.Sum(p => p.ExtendedPrice) + Labors.Sum(l => l.ExtendedPrice) < 5000) { PromotionResult autoPromote = PromoteToApproved(); if (autoPromote.Success) { promotion = autoPromote; promotion.Message = $"AUTOMATIC PROMOTION: {promotion.Message}"; } } } return(promotion); }