Пример #1
0
        private void back_Click(object sender, RoutedEventArgs e)
        {
            AdminWindow admin = new AdminWindow();

            admin.Show();
            this.Hide();
        }
        private void autentificareBtn_Click(object sender, RoutedEventArgs e)
        {
            Cont   a = new Cont(getUsername(), getPassword(), 'X');
            Client b = null;

            Type myType = typeof(Cont);

            FieldInfo[] fields = myType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);

            try
            {
                a = ContBLL.findUser(a);
                b = ClientBLL.getClientByUser(a);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
            }

            /*foreach (FieldInfo info in fields)
             * {
             *  MessageBox.Show(info.Name + ", " + info.GetValue(a).ToString());
             * }*/

            if (a != null)
            {
                if (a.Rol == 'A')
                {
                    AdminWindow meniuAdministrator = new AdminWindow();
                    meniuAdministrator.Show();
                    this.Close();
                }
                else if (a.Rol == 'C')
                {
                    ClientWindow meniuClient = new ClientWindow(a, b);
                    meniuClient.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Acest cont nu exista");
            }
        }