// change status and record it as a new comment void changeStatus(WorkObject workObjectToUpdate, StatusType before) { if (workObjectToUpdate.Status != before) { StatusType after = workObjectToUpdate.Status; int id_ = workObjectToUpdate.WorkObjectID; if (before == StatusType.Open && after == StatusType.Process) // open -> process { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Open to Process ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Open && after == StatusType.Delay) // open -> delay { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Open to Delay ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Open && after == StatusType.End) // open -> end { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Open to End ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Open && after == StatusType.Processed) // open -> processed { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Open to Processed ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Process && after == StatusType.Open) // process -> open { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Process to Open ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Process && after == StatusType.Processed) // process -> processed { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Process to Processed ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Process && after == StatusType.Delay) // process -> delay { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Process to Delay ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Process && after == StatusType.End) // process -> end { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Process to Delay ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Process && after == StatusType.End) // process -> end { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Process to Delay ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Delay && after == StatusType.Processed) // delay -> processed { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Delay to Processed ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Delay && after == StatusType.Open) // delay -> open { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Delay to Open ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Delay && after == StatusType.End) // delay -> end { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Delay to End ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == StatusType.Delay && after == StatusType.Process) // delay -> process { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Status changed: Delay to Process ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } // processed and end status mean a workobject is in history queue and cannot be edited } }
void changePriority(WorkObject workObjectToUpdate, PriorityType before) { if (workObjectToUpdate.Priority != before) { PriorityType after = workObjectToUpdate.Priority; int id_ = workObjectToUpdate.WorkObjectID; if (before == PriorityType.Lowest && after == PriorityType.Low) // lowest -> low { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Lowest to Low ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Lowest && after == PriorityType.Normal) // lowest -> normal { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Lowest to Normal ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Lowest && after == PriorityType.High) // lowest -> high { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Lowest to High ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Lowest && after == PriorityType.High) // lowest -> urgent { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Lowest to Urgent ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Low && after == PriorityType.Lowest) // low -> lowest { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Low to Lowest ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Low && after == PriorityType.Normal) // low -> normal { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Low to Normal ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Low && after == PriorityType.High) // low -> high { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Low to High ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Low && after == PriorityType.High) // low -> urgent { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Low to Urgent ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Normal && after == PriorityType.Lowest) // normal -> lowest { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Normal to Lowest ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Normal && after == PriorityType.Low) // normal -> low { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Normal to Low ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Normal && after == PriorityType.High) // normal -> high { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Normal to High ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Normal && after == PriorityType.High) // normal -> urgent { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Normal to Urgent ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.High && after == PriorityType.Lowest) // high -> lowest { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: High to Lowest ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.High && after == PriorityType.Low) // high -> low { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: High to Low ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.High && after == PriorityType.Low) // high -> normal { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: High to Normal ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.High && after == PriorityType.Low) // high -> urgent { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: High to Urgent ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Urgent && after == PriorityType.Lowest) // urgent -> lowest { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Urgent to Lowest ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Urgent && after == PriorityType.Low) // urgent -> low { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Urgent to Low ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Urgent && after == PriorityType.Normal) // urgent -> normal { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Urgent to Normal ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } else if (before == PriorityType.Urgent && after == PriorityType.High) // urgent -> high { // converts time to Greenwich Mean Time DateTime currentTime = TimeConverter.ConvertToLocalTime(DateTime.Now, "GMT Standard Time"); Comment newComment = new Comment { WorkObjectID = id_, Content = "*** Priority changed: Urgent to High ***", Timestamp = currentTime, User = User.Identity.Name }; db.Comments.Add(newComment); } } }