Esempio n. 1
0
        private void SingUp()
        {
            IClientRequests clientRequests = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));

            clientRequests.DatabaseName = SelectDatabaseName;

            Guid workerId = Guid.Empty;

            if (!(string.IsNullOrEmpty(NameW) || string.IsNullOrEmpty(Login) || string.IsNullOrEmpty(Password)))
            {
                try
                {
                    ClientRequests.WorkerIsExist(Login);
                    MessageService.ErrorMessage(Message.MessageResource.ExistWorker);
                }
                catch (Exception ex)
                {
                    workerId = CreateWorker(NameW, Login, Password);
                    MessageService.InfoMessage(Message.MessageResource.SuccessfullRegistration);

                    ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id = workerId;
                    DialogResult = DialogResult.OK;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(NameW))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyName);
                }
                else
                if (string.IsNullOrEmpty(Login))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyLogin);
                }
                else
                if (string.IsNullOrEmpty(Password))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyPassword);
                }
            }
        }
Esempio n. 2
0
        private Guid SingUp(string workerName, string workerLogin, string workerPassword)
        {
            Guid workerId = Guid.Empty;

            if (!(string.IsNullOrEmpty(workerName) || string.IsNullOrEmpty(workerLogin) || string.IsNullOrEmpty(workerPassword)))
            {
                if (ClientRequests.WorkerIsExist(workerLogin))
                {
                    MessageService.ErrorMessage(Message.MessageResource.ExistWorker);
                }
                else
                {
                    workerId = CreateWorker(workerName, workerLogin, workerPassword);
                    MessageService.InfoMessage(Message.MessageResource.SuccessfullRegistration);
                }
            }
            else
            {
                if (string.IsNullOrEmpty(workerName))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyName);
                }
                else
                if (string.IsNullOrEmpty(workerLogin))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyLogin);
                }
                else
                if (string.IsNullOrEmpty(workerPassword))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyPassword);
                }
            }

            return(workerId);
        }