// ORDER METHODS public static int UpdateOrderStatusWithNotification(Order order, Enumeration.Permission senderPermissionScope) { int returnValue = 1; BusinessObjects _businessObjects = new BusinessObjects(); returnValue = _businessObjects.UpdateOrder(order); if (returnValue == 1) return returnValue; Notification notification = new Notification { NotificationId = Guid.NewGuid(), IsRead = false, OrderId = order.OrderId }; string message = ""; switch (order.OrderStatus) { case Enumeration.OrderStatus.WorkComplete: message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Work Complete"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.WorkComplete; notification.PermissionScope = Enumeration.Permission.OperationsManager; returnValue = _businessObjects.InsertNotification(notification); break; case Enumeration.OrderStatus.EnRoute: message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = En Route"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.EnRoute; notification.PermissionScope = Enumeration.Permission.WorkSpecialist; returnValue = _businessObjects.InsertNotification(notification); break; case Enumeration.OrderStatus.Delivered: if (senderPermissionScope == Enumeration.Permission.SalesPerson) { message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Delivered"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.Delivered; notification.PermissionScope = Enumeration.Permission.OperationsManager; returnValue = _businessObjects.InsertNotification(notification); } else if (senderPermissionScope == Enumeration.Permission.StockClerk) { message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Delivered"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.Delivered; notification.PermissionScope = Enumeration.Permission.WorkSpecialist; returnValue = _businessObjects.InsertNotification(notification); } break; case Enumeration.OrderStatus.Complete: message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Order Complete"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.OrderComplete; notification.PermissionScope = Enumeration.Permission.SalesPerson; returnValue = _businessObjects.InsertNotification(notification); break; case Enumeration.OrderStatus.FailedValidation: message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Failed Validation"; notification.NotificationMessage = message; notification.NotificationType = Enumeration.NotificationType.FailedQualityControl; notification.PermissionScope = Enumeration.Permission.WorkSpecialist; returnValue = _businessObjects.InsertNotification(notification); break; } return returnValue; }
public static List<Order> GetOrderByOrderStatus(Enumeration.OrderStatus orderStatus) { BusinessObjects _businessObjects = new BusinessObjects(); return _businessObjects.GetOrdersByOrderStatus(orderStatus); }