Exemplo n.º 1
0
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            //if past all verifications and steps.

            if (uDAO.Registration(TOUser))
            {
                ACTHouseSelection hs = new ACTHouseSelection(TOUser);
                hs.ShowDialog();
                ACTMessages message = new ACTMessages(TOUser, "eBuy!", "Cadastro realizado com sucesso!", 1);
                message.ShowDialog();
                CanvasStepOne.Visibility   = Visibility.Visible;
                CanvasStepTwo.Visibility   = Visibility.Hidden;
                CanvasStepThree.Visibility = Visibility.Hidden;
                txtUser.Text                   = "";
                txtEmail.Text                  = "";
                psbPassword.Password           = "";
                psbConfirmPassword.Password    = "";
                txtUser.BorderBrush            = Brushes.White;
                txtEmail.BorderBrush           = Brushes.White;
                psbPassword.BorderBrush        = Brushes.White;
                psbConfirmPassword.BorderBrush = Brushes.White;
                lblVerifyPassword.Visibility   = Visibility.Hidden;
                lblSteps.Content               = "Passo: 1";
                txtUser.Focus();
            }
            else
            {
                //database error.
                ACTMessages message = new ACTMessages(TOUser, "eBuy", "Algo errado aconteceu durante o cadastro.", 3);
                message.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void imgR_MouseDown(object sender, MouseButtonEventArgs e)
        {
            TOUser.House = 4;
            uDAO.HouseSelection(TOUser, TOUser.House);
            ACTMessages message = new ACTMessages(TOUser, "eBuy", "Bem vindo à Corvinal!", 2);

            message.ShowDialog();
            this.Close();
        }
Exemplo n.º 3
0
        public string TableValues(int i)
        {
            try
            {
                DataGridCellInfo    cellInfo = tblProduct.SelectedCells[i];
                DataGridBoundColumn column   = cellInfo.Column as DataGridBoundColumn;
                FrameworkElement    element  = new FrameworkElement()
                {
                    DataContext = cellInfo.Item
                };
                BindingOperations.SetBinding(element, TagProperty, column.Binding);

                return(element.Tag.ToString());
            }
            catch (ArgumentOutOfRangeException)
            {
                ACTMessages message = new ACTMessages(user, "eBuy", "Por favor, selecione um produto.", 3);
                message.ShowDialog();
            }

            return(null);
        }
Exemplo n.º 4
0
 private void btnFoward_Click(object sender, RoutedEventArgs e)
 {
     if (CanvasStepOne.Visibility == Visibility.Visible)
     {
         //verification for blank name.
         if (TOUser.Account == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de usuário não pode estar vazio.", 2);
             txtUser.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtUser.Focus();
         }
         //verification for an account that already uses that name.
         else if (uDAO.VerifyAccountName(TOUser.Account))
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "Já existe uma conta cadastrada com este nome.", 2);
             txtUser.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtUser.Focus();
         }
         //verification for blank email.
         else if (TOUser.Email == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de email não pode estar vazio.", 2);
             txtEmail.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtEmail.Focus();
         }
         //verification for an account that already uses that email.
         else if (uDAO.VerifyAccountEmail(TOUser.Email))
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "Já existe uma conta cadastrada neste email.", 2);
             txtEmail.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtEmail.Focus();
         }
         //verification for valid email.
         else if (TOUser.IsValidEmail(TOUser.Email) == false)
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "Email inválido.", 2);
             txtEmail.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtEmail.Focus();
         }
         //verification for blank password.
         else if (psbPassword.Password.ToString() == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de senha não pode estar vazio.", 2);
             psbPassword.BorderBrush = Brushes.Red;
             message.ShowDialog();
             psbPassword.Focus();
         }
         //verification for blank password.
         else if (psbConfirmPassword.Password.ToString() == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de senha não pode estar vazio.", 2);
             psbConfirmPassword.BorderBrush = Brushes.Red;
             message.ShowDialog();
             psbConfirmPassword.Focus();
         }
         else
         {
             CanvasStepOne.Visibility     = Visibility.Hidden;
             CanvasStepTwo.Visibility     = Visibility.Visible;
             lblVerifyPassword.Visibility = Visibility.Hidden;
             lblSteps.Content             = "Passo: 2";
         }
     }
     else if (CanvasStepTwo.Visibility == Visibility.Visible)
     {
         if (TOUser.Name == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de nome não pode estar vazio.", 2);
             txtUser.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtUser.Focus();
         }
         else if (TOUser.SirName == "")
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de sobrenome não pode estar vazio.", 2);
             txtUser.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtUser.Focus();
         }
         else if (TOUser.Credit <= 0)
         {
             ACTMessages message = new ACTMessages(TOUser, "eBuy", "O campo de capital não pode estar vazio.", 2);
             txtUser.BorderBrush = Brushes.Red;
             message.ShowDialog();
             txtUser.Focus();
         }
         else
         {
             CanvasStepOne.Visibility   = Visibility.Hidden;
             CanvasStepTwo.Visibility   = Visibility.Hidden;
             CanvasStepThree.Visibility = Visibility.Visible;
             btnFoward.Visibility       = Visibility.Hidden;
             btnRegister.Visibility     = Visibility.Visible;
             lblSteps.Content           = "Passo: 3";
             btnFoward.Visibility       = Visibility.Hidden;
             btnRegister.Visibility     = Visibility.Visible;
         }
     }
 }
