コード例 #1
0
        public EmbassyLetterResponse SendEmbassyLetter(EmbassyLetterViewModel model,
                                                       AuthenticateResponse user)
        {
            var embassyLetter = new EmbassyLetterRequest
            {
                MembershipKey         = user.MembershipKey,
                FirstName             = user.FirstName,
                LastName              = user.LastName,
                PassPortNumber        = model.PassportNumber,
                AttentionName         = model.AttentionName,
                RecipientAddress      = model.RecipientAddress,
                AdditionalInstruction = model.AdditionalInstruction
            };

            var elResponse = _clientService.SendEmbassyLetter(embassyLetter);

            return(elResponse);
        }
コード例 #2
0
        public IActionResult EmbassyLetter(EmbassyLetterViewModel model)
        {
            var _user = new AuthenticateResponse
            {
                MembershipKey = 1006979,                   //1007435,
                EmailAddress  = "*****@*****.**", //"*****@*****.**",
                FirstName     = "Tolulope",
                LastName      = "Olusakin",
                FullName      = "Olusakin Tolulope S"//"Funmilayo Ruth Adeyemi",
            };

            try
            {
                if (!ModelState.IsValid)
                {
                    TempData["invalidForm"] = ViewBag.Message = "Error! Incorrect form details.";
                    return(View(model));
                }

                var response = _client.SendEmbassyLetter(model, _user);

                if (response != null && response.TrackingID != null)
                {
                    TempData["message"] = true;
                    var msg = "Success: " + response.StatusMessage + "your tracking ID is: " + response.TrackingID;
                    model.SuccessMessage = msg;
                }
                else
                {
                    TempData["message"] = false;
                    model.ErrorMessage  = response.StatusMessage;
                }
            }
            catch (Exception ex)
            {
                TempData["message"] = false;
                model.ErrorMessage  = ex.Message;
                Utilities.ProcessError(ex, _contentRootPath);
                _logger.LogError(null, ex, ex.Message);
            }

            return(View(model));
        }
コード例 #3
0
        public IActionResult EmbassyLetter()
        {
            //TrackServiceViewModel model
            var _user = new AuthenticateResponse
            {
                MembershipKey = 1006979,                   //1007435,
                EmailAddress  = "*****@*****.**", //"*****@*****.**",
                FirstName     = "Tolulope",
                LastName      = "Olusakin",
                FullName      = "Olusakin Tolulope S"//"Funmilayo Ruth Adeyemi",
            };

            if (_user == null)
            {
                TempData["SessionTimeOut"] = "You have been logged out due to inactivity. Please login to gain access.";
                return(RedirectToAction("Login", "Account"));
            }
            var modelview = new EmbassyLetterViewModel();

            //return View("EmbassyLetter", modelview);
            return(View(modelview));
        }
コード例 #4
0
        public IActionResult TrackService(EmbassyLetterViewModel modelview)
        {
            var _user = new AuthenticateResponse
            {
                MembershipKey = 1006979,                   //1007435,
                EmailAddress  = "*****@*****.**", //"*****@*****.**",
                FirstName     = "Tolulope",
                LastName      = "Olusakin",
                FullName      = "Olusakin Tolulope S"//"Funmilayo Ruth Adeyemi",
            };
            var model = new TrackServiceViewModel();

            if (_user == null)
            {
                TempData["SessionTimeOut"] = "You have been logged out due to inactivity. Please login to gain access.";
                return(RedirectToAction("Login", "Account"));
            }

            try
            {
                model.RequestType    = modelview.SelfService.RequestType;
                model.TrackingNumber = modelview.SelfService.TrackingNumber;

                var trRequest = new TrackServiceRequest
                {
                    MembershipNumber = _user.MembershipKey,
                    RequestType      = model.RequestType,
                    TrackingNumber   = model.TrackingNumber
                };

                List <RequestStatuses> getStatus = new List <RequestStatuses>();
                var trResponse = _clientService.TrackService(trRequest);

                if (trResponse.RequestStatuses != null && trResponse.RequestStatuses.Count > 0)
                {
                    foreach (var req in trResponse.RequestStatuses)
                    {
                        var status = new RequestStatuses();
                        status.MembershipNumber   = req.MembershipNumber;
                        status.Remark             = req.Remark;
                        status.CurrentStatus      = req.CurrentStatus;
                        status.RequestDescription = req.RequestDescription;
                        status.TrackingNumber     = req.TrackingNumber;

                        getStatus.Add(status);
                    }
                }

                //model.RequestStatuses = getStatus;
                var serializeStatus = JsonConvert.SerializeObject(getStatus);
                TempData["TrackService"] = serializeStatus;

                return(RedirectToAction("EmbassyLetter", "SelfService"));
            }
            catch (Exception ex)
            {
                Utilities.ProcessError(ex, _contentRootPath);
                _logger.LogError(null, ex, ex.Message);
            }
            return(View());
        }