Exemple #1
0
        /// <summary>
        /// Botão de login
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loginBtn_Click(object sender, EventArgs e)
        {
            string userName = textBoxUserNameLogin.Text;

            //byte passWord = Convert.ToByte( texboxPassWordLogin.Text);
            byte[] password = Encoding.ASCII.GetBytes(texboxPassWordLogin.Text);

            if (userName != "")
            {
                using (var context = new AlojamentoDbEntities3())
                {
                    User queryUser = context.Users
                                     .Where(s => s.userName == textBoxUserNameLogin.Text)
                                     .FirstOrDefault <User>();

                    User queryPassWord = context.Users
                                         .Where(s => s.passWord == password) //texboxPassWordLogin.Text convertida para byte)
                                         .FirstOrDefault <User>();
                    Close();

                    //string userName = "******";
                    //string passWord = "******";
                    Form1 menu1 = new Form1();

                    //if ((userName == queryUser.userName) && (password == queryPassWord.passWord))
                    //{
                    this.Close();
                    //Uso de Thread para fechar o form anterior e abrir um novo
                    th = new Thread(OpenForm2);
                    th.SetApartmentState(ApartmentState.STA);
                    th.Start();
                    //}
                    //else
                    //    {
                    //        MessageBox.Show("Login Invalido");

                    //    }
                }
            }
            else
            {
                MessageBox.Show("preencha login");
            }
            MinhasReservas user = new MinhasReservas(userName);
        }
Exemple #2
0
        private void buttonConsultReservas_Click(object sender, EventArgs e)
        {
            MinhasReservas res = new MinhasReservas();

            res.ShowDialog();
        }