Exemplo n.º 5
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (count == 1)
            {
                btnUpdate.Content               = "Atualizar";
                txtAccount.IsEnabled            = true;
                txtName.IsEnabled               = true;
                txtSirName.IsEnabled            = true;
                txtEmail.IsEnabled              = true;
                txtAddCapital.IsEnabled         = true;
                txtRemoveCapital.IsEnabled      = true;
                psbNewPassword.IsEnabled        = true;
                psbConfirmNewPassword.IsEnabled = true;
                count = 2;
            }
            else
            {
                user.Account = txtAccount.Text.ToString();
                if (DAOUser.VerifyAccountName(user.Account))
                {
                    txtAccount.BorderBrush = Brushes.Red;
                }
                else
                {
                    txtAccount.BorderBrush = Brushes.Green;

                    string stg = lblUserName.Content.ToString();

                    user = DAOUser.Update(user);

                    ACTMessages message = new ACTMessages(user, "eBuy", "Conta azualizada com sucesso.", 1);
                    message.ShowDialog();
                    txtName.Text                   = user.Name;
                    txtAccount.Text                = user.Account;
                    txtSirName.Text                = user.SirName;
                    txtEmail.Text                  = user.Email;
                    psbCurrentPassword.Password    = user.Password;
                    psbNewPassword.Password        = "";
                    psbConfirmNewPassword.Password = "";
                    txtCurrentCapital.Text         = user.Credit.ToString();
                    txtTotalSpentCapital.Text      = user.CreditSpent.ToString();

                    lblUserName.Content = user.Name + " " + user.SirName;
                    lblEmail.Content    = user.Email;

                    if (ver == txtAccount.Text.ToString())
                    {
                    }
                    else
                    {
                        File.Copy(@"C:\eBuy\" + ver + ".png", @"C:\eBuy\" + user.Account + ".png", true);
                        File.Delete(@"C:\eBuy\" + ver + ".png");
                    }

                    count                           = 1;
                    btnUpdate.Content               = "Editar";
                    txtAccount.IsEnabled            = false;
                    txtName.IsEnabled               = false;
                    txtSirName.IsEnabled            = false;
                    txtEmail.IsEnabled              = false;
                    txtAddCapital.IsEnabled         = false;
                    txtRemoveCapital.IsEnabled      = false;
                    psbNewPassword.IsEnabled        = false;
                    psbCurrentPassword.IsEnabled    = false;
                    psbConfirmNewPassword.IsEnabled = false;

                    //txtAddCapital.Text = "";
                    //txtRemoveCapital.Text = "";
                }
            }
            LoadScreen(user, status);
        }