Ejemplo n.º 1
0
        public async Task Log(string action, bool status, int statusCode, string token, int externalUserId, int userId, string message = null)
        {
            var tokenId = InternalDatabase.Key
                          .Where(k => k.Content == token)
                          .Select(k => k.Id)
                          .FirstOrDefault();

            var externalUser = Database.Users
                               .Where(u => u.Id == externalUserId)
                               .FirstOrDefault();

            string content = $"<u>'{externalUser.Email}'</u> invoked action '{action}'";

            if (!status)
            {
                content += $"<br/><b class='error'>Message: {message}<br/>Status code: {statusCode}</b>";
            }


            var activity = new Data.Activity
            {
                Status         = status,
                KeyId          = tokenId,
                OccuredOn      = DateTime.Now,
                UserId         = userId,
                ExternalUserId = externalUser.Id,
                Content        = content
            };

            InternalDatabase.Activity.Add(activity);

            await InternalDatabase.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);



            Data.Activity activity = new Data.Activity();
            activity.Guid = "66AAEEF3-9257-4A16-A793-E7B83A69FFB9";
            MainWindowDisplay mainWindow = new MainWindowDisplay();

            mainWindow.LoadActivity(activity);


            mainWindow.Show();
        }
Ejemplo n.º 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);


            //try
            //{
            //    CO_IA.Client.SystemConfigLoader.RegisterSystemConfig();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //    App.Current.Shutdown();
            //    return;
            //}
            //PortalWindow wnd = new PortalWindow();
            //this.MainWindow = wnd;
            //this.MainWindow.Show();

            //Data.Activity activity = new Data.Activity();
            //activity.Guid = "66AAEEF3-9257-4A16-A793-E7B83A69FFB9";
            //MainWindow mainWindow = new MainWindow();
            //mainWindow.LoadActivity(activity);


            //mainWindow.Show();
            string menutype = "";

            if (e.Args.Length > 0)
            {
                menutype = e.Args[0];
            }


            Data.Activity activity = new Data.Activity();
            activity.Guid = "66AAEEF3-9257-4A16-A793-E7B83A69FFB9";
            MainWindowDisplay mainWindow = new MainWindowDisplay(menutype);

            mainWindow.LoadActivity(activity);


            mainWindow.Show();
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            //if (username.Text == "admin" && password.Text == "1qaz@WSX")
            //{
            Data.Activity activity = new Data.Activity();
            activity.Guid = "66AAEEF3-9257-4A16-A793-E7B83A69FFB9";
            MainWindow mainWindow = new MainWindow();

            mainWindow.LoadActivity(activity);


            mainWindow.Show();

            this.Close();
            //}
            //else
            //{
            //    this.tb_SM.Text = "账号或者密码错误,请确认后再登陆!";
            //}
        }