예제 #1
0
        //navigate back
        private void btn_back_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminHome home = new AdminHome();

            home.Show();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminHome mp = new AdminHome();

            mp.Show();
        }
        private void button3_Click(object sender, EventArgs e) //Back Button
        {
            this.Hide();
            AdminHome ah = new AdminHome();

            ah.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // this.Hide();
            // Form2 ss = new Form2();
            // ss.Show();

            try
            {
                password = PasswordText.Text.Trim();
                // string DecryptedPassword = Decrypt(password);

                //SqlConnection con = new SqlConnection(@"Data Source=LAPTOP-UDPCMQEF;Initial Catalog=LibraryManagementSystem;Integrated Security=True");
                //con.Open();

                //string query = "select person_id,email,password,person_type from Person where email= '" + txtusername.Text.Trim() + "'and password = '******'";
                // SqlCommand cmd = new SqlCommand(cmdText: );
                //DataSet ds = new DataSet();
                SqlDataAdapter adp = new SqlDataAdapter();
                adp.SelectCommand = new SqlCommand();
                adp.SelectCommand = sm.selectData("select person_id,email,password,person_type from Person where email= '" + txtusername.Text.Trim() + "'and password = '******'");

                DataTable dt = new DataTable();
                adp.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    string status = "";
                    studentID = dt.Rows[0][0].ToString();
                    status    = dt.Rows[0][3].ToString();

                    if (status == "admin")
                    {
                        AdminHome adminHome = new AdminHome();
                        this.Hide();
                        adminHome.Show();
                    }
                    else if (status == "Active")
                    {
                        StudentHome mp = new StudentHome(studentID);
                        this.Hide();
                        mp.Show();
                    }
                }

                else
                {
                    MessageBox.Show("Check your username and password");
                    //AdminHome adminHome = new AdminHome();
                    //this.Hide();
                    //adminHome.Show();
                    //MainPage mp = new MainPage(studentID);
                    //this.Hide();
                    //mp.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[]       img = null;
            FileStream   fs  = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
            BinaryReader br  = new BinaryReader(fs);

            img = br.ReadBytes((int)fs.Length);

            //Image img = pictureBox1.Image;
            //byte[] arr;
            //ImageConverter converter = new ImageConverter();
            //arr = (byte[])converter.ConvertTo(img, typeof(byte[]));


            AllMethods objMethods = new AllMethods();

            objMethods.Initialize();


            //string name = txtName.Text;
            //int age = Convert.ToInt32(txtAge.Text);

            //objMethods.Insert(name, age);

            // string book_id = BookIDText.Text;
            string material           = textBox1.Text;
            string source_combo_box   = textBox2.Text;
            string supplier_combo_box = textBox3.Text;
            string subject_combo_box  = textBox4.Text;
            int    shelf_text         = Convert.ToInt32(ShelfText.Text);
            int    buying_price       = Convert.ToInt32(BuyingPriceText.Text);
            int    selling_price      = Convert.ToInt32(SellingPriceText.Text);
            //  DateTime dateTime = dateTimePicker.Value;
            int    numberOfSellableBook = Convert.ToInt32(textBox6.Text);
            string bookTitle            = BookTitleText.Text;
            string authorName           = AuthorNameText.Text;
            string subTitle             = SubtitleText.Text;
            string isbn = ISBNText.Text;
            int    number_of_borrowable_books = Convert.ToInt32(NumberOfBorrowableBooksText.Text);
            // int number_of_not_borrowable_books = Convert.ToInt32(NumberOfNotBorrowableBooksText.Text);
            // int number_of_buyable_books = Convert.ToInt32(NumberOfBuyableableBooksText.Text);
            //string availability = AvailabilityComboBox.Text;
            int    number_of_readable_books = Convert.ToInt32(readableBooksText.Text);
            string edition = editionText.Text;

            objMethods.Insert(bookTitle, authorName, subTitle, subject_combo_box, isbn, buying_price, selling_price, numberOfSellableBook, shelf_text, number_of_borrowable_books, number_of_readable_books, material, supplier_combo_box, source_combo_box, edition, img, imageURL);

            // Formtwo objFormTwo = new Formtwo();
            // objFormTwo.Show();
            this.Hide();
            AdminHome admin = new AdminHome();

            admin.Show();
        }
예제 #6
0
 //navigate back
 private void btn_back_Click(object sender, EventArgs e)
 {
     if (global.user == "admin")
     {
         this.Hide();
         AdminHome Adminhome = new AdminHome();
         Adminhome.Show();
     }
     else
     {
         this.Hide();
         LibrarianHome home = new LibrarianHome();
         home.Show();
     }
 }
        private void updateOperation_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to Exit..!", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                this.Hide();
                AdminHome admin = new AdminHome();
                admin.Show();
            }

            else
            {
                e.Cancel = true;
            }
        }
