예제 #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            OutboundCarrierManifestsPost outboundcarriermanifests = _outboundcarriermanifestsService.GetPost(id);

            outboundcarriermanifests.UserName = User.Identity.Name;
            _outboundcarriermanifestsService.Delete(outboundcarriermanifests);
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Edit([Bind("ixOutboundCarrierManifest,sOutboundCarrierManifest,ixFacility,ixCarrier,ixPickupInventoryLocation,dtScheduledPickupAt,ixStatus")] OutboundCarrierManifestsPost outboundcarriermanifests)
        {
            if (ModelState.IsValid)
            {
                outboundcarriermanifests.UserName = User.Identity.Name;
                _outboundcarriermanifestsService.Edit(outboundcarriermanifests);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixCarrier  = new SelectList(_outboundcarriermanifestsService.selectCarriers().Select(x => new { x.ixCarrier, x.sCarrier }), "ixCarrier", "sCarrier", outboundcarriermanifests.ixCarrier);
            ViewBag.ixFacility = new SelectList(_outboundcarriermanifestsService.selectFacilities().Select(x => new { x.ixFacility, x.sFacility }), "ixFacility", "sFacility", outboundcarriermanifests.ixFacility);
            ViewBag.ixPickupInventoryLocation = new SelectList(_outboundcarriermanifestsService.selectInventoryLocationsNullable().Select(x => new { ixInventoryLocation = x.Key, sInventoryLocation = x.Value }), "ixInventoryLocation", "sInventoryLocation", outboundcarriermanifests.ixPickupInventoryLocation);
            ViewBag.ixStatus = new SelectList(_outboundcarriermanifestsService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus", outboundcarriermanifests.ixStatus);

            return(View(outboundcarriermanifests));
        }
예제 #3
0
        public ActionResult Edit(long id)
        {
            OutboundCarrierManifestsPost outboundcarriermanifests = _outboundcarriermanifestsService.GetPost(id);

            if (outboundcarriermanifests == null)
            {
                return(NotFound());
            }
            ViewBag.ixCarrier  = new SelectList(_outboundcarriermanifestsService.selectCarriers().Select(x => new { x.ixCarrier, x.sCarrier }), "ixCarrier", "sCarrier", outboundcarriermanifests.ixCarrier);
            ViewBag.ixFacility = new SelectList(_outboundcarriermanifestsService.selectFacilities().Select(x => new { x.ixFacility, x.sFacility }), "ixFacility", "sFacility", outboundcarriermanifests.ixFacility);
            ViewBag.ixPickupInventoryLocation = new SelectList(_outboundcarriermanifestsService.selectInventoryLocationsNullable().Select(x => new { ixInventoryLocation = x.Key, sInventoryLocation = x.Value }), "ixInventoryLocation", "sInventoryLocation", outboundcarriermanifests.ixPickupInventoryLocation);
            ViewBag.ixStatus = new SelectList(_outboundcarriermanifestsService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus", outboundcarriermanifests.ixStatus);

            return(View(outboundcarriermanifests));
        }
        public Task Delete(OutboundCarrierManifestsPost outboundcarriermanifestsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._outboundcarriermanifestsRepository.RegisterDelete(outboundcarriermanifestsPost);
            try
            {
                this._outboundcarriermanifestsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._outboundcarriermanifestsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.CompletedTask);
        }
        public Task <Int64> Create(OutboundCarrierManifestsPost outboundcarriermanifestsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._outboundcarriermanifestsRepository.RegisterCreate(outboundcarriermanifestsPost);
            try
            {
                this._outboundcarriermanifestsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._outboundcarriermanifestsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.FromResult(outboundcarriermanifestsPost.ixOutboundCarrierManifest));
        }
예제 #6
0
        public Task Edit(PickBatchesPost pickbatchesPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._pickbatchesRepository.RegisterEdit(pickbatchesPost);
            try
            {
                this._pickbatchesRepository.Commit();
            }
            catch (Exception ex)
            {
                this._pickbatchesRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process
            //Custom Code Start | Added Code Block

            if (pickbatchesPost.ixStatus == _commonLookUps.getStatuses().Where(s => s.sStatus == "Complete").Select(s => s.ixStatus).FirstOrDefault())
            {
                // We check if the shipment associated with the orders on the batch has been manifested. If not we try and find an active manifest else we create a new one and add the shipment to it
                var outboundShipments = _outboundordersRepository.IndexDb().Where(x => x.ixPickBatch == pickbatchesPost.ixPickBatch).Select(x => x.ixOutboundShipment).ToList();
                var outboundShipmentsNotManifested = _outboundshipmentsService.IndexDb().Where(x => x.ixOutboundCarrierManifest == null)
                                                     .Join(outboundShipments, os => os.ixOutboundShipment, o => o, (os, o) => new { Os = os, O = o })
                                                     .Select(s => s.Os.ixOutboundShipment).ToList();

                outboundShipmentsNotManifested.ForEach(x =>
                {
                    var outboundShipment = _outboundshipmentsService.GetPost(x);
                    if (
                        _outboundcarriermanifestsService.IndexDb().Where(m =>
                                                                         m.ixFacility == outboundShipment.ixFacility &&
                                                                         m.ixCarrier == outboundShipment.ixCarrier &&
                                                                         m.ixStatus == _commonLookUps.getStatuses().Where(s => s.sStatus == "Active").Select(s => s.ixStatus).FirstOrDefault()
                                                                         ).Any())
                    {
                        var ixOutboundCarrierManifest = _outboundcarriermanifestsService.IndexDb().Where(m =>
                                                                                                         m.ixFacility == outboundShipment.ixFacility &&
                                                                                                         m.ixCarrier == outboundShipment.ixCarrier &&
                                                                                                         m.ixStatus == _commonLookUps.getStatuses().Where(s => s.sStatus == "Active").Select(s => s.ixStatus).FirstOrDefault()
                                                                                                         ).Select(m => m.ixOutboundCarrierManifest).FirstOrDefault();
                        outboundShipment.ixOutboundCarrierManifest = ixOutboundCarrierManifest;
                        outboundShipment.UserName = pickbatchesPost.UserName;
                        _outboundshipmentsService.Edit(outboundShipment);
                    }
                    else
                    {
                        OutboundCarrierManifestsPost outboundCarrierManifestsPost = new OutboundCarrierManifestsPost();
                        outboundCarrierManifestsPost.ixFacility = outboundShipment.ixFacility;
                        outboundCarrierManifestsPost.ixCarrier  = outboundShipment.ixCarrier;
                        outboundCarrierManifestsPost.ixPickupInventoryLocation = _shipping.getTrailerDoorSuggestion(outboundShipment.ixFacility);
                        outboundCarrierManifestsPost.ixStatus            = _commonLookUps.getStatuses().Where(s => s.sStatus == "Active").Select(s => s.ixStatus).FirstOrDefault();
                        outboundCarrierManifestsPost.dtScheduledPickupAt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) + _outboundshipmentsService.CarriersDb().Where(c => c.ixCarrier == outboundShipment.ixCarrier).Select(c => c.dtScheduledPickupTime).FirstOrDefault();
                        outboundCarrierManifestsPost.UserName            = pickbatchesPost.UserName;
                        var ixOutboundCarrierManifest = _outboundcarriermanifestsService.Create(outboundCarrierManifestsPost).Result;
                        outboundShipment.ixOutboundCarrierManifest = ixOutboundCarrierManifest;
                        outboundShipment.UserName = pickbatchesPost.UserName;
                        _outboundshipmentsService.Edit(outboundShipment);
                    }
                }
                                                       );
            }
            //Custom Code End



            return(Task.CompletedTask);
        }
예제 #7
0
 public void RegisterDelete(OutboundCarrierManifestsPost outboundcarriermanifestsPost)
 {
     _context.OutboundCarrierManifestsPost.Remove(outboundcarriermanifestsPost);
 }
예제 #8
0
 public void RegisterEdit(OutboundCarrierManifestsPost outboundcarriermanifestsPost)
 {
     _context.Entry(outboundcarriermanifestsPost).State = EntityState.Modified;
 }
예제 #9
0
 public void RegisterCreate(OutboundCarrierManifestsPost outboundcarriermanifestsPost)
 {
     _context.OutboundCarrierManifestsPost.Add(outboundcarriermanifestsPost);
 }