コード例 #1
0
        /// <summary>
        /// Hangfire job to send Change Address message to One stop.
        /// </summary>
        public async Task SendChangeAddressRest(PerformContext hangfireContext, string licenceGuidRaw, string queueItemId)
        {
            IDynamicsClient dynamicsClient = DynamicsSetupUtil.SetupDynamics(_configuration);

            if (hangfireContext != null)
            {
                hangfireContext.WriteLine("Starting OneStop REST ChangeAddress Job.");
            }

            string licenceGuid = Utils.ParseGuid(licenceGuidRaw);

            //prepare soap content
            var req     = new ChangeAddress();
            var licence = dynamicsClient.GetLicenceByIdWithChildren(licenceGuid);

            if (hangfireContext != null && licence != null)
            {
                hangfireContext.WriteLine($"Got Licence {licenceGuid}.");
            }

            if (licence == null || licence.AdoxioEstablishment == null)
            {
                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine($"Unable to get licence {licenceGuid}.");
                }

                if (Log.Logger != null)
                {
                    Log.Logger.Error($"Unable to get licence {licenceGuid}.");
                }
            }
            else
            {
                var innerXml = req.CreateXML(licence);
                innerXml = _onestopRestClient.CleanXML(innerXml);

                if (Log.Logger != null)
                {
                    Log.Logger.Information(innerXml);
                }

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(innerXml);
                }

                //send message to Onestop hub

                var outputXML = await _onestopRestClient.ReceiveFromPartner(innerXml);

                UpdateQueueItemForSend(dynamicsClient, hangfireContext, queueItemId, innerXml, outputXML);

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(outputXML);
                    hangfireContext.WriteLine("End of OneStop REST ChangeAddress  Job.");
                }
            }
        }
コード例 #2
0
 private void UpdateOscAddress()
 {
     oscAddress = OscAddress.Text;
     if (oscAddress.Substring(0, 1) != "/")
     {
         oscAddress      = "/" + oscAddress;
         OscAddress.Text = oscAddress;
         ChangeAddress.Focus();
     }
 }
コード例 #3
0
        public async Task <IActionResult> ChangeAddress(ChangeAddress command)
        {
            ActionContext.RouteData.Values["action"] = "Edit";

            Logger.Info("Changing Address");

            await DispatchAsync(command);

            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public async Task <IActionResult> ChangeAddress([FromBody] ChangeAddress command)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await DispatchAsync(command);

            return(NoContent());
        }
コード例 #5
0
        public async Task <ActionResult> ChangeAddress(ChangeAddress model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            AppUser userLoggedIn = await _userManager.FindByNameAsync(User.Identity.Name);

            userLoggedIn.Address = model.NewAddress;

            _db.Users.Update(userLoggedIn);
            _db.SaveChanges();


            return(View(model));
        }
コード例 #6
0
        public ActionResult ChangeAddress()
        {
            ChangeAddress cpn = new ChangeAddress();

            return(View(cpn));
        }