Ejemplo n.º 1
0
        public UserMenu_ViewModel(string PhoneNumber)
        {
            pn = PhoneNumber;
            var res = de.GetUserList();

            User mainuser = new User();

            for (int i = 0; i < res.Count(); i++)
            {
                if (res[i].phone_number == PhoneNumber)
                {
                    mainuser.user_id      = res[i].user_id;
                    mainuser.phone_number = res[i].phone_number;
                    mainuser.password     = res[i].password;
                    mainuser.name         = res[i].name;
                    mainuser.middle_name  = res[i].middle_name;
                    mainuser.last_name    = res[i].last_name;
                }
            }
            Fio = mainuser.last_name + " " + mainuser.name + " " + mainuser.middle_name;
        }
Ejemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public SearchPlateUser_ViewModel(String PhoneNumber)
        {
            var users = de.GetUserList();

            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].phone_number == PhoneNumber)
                {
                    FIO = users[i].last_name + " " + users[i].name + " " + users[i].middle_name;
                    this.PhoneNumber = users[i].phone_number;
                    Adress           = users[i].adress;
                }
            }

            Collection = new ObservableCollection <ShowUnavailableBooks_cs>(de.ShowUsersBooks(PhoneNumber));
        }
Ejemplo n.º 3
0
        private void ExecuteConfirmCommand(object param)
        {
            var users = de.GetUserList();

            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].phone_number == "Admin" && users[i].password == PasswordText)
                {
                    if (choice == false)
                    {
                        VisibilityLol = System.Windows.Visibility.Hidden;

                        de.PassBook(book_id);
                        MyMsgBox msg = new MyMsgBox("Книги сдана!");
                        msg.Show();
                        return;
                    }
                    if (choice == true)
                    {
                        for (int j = 0; j < users.Count; j++)
                        {
                            if (users[j].user_id == user_id)
                            {
                                VisibilityLol = System.Windows.Visibility.Hidden;

                                Issue issue = new Issue(users[j].phone_number, book_id);
                                issue.Show();

                                MyMsgBox msg = new MyMsgBox("Книга выдана!");
                                msg.Show();
                                return;
                            }
                        }
                    }
                }
                if (i == users.Count() - 1)
                {
                    MyMsgBox msg1 = new MyMsgBox("Пароль введен неверно!");
                    msg1.Show();
                    break;
                }
            }

            // НЕ РАБОТАЕТ
        }
Ejemplo n.º 4
0
        private void ExecuteRegisterCommand(object param)
        {
            var res = de.GetUserList();

            if (res.Where(x => x.phone_number == PhoneNumber).Count() == 1)
            {
                MyMsgBox msg = new MyMsgBox("Пользователь с таким номером уже есть!");
                msg.Show();

                return;
            }
            else
            {
                de.AddUser(LastName, Name, MiddleName, PhoneNumber, Adress);

                VisibilityLol = System.Windows.Visibility.Hidden;
                MyMsgBox msg = new MyMsgBox("Пользователь зарегистрирован!");
                msg.Show();
            }
        }
Ejemplo n.º 5
0
        private void ExecuteSearchCommand(object param)
        {
            var res = de.GetUserList();

            for (int i = 0; i < res.Count; i++)
            {
                if (res[i].phone_number == PhoneNumber)
                {
                    SearchUserPlate sup = new SearchUserPlate(PhoneNumber);
                    sup.Show();
                    VisibilityLol = System.Windows.Visibility.Hidden;


                    return;
                }
            }
            MyMsgBox msg = new MyMsgBox("Пользователь с таким номером не найден!");

            msg.Show();
            //MessageBox.Show("Пользователь с таким номером не найден!");
        }
Ejemplo n.º 6
0
        public Menu_ViewModel(string PhoneNumber)
        {
            visibilitylol = System.Windows.Visibility.Visible;

            var res = de.GetUserList();

            phonenumber = PhoneNumber;

            User mainuser = new User();

            for (int i = 0; i < res.Count(); i++)
            {
                if (res[i].phone_number == PhoneNumber)
                {
                    mainuser.user_id      = res[i].user_id;
                    mainuser.phone_number = res[i].phone_number;
                    mainuser.password     = res[i].password;
                    mainuser.name         = res[i].name;
                    mainuser.middle_name  = res[i].middle_name;
                    mainuser.last_name    = res[i].last_name;
                }
            }
            fio_label = mainuser.last_name + " " + mainuser.name + " " + mainuser.middle_name;
        }
Ejemplo n.º 7
0
        private void ExecuteSearchCommand(object param)
        {
            var res = de.GetUserList();

            for (int i = 0; i < res.Count; i++)
            {
                if (res[i].phone_number == PhoneNumber)
                {
                    VisibilityLol = System.Windows.Visibility.Hidden;

                    Password pass = new Password(true, bi, res[i].user_id);
                    pass.Show();
                    break;
                }
                else
                {
                    if (i == res.Count() - 1)
                    {
                        MyMsgBox msg = new MyMsgBox("Пользователь с таким номером не найден!");
                        msg.Show();
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void ExecuteConfirmCommand(object param)
        {
            var users = de.GetUserList();

            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].phone_number == "Admin" && users[i].password == Password)
                {
                    VisibilityLol = System.Windows.Visibility.Hidden;

                    de.AddBook(title, author, year, genre);
                    MyMsgBox msg = new MyMsgBox("Книга добавлена!");
                    msg.Show();
                    return;
                }

                if (i == users.Count() - 1)
                {
                    MyMsgBox msg1 = new MyMsgBox("Пароль введен неверно!");
                    msg1.Show();
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        public Issue_ViewModel(String PhoneNumber, int bookid)
        {
            visibilitylol = System.Windows.Visibility.Visible;

            var users = de.GetUserList();


            for (int i = 0; i < users.Count; i++)
            {
                if (users[i].phone_number == PhoneNumber)
                {
                    de.IssueBook(users[i].user_id, bookid, DateTime.Now.ToString());
                    FIO         = users[i].last_name + " " + users[i].name + " " + users[i].middle_name;
                    PhoneNumber = users[i].phone_number;
                    Adress      = users[i].adress;

                    MyMsgBox msg = new MyMsgBox("Книга выдана!");
                }
            }

            var res = new ObservableCollection <ShowUnavailableBooks_cs>(de.ShowUsersBooks(PhoneNumber));

            Collection = res;
        }