예제 #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("DO You Want to Delete?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                int        bid = Convert.ToInt32(bID);
                SqlCommand cmd = new SqlCommand();
                sm.deleteData("update Books_extend set book_status = 'deactivate' where book_id = '" + bID + "'");
                gridView();
            }
            else
            {
                AdminHome admin = new AdminHome();
                this.Show();
            }
        }
        private void button1_Click(object sender, EventArgs e) //Button for submit
        {
            //Converting Image to Byte format
            byte[]       img = null;
            FileStream   fs  = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
            BinaryReader br  = new BinaryReader(fs);

            img = br.ReadBytes((int)fs.Length);

            //Calling All methods class to insert books
            //Almethods class has the method for the query
            AllMethods objMethods = new AllMethods();

            objMethods.Initialize(); //Initializing all method class

            //Taking all the values inside the variables
            string material             = textBox1.Text;
            string source_combo_box     = textBox2.Text;
            string supplier_combo_box   = textBox3.Text;
            string subject_combo_box    = textBox4.Text;
            int    shelf_text           = Convert.ToInt32(ShelfText.Text);        //Converting string to int
            int    buying_price         = Convert.ToInt32(BuyingPriceText.Text);  //Converting string to int
            int    selling_price        = Convert.ToInt32(SellingPriceText.Text); //Converting string to int
            int    numberOfSellableBook = Convert.ToInt32(textBox6.Text);         //Converting string to int
            string bookTitle            = BookTitleText.Text;
            string authorName           = AuthorNameText.Text;
            string subTitle             = SubtitleText.Text;
            string isbn = ISBNText.Text;
            int    number_of_borrowable_books = Convert.ToInt32(NumberOfBorrowableBooksText.Text); //Converting string to int
            int    number_of_readable_books   = Convert.ToInt32(readableBooksText.Text);           //Converting string to int
            string edition = editionText.Text;

            //calling insert method to insert the books in the database
            objMethods.Insert(bookTitle, authorName, subTitle, subject_combo_box, isbn, buying_price, selling_price, numberOfSellableBook, shelf_text, number_of_borrowable_books, number_of_readable_books, material, supplier_combo_box, source_combo_box, edition, img, imageURL);


            this.Hide();                       //Hiding the present page
            AdminHome admin = new AdminHome(); //Creating new instance of home

            admin.Show();                      // show admin home after pressing submit button
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int SellableBook;
            int borrowable;
            int readable;
            int BuyingPrice  = Convert.ToInt32(textBox6.Text);
            int sellingPrice = Convert.ToInt32(textBox7.Text);

            book_number = sellBook + 1;
            sell        = Convert.ToInt32(textBox8.Text);
            borrow      = Convert.ToInt32(textBox12.Text);
            read        = Convert.ToInt32(textBox13.Text);

            while (sell > sellBook)
            {
                // MessageBox.Show("in the sell increase");
                SellableBook = 1;
                borrowable   = 0;
                readable     = 0;
                book_number++;
                sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + textBox6.Text + "', '" + textBox7.Text + "', '" + SellableBook + "', '" + textBox11.Text + "','" + borrowable + "', '" + readable + "','" + textBox14.Text + "', '" + textBox15.Text + "', '" + textBox16.Text + "',  '" + textBox17.Text + "', '" + pictureBox1.Image + "', '" + imageUrl + "','" + rfId + "','" + book_number + "')");
                sell--;

                // sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + bookTitle + "', '" + AuthorName + "', '" + SubTitle + "', '" + Subject + "', '" + ISBN + "', '" + BuyingPrice + "', '" + sellingPrice + "', '" + SellableBook + "', '" + ShelfNo + "','" + borrowable + "', '" + readable + "','" + MaterialType + "', '" + SupplierName + "', '" + Source + "',  '" + Edition + "', '" + Image + "', '" + ImageUrl + "','" + rf_id + "','" + book_number + "')");
            }
            book_number = 1;
            book_number = borrowBook + 1;
            while (borrow > borrowBook)
            {
                SellableBook = 0;
                borrowable   = 1;
                book_number++;
                readable = 0;
                sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + textBox6.Text + "', '" + textBox7.Text + "', '" + SellableBook + "', '" + textBox11.Text + "','" + borrowable + "', '" + readable + "','" + textBox14.Text + "', '" + textBox15.Text + "', '" + textBox16.Text + "',  '" + textBox17.Text + "', '" + pictureBox1.Image + "', '" + imageUrl + "','" + rfId + "','" + book_number + "')");
                borrow--;
                //     MessageBox.Show("in the borrow increase");
            }
            book_number = 1;
            book_number = readBook + 1;
            while (read > readBook)
            {
                SellableBook = 0;
                borrowable   = 0;
                readable     = 1;
                book_number++;
                sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + textBox6.Text + "', '" + textBox7.Text + "', '" + SellableBook + "', '" + textBox11.Text + "','" + borrowable + "', '" + readable + "','" + textBox14.Text + "', '" + textBox15.Text + "', '" + textBox16.Text + "',  '" + textBox17.Text + "', '" + pictureBox1.Image + "', '" + imageUrl + "','" + rfId + "','" + book_number + "')");
                read--;
                //    MessageBox.Show("in the read increase");
                // sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + bookTitle + "', '" + AuthorName + "', '" + SubTitle + "', '" + Subject + "', '" + ISBN + "', '" + BuyingPrice + "', '" + sellingPrice + "', '" + SellableBook + "', '" + ShelfNo + "','" + borrowable + "', '" + readable + "','" + MaterialType + "', '" + SupplierName + "', '" + Source + "',  '" + Edition + "', '" + Image + "', '" + ImageUrl + "','" + rf_id + "','" + book_number + "')");
            }
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //  book_number = 1;
            // book_number = sellBook;
            while (sell < sellBook)
            {
                //MessageBox.Show("in the sell de");
                //   book_number--;
                sm.insertData("delete from books where rf_id = '" + rfId + "' and book_number = (select max(book_number) from books where sellable_book = '1') and sellable_book = '1'");
                // readBook--;
                sell++;
                //   MessageBox.Show("in the sell de");
                // sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + bookTitle + "', '" + AuthorName + "', '" + SubTitle + "', '" + Subject + "', '" + ISBN + "', '" + BuyingPrice + "', '" + sellingPrice + "', '" + SellableBook + "', '" + ShelfNo + "','" + borrowable + "', '" + readable + "','" + MaterialType + "', '" + SupplierName + "', '" + Source + "',  '" + Edition + "', '" + Image + "', '" + ImageUrl + "','" + rf_id + "','" + book_number + "')");
            }
            //book_number = 1;
            // book_number = borrowBook;

            while (borrow < borrowBook)
            {
                // book_number--;
                // MessageBox.Show("in the borrow de");
                sm.insertData("delete from books where rf_id = '" + rfId + "' and book_number = (select max(book_number) from books where borrowable = '1') and borrowable = '1'");
                // readBook--;
                //  MessageBox.Show("in the borrow de");

                borrow++;
                // sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + bookTitle + "', '" + AuthorName + "', '" + SubTitle + "', '" + Subject + "', '" + ISBN + "', '" + BuyingPrice + "', '" + sellingPrice + "', '" + SellableBook + "', '" + ShelfNo + "','" + borrowable + "', '" + readable + "','" + MaterialType + "', '" + SupplierName + "', '" + Source + "',  '" + Edition + "', '" + Image + "', '" + ImageUrl + "','" + rf_id + "','" + book_number + "')");
            }
            // book_number = 1;
            //   book_number = borrowBook;
            while (read < readBook)

            {
                // book_number--;
                sm.insertData("delete from books where rf_id = '" + rfId + "' and book_number = (select max(book_number) from books where readableBook = '1') and readableBook = '1'");
                // readBook--;
                read++;
                //  MessageBox.Show("in the read de");
                // sm.insertData("INSERT INTO Books (Title,Author,Subtitle,Subject,ISBN,buying_price,selling_price,sellable_book,shelfNo, borrowable, readableBook, materialType, supplier, source, edition,imageBook, imageURL,rf_id,book_number) VALUES('" + bookTitle + "', '" + AuthorName + "', '" + SubTitle + "', '" + Subject + "', '" + ISBN + "', '" + BuyingPrice + "', '" + sellingPrice + "', '" + SellableBook + "', '" + ShelfNo + "','" + borrowable + "', '" + readable + "','" + MaterialType + "', '" + SupplierName + "', '" + Source + "',  '" + Edition + "', '" + Image + "', '" + ImageUrl + "','" + rf_id + "','" + book_number + "')");
            }



            SqlCommand cmd = new SqlCommand();

            sm.updateData("UPDATE [dbo].[Books_extend] SET [Title] = '" + textBox1.Text + "', [Author] = '" + textBox2.Text + "', [SubTitle] = '" + textBox3.Text + "',[Subject] = '" + textBox4.Text + "',[ISBN] = '" + textBox5.Text + "',[buying_price] = '" + BuyingPrice + "',[selling_price] = '" + sellingPrice + "',[sellable_book] = '" + Convert.ToInt32(textBox8.Text) + "',[shelfNo] = '" + Convert.ToInt32(textBox11.Text) + "',[borrowable] = '" + Convert.ToInt32(textBox12.Text) + "' ,[readableBook] = '" + Convert.ToInt32(textBox13.Text) + "',[materialType] = '" + textBox14.Text + "',[supplier] = '" + textBox15.Text + "',[source] = '" + textBox16.Text + "',[edition] = '" + textBox17.Text + "',[imageBook] = '" + pictureBox1.Image + "'  WHERE book_id = '" + bID + "'");
            sm.updateData("UPDATE [dbo].[Books] SET [Title] = '" + textBox1.Text + "', [Author] = '" + textBox2.Text + "', [SubTitle] = '" + textBox3.Text + "',[Subject] = '" + textBox4.Text + "',[ISBN] = '" + textBox5.Text + "',[buying_price] = '" + BuyingPrice + "',[selling_price] = '" + sellingPrice + "',[shelfNo] = '" + Convert.ToInt32(textBox11.Text) + "',[materialType] = '" + textBox14.Text + "',[supplier] = '" + textBox15.Text + "',[source] = '" + textBox16.Text + "',[edition] = '" + textBox17.Text + "',[imageBook] = '" + pictureBox1.Image + "'  WHERE rf_id = '" + rfId + "'");
            this.Hide();
            AdminHome admin = new AdminHome();

            admin.Show();
        }
예제 #11
0
 public AddingBookForm(AdminHome admin)
 {
     InitializeComponent();
 }