Ejemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(Guid id)
        {
            RequestTracking requestTracking = await db.RequestTracking.FindAsync(id);

            requestTracking.IsDeleted = true;
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "ID,Name,DateTime,IsDeleted")] RequestTracking requestTracking)
        {
            if (ModelState.IsValid)
            {
                db.Entry(requestTracking).State = EntityState.Modified;
                requestTracking.DateTime        = DateTime.Now;
                requestTracking.IsDeleted       = false;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(requestTracking));
        }
Ejemplo n.º 3
0
        // GET: RequestTrackings/Edit/5
        public async Task <ActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RequestTracking requestTracking = await db.RequestTracking.FindAsync(id);

            if (requestTracking == null)
            {
                return(HttpNotFound());
            }
            return(View(requestTracking));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Create([Bind(Include = "ID,Name,DateTime,IsDeleted")] RequestTracking requestTracking)
        {
            if (ModelState.IsValid)
            {
                requestTracking.ID        = Guid.NewGuid();
                requestTracking.DateTime  = DateTime.Now;
                requestTracking.IsDeleted = false;
                db.RequestTracking.Add(requestTracking);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(requestTracking));
        }
        public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            var user = context.HttpContext.User?.GetClaim(ClaimTypes.Email) ?? "Anonymous";

            var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;

            var area = controllerActionDescriptor.ControllerTypeInfo.GetCustomAttribute <AreaAttribute>()?.RouteValue;

            tracking = new RequestTracking()
            {
                UserId     = user,
                Area       = area,
                Controller = controllerActionDescriptor.ControllerName,
                Action     = controllerActionDescriptor.ActionName,
                Verb       = context.HttpContext.Request.Method,
                Host       = context.HttpContext.Request.Host.ToString()
            };

            return(base.OnActionExecutionAsync(context, next));
        }
        public async Task AddTracking(RequestTracking tracking)
        {
            await context.AddAsync(tracking);

            await context.CommitAsync();
        }
Ejemplo n.º 7
0
        private static void SetupTrackingRequest(string filePath, ref XmlDocument doc, RequestTracking model)
        {
            XmlNode languageCode = doc.SelectSingleNode("//LanguageCode");

            languageCode.InnerText = model.LanguageCode;
            XmlNode waybill = doc.SelectSingleNode("//AWBNumber");

            if (waybill != null)
            {
                waybill.InnerText = model.Waybill;
            }
            XmlNode lPNumber = doc.SelectSingleNode("//LPNumber");

            if (lPNumber != null)
            {
                lPNumber.InnerText = model.LPNumber;
            }

            XmlNode levelOfDetails = doc.SelectSingleNode("//LevelOfDetails");

            levelOfDetails.InnerText = model.LevelOfDetails;
            XmlNode piecesEnabled = doc.SelectSingleNode("//PiecesEnabled");

            if (piecesEnabled != null)
            {
                piecesEnabled.InnerText = model.PiecesEnabled;
            }

            doc.Save(filePath);
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            //DHLApi api = new DHLApi();


            string url = ConfigurationManager.AppSettings["DHLWebApi"];

            //string xmlFile = "TrackingRequest_SingleAWB_10D.xml";
            //string xmlFile = "TrackingRequest_MultipleLP_PieceEnabled_B_1.xml";
            //string xmlFile = "Shipment_Global_AP_RegularShpmt_Request.xml";
            //string xmlFile = "Request.xml";
            //string xmlFile = "BookPickup_GlobalAP_Valid1_Request.xml";
            //string xmlFile = "Valid15_Quote_VolWeightHigher_Request.xml";
            //string xmlFile = "Valid13_Quote_IMPPricebyReceiver_Request.xml";
            string xmlFile = "Valid10_Quote_AP_PriceBreakdownRAS_Request.xml";

            //string xmlFile = "Valid11_Quote_EU_PriceBreakdownRAS_Request.xml";
            //string xmlFile = "Valid14_Quote_IMPPriceby3rdParty_Request.xml";
            //string xmlFile = "Valid17_Quote_EU_NonEU_WithAcctProdInsurance_Request.xml";
            //string xmlFile = "Valid18_Quote_BRtoUS_Request.xml";
            //string xmlFile = "Valid19_Quote_PEtoEG_Suburb_Request.xml";
            //string xmlFile = "Valid20_Quote_BRtoBR_TaxBreakdownPricing_Request.xml";
            //string xmlFile = "Valid3_Capability_EU_NonEU_Dutiable_Request.xml";
            //string xmlFile = "Valid3_Capability_EU_NonEU_Dutiable_Request.xml";



#if false
            string filePath = Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath(@"~/DHLShippingXml/"), xmlFile);
#else
            string filePath = Path.Combine(Environment.CurrentDirectory + @"/DHLShippingXml/", xmlFile);
