Exemplo n.º 1
0
        public ActionResult Create(string appType, Models.Applications.NewApplicationDetails model)
        {
            // Setup url for notification
            var url = Url.Action("Index", "Applications", null, Request.Url.Scheme);

            // Setup name
            var data = (NewApplicationDetails)model;

            data.Name = model.Name;

            // Create application
            Application application = _applications.Create(url, model, LoggedInUser);

            // Log details for industry good application
            if (application.IsIntroducedAsIndustryGood)
            {
                // Log industry good action
                _auditLog.Log(AuditStream.General, "Industry Good",
                              new
                {
                    id    = LoggedInUser.ID,
                    email = LoggedInUser.Email
                },
                              new
                {
                    remote_ip = Request.UserHostAddress,
                    browser   = Request.Browser.Browser
                });
            }

            // Setup status message
            Toastr.Success("Service was successfully created");
            return(RedirectToAction("Details", new { id = application.ID }));
        }
Exemplo n.º 2
0
        public void AddMyObject(MyObject item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            item.Created = DateTime.Now;
            Validator.ValidateObject(item, new ValidationContext(item));

            _logger.Log("Adding item {0}", item.Id);
            _repository.Add(item);
        }
Exemplo n.º 3
0
        private void LogAudit(JourneyViewModel model, string pageName)
        {
            var auditEntry = model.ToAuditEntry();

            auditEntry.Page = pageName;
            _auditLogger.Log(auditEntry);
        }
Exemplo n.º 4
0
        public void ChangeStatus(int id, bool value)
        {
            // Update user status
            _users.UpdateStatus(id, value, LoggedInUser);

            // Audit log
            _auditLog.Log(AuditStream.UserActivity, $"User becomes activate '{value}'",
                          new
            {
                id     = LoggedInUser.ID,
                email  = LoggedInUser.Email,
                userId = id
            },
                          new
            {
                remote_ip = Request.UserHostAddress,
                browser   = Request.Browser.Browser
            });
        }
        public ActionResult ConfirmationScreen(string token)
        {
            try
            {
                // Get model
                LicenseConfirmModel model = _licenseVerification.GetConfirmModel(token, LoggedInUser);

                // Return appropriate view
                switch (model.Type)
                {
                case OrganisationLicenseType.FromTemplate:
                    return(View("ConfirmationScreen", model));

                case OrganisationLicenseType.Custom:
                    return(View("CustomLicenseVerification", model));

                default: throw new BaseException("Unknown license type.");
                }
            }
            catch (BaseException ex)
            {
                // Log action
                _auditLog.Log(AuditStream.LegalAgreements, "Confirmation Failed: ",
                              new
                {
                    id    = LoggedInUser.ID,
                    email = LoggedInUser.Email
                },
                              new
                {
                    error     = ex.Message,
                    remote_ip = Request.UserHostAddress,
                    browser   = Request.Browser.Browser
                });

                throw;
            }
        }
Exemplo n.º 6
0
        public void Commit()
        {
            if (logger != null)
            {
                logger.Log(context.ChangeTracker.Entries <BaseModel>());
            }

            context.SaveChanges();

            if (logger != null)
            {
                logger.Save();
            }
        }
Exemplo n.º 7
0
        public ActionResult SendToLegalOfficer(int id, int schemaId, int appId)
        {
            // Send request
            _licenseService.RequestLicenseVerification(id, appId, schemaId, LoggedInUser);

            // Log user action
            _auditLog.Log(AuditStream.LegalAgreements, "Send to Legal", new { LoggedInUser.ID, LoggedInUser.Email },
                          new
            {
                remote_ip = Request.UserHostAddress,
                browser   = Request.Browser.Browser
            });

            // Redirect to provider licenses screen
            var redirectUrl = Url.Action("Index", "Licenses", new { appId, schemaId });

            Toastr.Success("License was sent to Legal Officer of your organization.");
            return(Json(new { Url = redirectUrl, isSuccess = true }, JsonRequestBehavior.AllowGet));
        }