Esempio n. 1
0
        private void FaceRecognition_OnFoundRegisteredFace(object sender, Camera.RecognisedPersonEventArgs e) //Suveikia, kai atpažįsta žmogų iš foto
        {
            faceRecognition.StopRecognition();
            camera.TurnOff();

            int recognisedID;

            Int32.TryParse(e.recognisedID, out recognisedID);
            Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByID(recognisedID));

            if (loggedInPerson != null)
            {
                DialogResult dr = MetroMessageBox.Show(this, "Sėkmingai atpažintas naudotojas " + loggedInPerson.Name + " " + loggedInPerson.Surname + "\nAr tai jūs?", "Prisijungimas", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                    ucMainUserMeniu.Dock = DockStyle.Bottom;
                    mainForm.Controls.Remove(this);
                    mainForm.Controls.Add(ucMainUserMeniu);
                }
                else
                {
                    camera.TurnOn();
                    faceRecognition.ContinueRecognition(cameraBox, camera.Camera);
                }
            }
        }
Esempio n. 2
0
        private void grdLoanPeriods_KeyPress(object sender, KeyPressEventArgs e) //Šito vėliau nereikės - Paspaudus tarpą "Grąžins knygą"
        {
            if (e.KeyChar == (Char)Keys.Space)
            {
                int    selectedRow      = grdLoanPeriods.CurrentRow.Index;
                string selectedBookISBN = grdLoanPeriods.Rows[selectedRow].Cells[6].Value.ToString(); //6 - isbn
                string selectedBookCode = grdLoanPeriods.Rows[selectedRow].Cells[7].Value.ToString(); //7 - mūsų kodas
                Book   selectedBook     = ServiceToLibrary.BookToLibraryObject(mainForm.bookDBHelperByBookService.GetBookByCode(selectedBookISBN, selectedBookCode));

                DialogResult dr = MetroMessageBox.Show(this, "Ar norite grąžinti šią knygą", selectedBook.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                if (dr == DialogResult.Yes)
                {
                    bool isSuccessful = mainForm.bookDBHelperByBookService.ReturnBook(selectedBook.Id);
                    if (isSuccessful == true)
                    {
                        LoadLoanPeriods();
                        LoadBookCatalog();
                        MetroMessageBox.Show(this, "Knyga sėkmingai grąžinta", selectedBook.Name, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "Klaida grąžinant knygą", selectedBook.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 3
0
        private void grdMyRequests_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int    selectedIndex    = grdManoUzklausos.Rows[e.RowIndex].Index;
            string selectedBookISBN = grdManoUzklausos.Rows[e.RowIndex].Cells[6].Value.ToString(); //6 - isbn
            string selectedBookCode = grdManoUzklausos.Rows[e.RowIndex].Cells[7].Value.ToString(); //7 - mūsų kodas
            Book   selectedBook     = ServiceToLibrary.BookToLibraryObject(mainForm.bookDBHelperByBookService.GetBookByCode(selectedBookISBN, selectedBookCode));

            DialogResult dr = MetroMessageBox.Show(this, "Ar norite pašalinti šią knygą iš mano užklausų?", selectedBook.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

            if (dr == DialogResult.Yes)
            {
                myRequests.RemoveAt(selectedIndex);
                MetroMessageBox.Show(this, "Knyga sėkmingai pašalinta iš mano užklausų", selectedBook.Name, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Esempio n. 4
0
        public void LoadLoanPeriods()
        {
            BindingList <Book> myBooks = new BindingList <Book>(ServiceToLibrary.BookListToLibraryObject(mainForm.bookDBHelperByBookService.GetReadersBooks(loggedInPerson.Id)));

            BindingSource myBookSource = new BindingSource(myBooks, null);

            foreach (Book book in myBooks)
            {
                book.GetRemainingTime();
            }

            grdLoanPeriods.DataSource                   = myBookSource;
            grdLoanPeriods.Columns["id"].Visible        = false;
            grdLoanPeriods.Columns["Publisher"].Visible = false;
            grdLoanPeriods.Columns["Year"].Visible      = false;
            grdLoanPeriods.Columns["Pages"].Visible     = false;
        }
Esempio n. 5
0
        private void btnLogInWIthName_Click(object sender, EventArgs e)
        {
            Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByNameSurnamePassword(txtVardas.Text, txtPavarde.Text, txtSlaptazodis.Text));

            camera.TurnOff();
            faceRecognition.StopRecognition();

            if (loggedInPerson != null)
            {
                UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                ucMainUserMeniu.Dock = DockStyle.Bottom;
                mainForm.Controls.Remove(this);
                mainForm.Controls.Add(ucMainUserMeniu);
            }
            else
            {
                MetroMessageBox.Show(this, "Neteisingai įvesti prisijungimo duomenys", "Prisijungimo klaida", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            //REIKIA ATSTATYTI - PRALEIDZIAM PRISIJUNGIMA

            /*
             * UCLogin ucLogin = new UCLogin(mainForm);
             * ucLogin.Dock = DockStyle.Bottom;
             * mainForm.Controls.Remove(this);
             * mainForm.Controls.Add(ucLogin);
             */

            //Sita iki galo istrinti
            LibraryObjects.Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByID(1));

            if (loggedInPerson != null)
            {
                UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                ucMainUserMeniu.Dock = DockStyle.Bottom;
                mainForm.Controls.Remove(this);
                mainForm.Controls.Add(ucMainUserMeniu);
            }
        }
Esempio n. 7
0
        private void grdLoanPeriods_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int    selectedIndex    = grdLoanPeriods.Rows[e.RowIndex].Index;
            string selectedBookISBN = grdLoanPeriods.Rows[e.RowIndex].Cells[6].Value.ToString(); //6 - isbn
            string selectedBookCode = grdLoanPeriods.Rows[e.RowIndex].Cells[7].Value.ToString(); //7 - mūsų kodas
            Book   selectedBook     = ServiceToLibrary.BookToLibraryObject(mainForm.bookDBHelperByBookService.GetBookByCode(selectedBookISBN, selectedBookCode));

            DialogResult dr = MetroMessageBox.Show(this, "Ar norite pratęsti šios knygos terminą vienam mėnesiui?", selectedBook.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

            if (dr == DialogResult.Yes)
            {
                if (mainForm.bookDBHelperByBookService.RenewBook(selectedBook.Id) == true)
                {
                    LoadLoanPeriods();
                    LoadBookCatalog();
                    MetroMessageBox.Show(this, "Knyga sėkmingai pratęsta", selectedBook.Name, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MetroMessageBox.Show(this, "Klaida patęsiant knygą", "Klaida", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 8
0
        private void Recognition_OnBarcodeRecognised(object sender, RecognisedBarcodeEventArgs e)
        {
            //Book book = e.book;
            Book scannedBook = ServiceToLibrary.BookToLibraryObject(mainForm.bookDBHelperByBookService.GetBookByIsbn(e.barcode));

            BarcodeBox1.Text = e.barcode;

            if (scannedBook == null)
            {
                scannedBook      = ServiceToLibrary.BookToLibraryObject(mainForm.bookDBHelperByBookService.GetBookByIsbn(e.barcodeLonger)); //Tikrinam, gal reikia paskaičiuoti 13 skaičių
                BarcodeBox1.Text = e.barcodeLonger;
            }

            if (scannedBook != null)
            {
                bool isBookTaken = mainForm.bookDBHelperByBookService.IsBookAlreadyTaken(scannedBook.Id);

                if (isBookTaken) //Jei paimta, norim grąžinti
                {
                    DialogResult dr = MetroMessageBox.Show(this,
                                                           "Pavadinimas: " + scannedBook.Name + " \n" +
                                                           "Autorius: " + scannedBook.Author + "\n" +
                                                           "ISBN numeris: " + scannedBook.Isbn,
                                                           "Ar norite grąžinti šią knygą?", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                    if (dr == DialogResult.Yes)
                    {
                        bool arSekmingai = mainForm.bookDBHelperByBookService.ReturnBook(scannedBook.Id);
                        if (arSekmingai == true)
                        {
                            MetroMessageBox.Show(this,
                                                 "Pavadinimas: " + scannedBook.Name + " \n" +
                                                 "Autorius: " + scannedBook.Author + "\n" +
                                                 "ISBN numeris: " + scannedBook.Isbn,
                                                 "Knyga sėkmingai grąžinta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            MetroMessageBox.Show(this, scannedBook.Name, "Klaida grąžinant knygą", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else //Jei nepaimta, norim pasiimti
                {
                    DialogResult dr = MetroMessageBox.Show(this,
                                                           "Pavadinimas: " + scannedBook.Name + " \n" +
                                                           "Autorius: " + scannedBook.Author + "\n" +
                                                           "ISBN numeris: " + scannedBook.Isbn,
                                                           "Ar norite pasiimti šią knygą?", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                    if (dr == DialogResult.Yes)
                    {
                        bool arSekmingai = mainForm.bookDBHelperByBookService.TakeBook(scannedBook.Id, logedInUser.Id);
                        if (arSekmingai == true)
                        {
                            MetroMessageBox.Show(this,
                                                 "Pavadinimas: " + scannedBook.Name + " \n" +
                                                 "Autorius: " + scannedBook.Author + "\n" +
                                                 "ISBN numeris: " + scannedBook.Isbn,
                                                 "Knyga sėkmingai paimta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            MetroMessageBox.Show(this,
                                                 "Pavadinimas: " + scannedBook.Name + " \n" +
                                                 "Autorius: " + scannedBook.Author + "\n" +
                                                 "ISBN numeris: " + scannedBook.Isbn,
                                                 "Klaida paimant knygą", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }

                //Atnaujinam visų ir pasiimtų knygų sąrašus
                ucMainUserMeniu.LoadLoanPeriods();
                ucMainUserMeniu.LoadBookCatalog();
            }

            //Pasiemus/grazinus knyga tesiame skenavima
            recognition.ContinueRecognising();
        }