public void Adding(smART.ViewModel.Booking businessEntity, smART.Model.Booking modelEntity, smART.Model.smARTDBContext dbContext, out bool cancel) { // If Booking Status is null set default status to "Open" if (string.IsNullOrEmpty(modelEntity.Booking_Status)) { modelEntity.Booking_Status = "Open"; } cancel = false; }
public string GetContainerStatus(smART.Model.Booking modBooking, smART.Model.DispatcherRequest modelEntity, smART.Model.smARTDBContext dbContext) { string status = string.Empty; try { smART.Model.Scale modScale = modelEntity.Container != null?dbContext.T_Scale.FirstOrDefault(s => s.Container_No.ID == modelEntity.Container.ID && s.Container_No.Active_Ind == true) : null; if (modBooking.Invoice_Generated_Flag == true) { status = "Closed"; } else if (modScale != null && modScale.Ticket_Status.ToLower() == "open") { status = "WIP"; } else if (modScale != null && modScale.Ticket_Status.ToLower() == "close") { if (modelEntity.RequestType.ToLower() == "drop off only") { status = "Shipped"; } else { status = "Open-Loaded"; } } else if (string.IsNullOrWhiteSpace(modelEntity.RequestType) || modelEntity.RequestType.ToLower() == "pickup only") { status = "Open-Empty"; } else if (modelEntity.RequestType.ToLower() == "drop off only") { if (modScale != null) { status = "Shipped"; } else { status = "Open-Empty"; } } } catch (Exception ex) { bool rethrow; rethrow = BusinessRuleExceptionHandler.HandleException(ref ex, modelEntity.Updated_By, modelEntity.GetType().Name, modelEntity.ID.ToString()); if (rethrow) { throw ex; } } return(status); }
public void GotSingle(smART.ViewModel.Booking businessEntity, smART.Model.Booking modelEntity, smART.Model.smARTDBContext dbContext) { try { // Calculate assigned and due container and container netweight. IEnumerable <smART.Model.Container> containers = from c in dbContext.T_Container_Ref where c.Booking.ID == modelEntity.ID && c.Active_Ind == true select c; if (containers != null) { businessEntity.Containers_Assigned = containers.Count(); businessEntity.Total_Weight = containers.Sum(od => od.Net_Weight); businessEntity.Containers_Due = businessEntity.No_Of_Containers - businessEntity.Containers_Assigned; } } catch (Exception ex) { bool rethrow; rethrow = BusinessRuleExceptionHandler.HandleException(ref ex, businessEntity.Updated_By, businessEntity.GetType().Name, businessEntity.ID.ToString()); if (rethrow) { throw ex; } } }