private void sigh_up_btn(object sender, RoutedEventArgs e)
 {
     if (ValidateFields())
     {
         Member NewMember = new Member(txtName.Text, txtEmail.Text, txtPreNumber.Text + txtPhoneNumber.Text, txtPassword.Password, Date.GetCurrentDate(), ImageFile);
         if (DataBaseManager.isMemberExists(NewMember.Name, NewMember.Email, NewMember.PhoneNumber) &&
             DataBaseManager.isEmployeeExists(NewMember.Name, NewMember.Email, NewMember.PhoneNumber))
         {
             PayPanel PayPanelWindow = new PayPanel(20000, NewMember);
             NavigationService.Navigate(PayPanelWindow);
         }
     }
 }
 private void Addbutton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateFields())
     {
         Employee NewEmployee = new Employee(txtName.Text, txtPreNumber.Text + txtPhoneNumber.Text, txtEmail.Text, txtPassword.Password, int.Parse(txtSalary.Text), ImageFile);
         if (DataBaseManager.isEmployeeExists(NewEmployee.Name, NewEmployee.Email, NewEmployee.PhoneNumber) &&
             DataBaseManager.isMemberExists(NewEmployee.Name, NewEmployee.Email, NewEmployee.PhoneNumber))
         {
             DataBaseManager.AddEmployee(NewEmployee);
             NavigationService.Navigate(new Pages.Universal.employees());
         }
     }
 }
        private void PayButton_Click(object sender, RoutedEventArgs e)
        {
            var load = new Pages.Universal.Loading();

            load.Activate();
            load.Show();
            if (isForAddMember)
            {
                if (DataBaseManager.isMemberExists(NewMember.Name, NewMember.Email, NewMember.PhoneNumber))
                {
                    if (isCardValid())
                    {
                        DataBaseManager.AddMember(NewMember);
                        DataBaseManager.AddBudget(amount);

                        MemberPanel member = new MemberPanel(NewMember);
                        member.Show();

                        MainWindow main = Application.Current.MainWindow as MainWindow;
                        if (main != null)
                        {
                            main.Close();
                        }
                    }
                }
            }
            else
            {
                if (isForMember)
                {
                    DataBaseManager.addMemberBalance(member.Name, amount);
                    MessageBox.Show("Done !");
                    MainWindow main = Application.Current.MainWindow as MainWindow;
                    if (main != null)
                    {
                        main.Close();
                    }
                }
                else
                {
                    DataBaseManager.AddBudget(amount);
                    MessageBox.Show("Done !");
                    MainWindow main = Application.Current.MainWindow as MainWindow;
                    if (main != null)
                    {
                        main.Close();
                    }
                }
            }
            load.Close();
        }
Example #4
0
        private void login_btn(object sender, RoutedEventArgs e)
        {
            var load = new Pages.Universal.Loading();

            load.Activate();
            load.Show();

            DataTable empData = DataBaseManager.EmpList();
            DataTable memData = DataBaseManager.MemberList();

            string email   = txtEmail.Text.ToLower();
            string pass    = txtPassword.Password;
            bool   isMatch = false;

            if (email == "admin" && pass == "AdminLib123")
            {
                var admin = new AdminPanel();
                admin.Show();
                isMatch = true;
                MainWindow main = Application.Current.MainWindow as MainWindow;
                if (main != null)
                {
                    main.Close();
                }
            }
            if (!isMatch)
            {
                for (int i = 0; i < empData.Rows.Count; i++)
                {
                    if (empData.Rows[i][2].ToString().ToLower() == email && empData.Rows[i][4].ToString() == pass)
                    {
                        var emp = new EmployeePanel(new Employee(empData.Rows[i][1].ToString(), empData.Rows[i][2].ToString(), empData.Rows[i][3].ToString(), empData.Rows[i][4].ToString(), int.Parse(empData.Rows[i][5].ToString()), empData.Rows[i][6].ToString()));
                        emp.Show();
                        isMatch = true;
                        MainWindow main = Application.Current.MainWindow as MainWindow;
                        if (main != null)
                        {
                            main.Close();
                        }
                    }
                }
                if (!isMatch)
                {
                    for (int i = 0; i < memData.Rows.Count; i++)
                    {
                        if (memData.Rows[i][2].ToString().ToLower() == email && memData.Rows[i][4].ToString() == pass)
                        {
                            var emp = new MemberPanel(new Member(memData.Rows[i][1].ToString(), memData.Rows[i][2].ToString()
                                                                 , memData.Rows[i][3].ToString(), memData.Rows[i][4].ToString(), memData.Rows[i][6].ToString()));
                            emp.Show();
                            isMatch = true;
                            MainWindow main = Application.Current.MainWindow as MainWindow;
                            if (main != null)
                            {
                                main.Close();
                            }
                        }
                    }
                }
            }
            if (!isMatch)
            {
                MessageBox.Show("This combination of email and password does not exist !!");
            }
            load.Close();
        }
 public AdminPanel()
 {
     InitializeComponent();
     adminFrame.Content = new Pages.Universal.Home("Admin");
     DataBaseManager.BorrowBook(1, 1);
 }