#endif
            // Setup RequestQuote object
            RequestBase requestQuote = new RequestQuote
            {
                RequestType = REQUESTS.CAPABILITY,

                Origin = new CountryPostalCode()
                {
                    CountryCode = "BE",
                    Postalcode  = "1020",
                    City        = "Lima"
                },

                BkgDetails = new BkgDetails()
                {
                    PaymentCountryCode = "BE",
                    Date               = "2017-08-27",
                    ReadyTime          = "PT10H22M",
                    ReadyTimeGMTOffset = "+02:00",
                    DimensionUnit      = "CM",
                    WeightUnit         = "KG",
                    Pieces             = new List <Piece>()
                    {
                        new Piece()
                        {
                            PieceID = 1,
                            Height  = 30,
                            Depth   = 20,
                            Width   = 10,
                            Weight  = 1.0f,
                        },

                        new Piece()
                        {
                            PieceID = 2,
                            Height  = 60,
                            Depth   = 40,
                            Width   = 20,
                            Weight  = 2.0f,
                        }
                    },
                    IsDutiable      = "Y",
                    NetworkTypeCode = "AL",
                    QtdShp          = new QtdShp()
                    {
                        LocalProductCode = "S",
                        QtdShpExChrg_SpecialServiceType      = "I",
                        QtdShpExChrg_LocalSpecialServiceType = "II"
                    },
                    InsuredValue    = "400.000",
                    InsuredCurrency = "EUR",
                },
                Destination = new CountryPostalCode()
                {
                    CountryCode = "US",
                    Postalcode  = "86001"
                },
                Dutiable = new Dutiable()
                {
                    DeclaredCurrency = "EUR",
                    DeclaredValue    = "9.0"
                }
            };

            // Setup RequestTracking object
            RequestBase requestTracking = new RequestTracking()
            {
                RequestType  = REQUESTS.TRACKING,
                LanguageCode = "en",
                Waybill      = "5093841045",
                //LPNumber = "JD0144549751510007712",
                LevelOfDetails = "ALL_CHECK_POINTS",
                PiecesEnabled  = "B"
            };

#if true
            DHLApi.SetupRequest(filePath, requestQuote);
            DHLApi.XmlRequest(url, filePath);
            DHLResponse resp = DHLApi.XmlResponse(DHLApi.ResponseXmlString, REQUESTS.CAPABILITY);
#else
            DHLApi.SetupRequest(filePath, requestTracking);
            DHLApi.XmlRequest(url, filePath);
            DHLResponse resp = DHLApi.XmlResponse(DHLApi.ResponseXmlString, REQUESTS.TRACKING);
#endif
            if (resp.RequestType == REQUESTS.TRACKING)
            {
                OutputTrackingResponse(resp.Trackings);
            }
            else
            {
                OutputQuoteResponse(resp.Quote);
            }
        }
        public async Task AddTracking(RequestTracking tracking)
        {
            await context.AddAsync(tracking).ConfigureAwait(false);

            await context.CommitAsync().ConfigureAwait(false);
        }
Ejemplo n.º 10
0
        public IODispatcher(IPublisher publisher, IEnvelope envelope, bool trackPendingRequests = false)
        {
            _publisher          = publisher;
            _inputQueueEnvelope = envelope;
            _requestTracker     = new RequestTracking(trackPendingRequests);

            ForwardReader =
                new RequestResponseDispatcher
                <ClientMessage.ReadStreamEventsForward, ClientMessage.ReadStreamEventsForwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);
            BackwardReader =
                new RequestResponseDispatcher
                <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);
            Writer =
                new RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            StreamDeleter =
                new RequestResponseDispatcher <ClientMessage.DeleteStream, ClientMessage.DeleteStreamCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            Awaker =
                new RequestResponseDispatcher <AwakeServiceMessage.SubscribeAwake, IODispatcherDelayedMessage>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope,
                    cancelMessageFactory: requestId => new AwakeServiceMessage.UnsubscribeAwake(requestId));

            EventReader =
                new RequestResponseDispatcher <ClientMessage.ReadEvent, ClientMessage.ReadEventCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            AllForwardReader =
                new RequestResponseDispatcher
                <ClientMessage.ReadAllEventsForward, ClientMessage.ReadAllEventsForwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            AllBackwardReader =
                new RequestResponseDispatcher
                <ClientMessage.ReadAllEventsBackward, ClientMessage.ReadAllEventsBackwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            AllForwardFilteredReader =
                new RequestResponseDispatcher
                <ClientMessage.FilteredReadAllEventsForward, ClientMessage.FilteredReadAllEventsForwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);

            AllBackwardFilteredReader =
                new RequestResponseDispatcher
                <ClientMessage.FilteredReadAllEventsBackward, ClientMessage.FilteredReadAllEventsBackwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    envelope);
        }