private void AuthorizationForm_LogIn(object sender, EventArgs e)
        {
            var userInfo = model.CheckUser(authorizationForm.Email, authorizationForm.Password);

            if (userInfo.Status == UserStatus.User.ToString())
            {
                authorizationForm.Status = UserStatus.User;

                messageService.ShowMessage("Авторизация прошла успешно");
            }
            else if (userInfo.Status == UserStatus.Admin.ToString())
            {
                authorizationForm.Status = UserStatus.Admin;
                messageService.ShowMessage("Вы вошли как админ");
            }
            else
            {
                authorizationForm.Status = UserStatus.Guest;
                messageService.ShowExclamation("Неверный логин или пароль.");
            }

            authorizationForm.Name = userInfo.Name;
            authorizationForm.Id   = userInfo.Id;
            authorizationForm.Cash = userInfo.Cash;
        }
Beispiel #2
0
        private void BetForm_PlaceBet(string teams, string formula, double coeff, double price)
        {
            try
            {
                if (betForm.StartTime > DateTime.Now.AddHours(-1))
                    model.PlaceBet(teams, formula, coeff, betForm.Id, price, betForm.StartTime);
                else throw new TooLateToBetUserClientException("Матч стартует раньше, чем через час или уже стартовал.");

                betForm.Cash -= price;
            }
            catch (Exception ex)
            {
                messageService.ShowExclamation(ex.Message);
            }
        }