public MainWindowFormViewModel()
        {
            ClickAddUserInProjectCommand = new RelayCommand(arg => ClickMethodAddUserInProject());
            ClickBuildErModelCommand = new RelayCommand(arg => ClickMethodBuildErModel());
            ClickChangeQuerryCommand = new RelayCommand(arg => ClickMethodChangeQuerry());
            ClickAutorizationCommand = new RelayCommand(arg => ClickMethodAutorization());
            ClickAddConnectionCommand = new RelayCommand(arg => ClickMethodAddConection());
            ClickSaveExcelCommand = new RelayCommand(arg => ClickMethodSaveExcel());
            ClickSaveTxtCommand = new RelayCommand(arg => ClickMethodSaveTxt());
            ClickSavePdfCommand = new RelayCommand(arg => ClickMethodSavePdf());
            ClickSendQuerryToEmailCommand = new RelayCommand(arg => ClickMethodSendQuerryToEmail());
            ClickRefreshQuerryCommand = new RelayCommand(arg => ClickMethodRefreshQuerryCommand());
            ClickDeleteRowCommand = new RelayCommand(arg => ClickMethodDeleteRowCommand());

            MainWindowData.UserConnections = new ObservableCollection<Group>();
            CanExecute = false;
            _currentUser = new User();
            FirstName = "SignIn please";

            var servicesFactory = new ServicesFactory();
            _projectService = servicesFactory.GetProjectService();

            //_builder = new BuilderBL.SQLDesigner.QueryBuilder(new DbSchema());
            //SqlQuerry = MainWindowData.SqlQuerry;
            //MessageBox.Show("For using  all functionality of the application, you have to register or sign-in");
        }
Esempio n. 2
0
        public IEnumerable<Project> GetUserProjects(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            using (var unitOfWork = _unitOfWorkFactory.GetUnitOfWork())
            {
                return unitOfWork.Projects.GetMany(p => (p.Delflag == DelflagConstants.ActiveSet && p.Users.Email == user.Email));
            }
        }
Esempio n. 3
0
        public void CreateUser(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            using (var unitOfWork = _unitOfWorkFactory.GetUnitOfWork())
            {
                unitOfWork.Users.Create(user);
                unitOfWork.Save();
            }
        }
        public User RegistrationUser(string firstName, string lastName, string email, string password)
        {
            SmtpMailer mailer = SmtpMailer.Instance();
            if (_userService.GetUserByEmail(email) == null)
            {
                User newUser = new User
                {
                    FirstName = firstName,
                    LastName = lastName,
                    Email = email,
                    PasswordHash = Scrambler.GetPassHash(password)
                };

                _userService.CreateUser(newUser);
                mailer.SentRegisterNotification(email);

                MainWindowData.CurrentUser = newUser;

                return newUser;
            }
            throw new CustomException(Resources.ExistEmailError);
        }