Пример #1
0
        private void ProcessOpenView(OpenWindowMessage msg)
        {
            BaseWindow view;

            if (msg.WindowType == "MoveUserView")
            {
                view = new MoveUserView {
                    DataContext = msg.DataContext
                };
                view.BorderThickness = new Thickness(1);
                view.GlowBrush       = null;
                view.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");
                view.ShowDialog();
            }
            else if (msg.WindowType == "UserAuthenticationView")
            {
                view = new UserAuthenticationView {
                    DataContext = msg.DataContext
                };
                view.BorderThickness = new Thickness(1);
                view.GlowBrush       = null;
                view.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");
                view.ShowDialog();
            }
            else if (msg.WindowType == "SyncUserView")
            {
                view = new SyncUserView {
                    DataContext = msg.DataContext
                };
                view.BorderThickness = new Thickness(1);
                view.GlowBrush       = null;
                view.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");
                view.ShowDialog();
            }
            else
            {
                view = new UserView {
                    DataContext = msg.DataContext
                };
                view.BorderThickness = new Thickness(1);
                view.GlowBrush       = null;
                view.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");
                view.ShowDialog();
            }
        }
Пример #2
0
        public UserAuthenticationView AuthenticateUser(string email, string password)
        {
            using (var unitWork = new UnitOfWork(context))
            {
                UserAuthenticationView foundUser = new UserAuthenticationView();
                var findUser = unitWork.UserRepository.GetWithInclude(u => u.Email.Equals(email) && u.Password.Equals(password),
                                                                      new string[] { "Organization" });

                if (findUser != null)
                {
                    foreach (var user in findUser)
                    {
                        foundUser.Id             = user.Id;
                        foundUser.Email          = user.Email;
                        foundUser.Name           = user.Name;
                        foundUser.UserType       = user.UserType;
                        foundUser.OrganizationId = user.Organization.Id;
                        break;
                    }
                }
                return(foundUser);
            }
        }