Exemplo n.º 1
0
        protected bool validIsbn(string isbn, int type)
        {
            List <EntClsSearch> list_entSearch = bsn_search.ForIsbnBook(isbn);

            if (type == 1)
            {
                if (list_entSearch.Count() >= 1)
                {
                    foreach (EntClsSearch search in list_entSearch)
                    {
                        if (textCode.Text != search.Codigo)
                        {
                            return(true);
                        }
                    }
                }
            }
            else
            {
                if (list_entSearch.Count() >= 1)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public List <EntClsSearch> queryForIsbnName()
        {
            List <EntClsSearch> resultList = new List <EntClsSearch>();
            BsnClsSearch        bsn_search = new BsnClsSearch();

            resultList = bsn_search.ForIsbnBook(searchvalue);
            if (resultList.Count() == 0)
            {
                return(null);
            }
            return(resultList);
        }
Exemplo n.º 3
0
        public EntClsSearch queryForIsbnName()
        {
            EntClsSearch resultQuery = new EntClsSearch();
            BsnClsSearch bsn_search  = new BsnClsSearch();

            resultQuery = bsn_search.ForIsbnBook(searchvalue);
            if (resultQuery.Book == null)
            {
                return(null);
            }
            return(resultQuery);
        }
        protected void buttonRegister_Click(object sender, EventArgs e)
        {
            BsnClsBook bsn_Libro = new BsnClsBook();
            EntClsBook bookFind  = bsn_Libro.checkBook(textTitle.Text);

            if (bookFind.Code == null)
            {
                if (change1 == 1)
                {
                    BsnClsAuthor bsn_author = new BsnClsAuthor();
                    bsn_author.insertAuthor(textNameAuth.Text, textLastName.Text, textNationality.Text);
                }
                if (change2 == 1)
                {
                    BsnClsEditorial bsn_editorial = new BsnClsEditorial();
                    bsn_editorial.insertEditorial(textNameEdit.Text, textCountry.Text, textCity.Text);
                }
                EntClsSearch consulExist = new EntClsSearch();
                BsnClsSearch bsn_search  = new BsnClsSearch();
                consulExist = bsn_search.ForCodeBook(textCode.Text);
                if (consulExist.Book == null)
                {
                    //verificar que no se repita el isbn
                    consulExist = bsn_search.ForIsbnBook(textIsbn.Text);
                    if (consulExist.Book == null)
                    {
                        //verificar que no se repita el titulo
                        consulExist = bsn_search.ForNameBook(textTitle.Text);
                        if (consulExist.Book == null)
                        {
                            EntClsAuthor obj_Author = registerBook();
                            BsnClsWrite  bsn_write  = new BsnClsWrite();
                            bsn_write.insertWrite(obj_Author.Id, textCode.Text);
                            registerSucces();
                            clear();
                        }
                        else
                        {
                            string script = @"<script type='text/javascript'>
                            alert('Ya existe este libro ingrese otro');
                            </script>";
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false);
                        }
                    }
                    else
                    {
                        string script = @"<script type='text/javascript'>
                    alert('Ya existe ese ISBN ingrese otro');
                    </script>";
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false);
                    }
                }
                else
                {
                    string script = @"<script type='text/javascript'>
                    alert('Ya existe ese codigo ingrese otro');
                    </script>";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "BookAdmin", script, false);
                }
            }
            else
            {
                registerFail();
            }
        }