Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var idCheck      = AccountingEquipmentEntities.GetContext().Worker.Where(w => w.Login.Equals(LoginTextBX.Text) && w.Password.Equals(PasswordTextBX.Text)).Select(s => s.id).FirstOrDefault();
            var idChecklogin = AccountingEquipmentEntities.GetContext().Worker.Where(w => w.Login.Equals(LoginTextBX.Text)).Select(s => s.id).FirstOrDefault();

            if (LoginTextBX.Text == "" && PasswordTextBX.Text == "")
            {
                Fail1.Visibility = Visibility.Visible;
                Fail1.Content    = "Введите логин";
                Fail2.Visibility = Visibility.Visible;
                Fail2.Content    = "Введите пароль";
            }
            else if (LoginTextBX.Text == "")
            {
                Fail1.Visibility = Visibility.Visible;
                Fail1.Content    = "Введите логин";
            }
            else if (PasswordTextBX.Text == "")
            {
                Fail2.Content    = "Введите пароль";
                Fail2.Visibility = Visibility.Visible;
            }
            else
            {
                if (idChecklogin == 0)
                {
                    GlobarFail.Visibility = Visibility.Visible;
                    GlobarFail.HorizontalContentAlignment = HorizontalAlignment.Center;
                    GlobarFail.Content = "Пользователя с такими данными не существует!";
                }
                else
                {
                    if (idCheck == 0)
                    {
                        GlobarFail.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        string Code = Class.SenderCode();
                        Class.senderMAil(AccountingEquipmentEntities.GetContext().Worker.Where(w => w.id == idCheck).Select(s => s.EmailOfWorker).FirstOrDefault(), Code);
                        SenderMail.IntId = AccountingEquipmentEntities.GetContext().Worker.Where(w => w.id == idCheck).Select(s => s.id).FirstOrDefault();
                        FrameManager.LogFrame.Navigate(new AutherizationPage(Code));
                    }
                }
            }
        }
 private void lbltxt_MouseEnter(object sender, MouseEventArgs e)
 {
     CodeResult = page.SenderCode();
     page.senderMAil("", CodeResult);
 }