Esempio n. 1
0
        public void LoginWithCustomer()
        {
            //try
            //{
            string     username = Username_tb.Text;
            string     password = Password_tb.Text;
            User       customer = new User();
            Database   data     = new Database();
            Book_Room  book     = new Book_Room();
            SqlCommand command  = new SqlCommand("select Id, fullname, picture, birthday, password, username, CMND FROM Customer WHERE username = @user AND password = @pass", data.GetConnection);

            command.Parameters.Add("@user", SqlDbType.NVarChar).Value = username;
            command.Parameters.Add("@pass", SqlDbType.NVarChar).Value = password;
            DataTable table1 = customer.GetUser(command);

            data.OpenConnection();
            if (table1.Rows.Count > 0)
            {
                SqlDataAdapter SDA = new SqlDataAdapter();
                SDA.SelectCommand = command;
                DataSet set = new DataSet();
                SDA.Fill(set, "Customer");
                data.CloseConnection();
                if (customer.Login(username, password))
                {
                    book.Label_DisName.Text   = table1.Rows[0]["fullname"].ToString().Trim();
                    book.Label_displayID.Text = table1.Rows[0]["Id"].ToString().Trim();
                    byte[]       pic     = (byte[])table1.Rows[0]["picture"];
                    MemoryStream picture = new MemoryStream(pic);
                    book.PictureUser.Image = Image.FromStream(picture);
                    book.ShowDialog();
                }
            }
            else
            {
                XtraMessageBox.Show("Invalid Username of wrong Password, Try again or Create new account", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            //}
            //catch
            //{
            //    XtraMessageBox.Show("Invalid Username of wrong Password, Try again or Create new account", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
        }
        private void bookroom_item_ItemClick(object sender, ItemClickEventArgs e)
        {
            Book_Room ro = new Book_Room();

            ro.Show();
        }
Esempio n. 3
0
        private void Room_item_ItemClick(object sender, ItemClickEventArgs e)
        {
            Book_Room BR = new Book_Room();

            BR.Show();
        }