Example #1
0
        //HazmatLocation GetLocationByDesc(string desc);
        public HazmatLocation GetLocationByDesc(string desc)
        {
            HazmatLocation location = new HazmatLocation();
            // Check if location is of type PS_PAG_LOCATION, if found, it is of type PS_PAG_LOCATION
            PS_PAG_LOCATION_VW tempLoc1 = context.PS_PAG_LOCATION_VW.Where(l => l.DESCRSHORT == desc).FirstOrDefault();

            if (tempLoc1 != null)
            {
                location.Address1   = tempLoc1.ADDRESS1.TrimEnd();
                location.City       = tempLoc1.CITY.TrimEnd();
                location.Descr      = tempLoc1.DESCR.TrimEnd();
                location.DescrShort = tempLoc1.DESCRSHORT.TrimEnd();
                location.Location   = tempLoc1.LOCATION.TrimEnd();
                location.Postal     = tempLoc1.POSTAL.TrimEnd();
                location.State      = tempLoc1.STATE.TrimEnd();
            }
            // Not of type PS_PAG_LOCATION, but instead of type PS_LocationAll
            if (tempLoc1 == null)
            {
                PS_LocationAll tempLoc2 = GetPSLocation(desc);
                location.Address1   = tempLoc2.ADDRESS1.TrimEnd();
                location.City       = tempLoc2.CITY.TrimEnd();
                location.Descr      = tempLoc2.DESCR.TrimEnd();
                location.DescrShort = tempLoc2.DESCR.TrimEnd();
                location.Location   = tempLoc2.LOCATION.TrimEnd();
                location.Postal     = tempLoc2.POSTAL.ToString();
                location.State      = tempLoc2.STATE.TrimEnd();
            }
            return(location);
        }
Example #2
0
        //
        // GET: /Hazmat/Ship/5
        public ActionResult Ship(int id)
        {
            ViewModel         viewModel = new ViewModel();
            HazmatInfo        shipment  = db.HazmatInfoes.Find(id);
            string            orderNo   = shipment.OrderNo;
            List <HazmatItem> items     = new List <HazmatItem>();

            items = hazmatRepository.GetOrderLineItems(orderNo).ToList();
            viewModel.Shipment = shipment;
            viewModel.Items    = items;
            VehicleDropDownList();
            LocationDropDownList();
            PS_LocationAll shipper = new PS_LocationAll();

            shipper = hazmatRepository.GetPSLocation(shipment.FromBU);
            string[] shipperAddress = new string[5];
            shipperAddress[0] = shipper.DESCR;
            shipperAddress[1] = shipper.ADDRESS1;
            shipperAddress[2] = shipper.CITY;
            shipperAddress[3] = shipper.STATE;
            shipperAddress[4] = shipper.POSTAL.ToString();
            ViewBag.Shipper   = shipperAddress;
            if (shipment.Location != null)
            {
                PS_LocationAll receiver = new PS_LocationAll();
                receiver = hazmatRepository.GetPSLocation(shipment.Location);
                string[] receiverAddress = new string[5];
                receiverAddress[0] = receiver.DESCR;
                receiverAddress[1] = receiver.ADDRESS1;
                receiverAddress[2] = receiver.CITY;
                receiverAddress[3] = receiver.STATE;
                receiverAddress[4] = receiver.POSTAL.ToString();
                ViewBag.Receiver   = receiverAddress;
            }
            if (shipment == null)
            {
                return(HttpNotFound());
            }
            List <HazmatPlacard> placards = new List <HazmatPlacard>();

            foreach (HazmatItem item in items.GroupBy(p => p.Placard).Select(grp => grp.First()))
            {
                placards.Add(hazmatRepository.GetHazmatPlacard(item.Placard));
            }
            viewModel.Placards = placards;
            return(View(viewModel));
        }
Example #3
0
        //PS_LocationAll GetPSShipLocation(string locationId);
        public PS_LocationAll GetPSLocation(string locationId)
        {
            string tempLocationId;

            switch (locationId)
            {
            case "ROSS MAINT":
                tempLocationId = "010RO";
                break;

            case "COLL MAINT":
                tempLocationId = "024CO";
                break;

            case "W/M MAINT":
                tempLocationId = "046WM";
                break;

            case "E/L MAINT":
                tempLocationId = "056EL";
                break;

            case "HARMAR MNT":
                tempLocationId = "060HA";
                break;

            case "SHVRC COMM":
                tempLocationId = "144RC";
                break;

            case "MANCH SHOP":
                tempLocationId = "140CS";
                break;

            //case "COLL MAINT":
            //    tempLocationId = "141FS";
            //    break;
            default:
                tempLocationId = locationId;
                break;
            }

            PS_LocationAll location = context.PS_LocationAll.Where(l => l.LOCATION == tempLocationId).SingleOrDefault();

            return(location);
        }