Exemplo n.º 1
0
 public void AddViewLog(ViewLog log)
 {
     using (var c = new MongoDbRepository <ViewLog>(DBName))
     {
         c.Add(log);
     }
 }
Exemplo n.º 2
0
        public MainForm()
        {
            _settings = JsonConvert.DeserializeObject <Settings>(File.ReadAllText(Settings.Path));
            _settings.Repositories = JsonConvert.DeserializeObject <List <Repository> >(File.ReadAllText(Repository.Path));
            _log   = new ViewLog(_settings);
            _azure = new AzureStorageEmulatorCommand(_settings);

            InitializeComponent();

            Closing += MainForm_Closing;
        }
Exemplo n.º 3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            if (filterContext.HttpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            var sessionProvider = Bootstrapper.GetRepository <ISessionProvider>();
            var currentUser     = LoginHelper.Instance.GetLoginUser <UserBase>();

            string controllerName = filterContext.RouteData.Values["controller"].ToString();
            string actionName     = filterContext.RouteData.Values["action"].ToString();
            var    url            = "/" + controllerName.ToLower() + "/" + actionName.ToLower();
            var    ip             = GetIP();
            var    vLog           = new ViewLog();

            vLog.ViewType   = "Web";
            vLog.FromIp     = ip;
            vLog.Action     = actionName;
            vLog.Controller = controllerName;
            if (currentUser != null)
            {
                vLog.OpertingUser = currentUser.Account;
            }
            else
            {
                vLog.OpertingUser = ip;
            }

            vLog.CreateDate = DateTime.Now;
            vLog.Name       = controllerName + "-" + actionName;
            vLog.Operation  = filterContext.RequestContext.HttpContext.Request.HttpMethod;
            vLog.Para       = filterContext.RequestContext.HttpContext.Request.Url.ToString();
            var idbLog = Bootstrapper.GetRepository <IDbLog>();

            if (idbLog != null)
            {
                idbLog.AddViewLog(vLog);
            }
        }
Exemplo n.º 4
0
 private void ButLog_Click(object sender, RoutedEventArgs e)
 {
     ViewLog vl = new ViewLog();
     vl.Show();
 }
 /// <summary>
 /// Handles the Click event of the ViewLog control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void ViewLog_Click(object sender, RoutedEventArgs e)
 {
     ViewLog?.Invoke(this, new EventArgs());
 }