public HttpStatusCode ScheduleAlert(string MPOrderID, string ID, string StopType, string StopID, string StopName, string AddressLine1, string City, string State, string PostalCode, int ScheduleAlertCode, string ScheduledStartTimeInLocalTimeForStop, string ScheduledEndTimeInLocalTimeForStop, string ScheduleAlertText) { try { var logText = string.Format("MacroPoint Schedule Alert -- ID: {0}, ScheduleCode: {1}, ScheduleAlertText: {2}", ID, MacroPointService.ScheduleAlertMessage(ScheduleAlertCode), ScheduleAlertText); _applicationServices.LogWriteFull(logText, LoggingSeverity.Information, LoggingCategory.Controller); Load load = _loadBusiness.GetLoadByMacroPointId(MPOrderID); LoadComment comment = new LoadComment() { LoadId = load.Id, UserId = _user.Id, Comment = "MacroPoint Schedule Alert -- " + MacroPointService.ScheduleAlertMessage(ScheduleAlertCode) + " | " + ScheduleAlertText, CreatedDate = DateTime.Now.ToUniversalTime(), LocationTime = DateTime.Now.ToUniversalTime() }; _loadBusiness.AddComment(load.Id, comment); } catch (Exception e) { _applicationServices.HandleException(e, ExceptionCategory.Controller); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }
public HttpStatusCode LocationUpdate(string ID, decimal Latitude, decimal Longitude, decimal Uncertainty, string Street1, string Street2, string Neighborhood, string City, string State, string Postal, string Country, DateTime LocationDateTimeUTC, DateTime ApproxLocationDateTimeInLocalTime, string MPOrderID) { try { var logText = string.Format("MacroPoint LocationUpdate -- ID: {0}, City: {1}, State: {2}, ApproxLocationDateTimeInLocalTime: {3}, MPOrderId: {4}", ID, City, State, ApproxLocationDateTimeInLocalTime, MPOrderID); _applicationServices.LogWriteFull(logText, LoggingSeverity.Information, LoggingCategory.Controller); Load load = _loadBusiness.GetLoadByMacroPointId(MPOrderID); if (load != null) { LoadComment comment = new LoadComment() { LoadId = load.Id, UserId = _user.Id, Comment = "MacroPoint Location Update", City = City, State = State, Latitude = Latitude, Longitude = Longitude, CreatedDate = ApproxLocationDateTimeInLocalTime, LocationTime = ApproxLocationDateTimeInLocalTime }; _loadBusiness.AddComment(load.Id, comment); } } catch (Exception e) { _applicationServices.HandleException(e, ExceptionCategory.Controller); return(HttpStatusCode.InternalServerError); } return(HttpStatusCode.OK); }
public HttpStatusCode TrackingStatusChange(string ID, string Code, string Message, string MPOrderID) { try { var logText = string.Format("MacroPoint TrackingStatusChange -- ID: {0}, Code: {1}, Message: {2}, MPOrderID: {3}", ID, Code, Message, MPOrderID); _applicationServices.LogWriteFull(logText, LoggingSeverity.Information, LoggingCategory.Controller); Load load = _loadBusiness.GetLoadByMacroPointId(MPOrderID); if (load != null) { LoadComment comment = new LoadComment() { LoadId = load.Id, UserId = _user.Id, Comment = "MacroPoint Tracking Status Change -- " + MacroPointService.TrackingStatus(Code), CreatedDate = DateTime.Now.ToUniversalTime(), LocationTime = DateTime.Now.ToUniversalTime() }; _loadBusiness.AddComment(load.Id, comment); string userMessage = string.Format("Tracking Status Change (Order #: {0}) - {1}", load.OrderId, MacroPointService.TrackingStatus(Code)); List <int> usersToMessage = new List <int> { load.Order.AssignedId }; if (load.AssignedTo != null) { usersToMessage.Add(load.AssignedTo.Value); } if (load.CoveredBy != null) { usersToMessage.Add(load.CoveredBy.Value); } _loadBusiness.NotifyUsers(userMessage, usersToMessage, "Order:" + load.OrderId); } } catch (Exception e) { return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }