private IEnumerable <StopVO> BuildStops(DataTable dataTable) { var Stops = new List <StopVO>(); foreach (DataRow currentRow in dataTable.Rows) { var currentStop = new StopVO { Identity = (int)currentRow["REQ_ETY_OGN_I"], EntityName = currentRow["ETY_NM"].ToString(), EntityIdentity = (int)currentRow["ETY_KEY_I"], StopNumber = currentRow["STP_NBR"].ToString(), RoleType = currentRow["SLU_PTR_RL_TYP_C"].ToString(), OrganizationName = currentRow["OGN_NM"].ToString(), AddressLine1 = currentRow["ADR_LNE_1"].ToString(), AddressLine2 = currentRow["ADR_LNE_2"].ToString(), AddressCityName = currentRow["ADR_CTY_NM"].ToString(), AddressStateCode = currentRow["ADR_ST_PROV_C"].ToString(), AddressCountryCode = currentRow["ADR_CRY_C"].ToString(), AddressPostalCode = currentRow["ADR_PST_C_SRG"].ToString(), CreatedDate = (DateTime?)currentRow["CRT_S"], CreatedUserId = currentRow["CRT_UID"].ToString(), CreatedProgramCode = currentRow["CRT_PGM_C"].ToString(), LastUpdatedDate = (DateTime?)currentRow["LST_UPD_S"], LastUpdatedUserId = currentRow["LST_UPD_UID"].ToString(), LastUpdatedProgramCode = currentRow["LST_UPD_PGM_C"].ToString() }; currentStop.Appointments = GetAppointmentsByStop(currentStop).ToList(); currentStop.Comments = GetCommentsByStop(currentStop).ToList(); Stops.Add(currentStop); } return(Stops); }
private Party SetOrderDestinationFromStopVO(StopVO stopVo) => new Customer(stopVo.OrganizationName, new Address(stopVo.AddressLine1, stopVo.AddressLine2 ?? string.Empty, stopVo.AddressCityName ?? string.Empty, stopVo.AddressStateCode ?? string.Empty, stopVo.AddressPostalCode ?? string.Empty ) );
private Party SetOrderOriginFromStopVO(StopVO stopVo) => new Facility(stopVo.OrganizationName, new Address(stopVo.AddressLine1 ?? string.Empty, stopVo.AddressLine2 ?? string.Empty, stopVo.AddressCityName ?? string.Empty, stopVo.AddressStateCode ?? string.Empty, stopVo.AddressPostalCode ?? string.Empty ) );
public IEnumerable <CommentVO> GetCommentsByStop(StopVO stop) { const string selectQueryStatement = "SELECT * FROM REQ_ETY_CMM WHERE ETY_NM = 'REQ_ETY_OGN' AND ETY_KEY_I = @REQ_ETY_OGN_I"; var query = Database.CreateQuery(selectQueryStatement); query.AddParameter(stop.Identity, StopRequestQueryParameters.Identity); var result = Database.RunSelect(query); var CommentsByStop = Hydrater.Hydrate(result); return(CommentsByStop); }
private LegType SetLegtype(StopVO stopVo) { if (string.IsNullOrEmpty(stopVo.RoleType)) { return(LegType.Pickup); } else { List <string> delivery = new List <string> { StopRoleTypes.BillTo, StopRoleTypes.ShipTo, StopRoleTypes.Shipper, StopRoleTypes.Shipper }; return((delivery.Contains(stopVo.RoleType)) ? LegType.Delivery : LegType.Pickup); } }
private IEnumerable <AppointmentVO> GetAppointmentsByStop(StopVO stop) { const string selectQueryStatement = "SELECT * FROM REQ_ETY_SCH WHERE ETY_NM = 'REQ_ETY_OGN' AND ETY_KEY_I = @REQ_ETY_OGN_I"; using (SqlConnection defaultSqlConnection = new SqlConnection(DatabaseConnectionString)) { defaultSqlConnection.Open(); DataTable queryResult = new DataTable(); using (SqlCommand queryCommand = new SqlCommand(selectQueryStatement, defaultSqlConnection)) { queryCommand.Parameters.AddWithValue("@REQ_ETY_OGN_I", stop.Identity); var sqlReader = queryCommand.ExecuteReader(); queryResult.Load(sqlReader); } var AppointmentsByStop = BuildAppointments(queryResult); return(AppointmentsByStop); } }