Sie sind auf Seite 1von 13

SWAPSOFTS: ILIB

THE LIBRARY MANAGEMENT SYSTEM SOFTWARE WITH C#.NET

PROJECT BY: RIDDHI SURANA (08IT000375) SWAPNIL BHATNAGAR (08IT000379) Swapsofts | iLib

THE MAIN PAGE

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace iLib { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { } private void fileToolStripMenuItem_DoubleClick(object sender, EventArgs e) { App a = new App(); Swapsofts | iLib

a.Show(); } private void fileToolStripMenuItem_MouseHover(object sender, EventArgs e) { } private void fileToolStripMenuItem_MouseEnter(object sender, EventArgs e) { } private void fileToolStripMenuItem_MouseLeave(object sender, EventArgs e) { } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Close(); } private void openToolStripMenuItem_Click(object sender, EventArgs e) { Login l = new Login(); l.Show(); } } }

THE LOGIN FORM

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace iLib { public partial class Login : Form Swapsofts | iLib

public Login() { InitializeComponent(); } OleDbDataAdapter da; DataSet ds; OleDbCommandBuilder cmm; int i; private void Login_Load(object sender, EventArgs e) { ds = new DataSet(); da = new OleDbDataAdapter("Select * from admin;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da.Fill(ds); cmm = new OleDbCommandBuilder(da); da.Update(ds.Tables[0]); } private void button1_Click(object sender, EventArgs e) { int j = ds.Tables[0].Rows.Count; for (int i = 0; i < j; i++) { if (textBox1.Text == ds.Tables[0].Rows[i][1].ToString() && textBox2.Text == ds.Tables[0].Rows[i][2].ToString()) { Close(); App obj = new App(); obj.Show(); break; } else { label3.Text = "Username or Password Mismatch! Enter again.. LOL"; } } } } }

Swapsofts | iLib

THE APPLICATION ISSUE/RETURN OR CHECK BOOK STATUS

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace iLib { public partial class App : Form { public App() { InitializeComponent(); } Swapsofts | iLib

OleDbDataAdapter da, da2, da3; DataSet ds, ds2, ds3; OleDbCommandBuilder cmm, cmm2, cmm3; int i; private void App_Load(object sender, EventArgs e) {// TODO: This line of code loads data into the 'lib_dbDataSet5.query' table. You can move, or remove it, as needed. this.queryTableAdapter.Fill(this.lib_dbDataSet5.query); // TODO: This line of code loads data into the 'lib_dbDataSet1.student' table. You can move, or remove it, as needed. this.studentTableAdapter.Fill(this.lib_dbDataSet1.student); //For Books ds = new DataSet(); da = new OleDbDataAdapter("Select * from books_db;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da.Fill(ds); cmm = new OleDbCommandBuilder(da); da.Update(ds.Tables[0]); //For Student Table ds2 = new DataSet(); da2 = new OleDbDataAdapter("Select * from student;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da2.Fill(ds2); cmm2 = new OleDbCommandBuilder(da2); da2.Update(ds2.Tables[0]); //For Query ds3 = new DataSet(); da3 = new OleDbDataAdapter("Select * from query;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da3.Fill(ds3); cmm3 = new OleDbCommandBuilder(da3); da3.Update(ds3.Tables[0]); // TODO: This line of code loads data into the 'lib_dbDataSet.books_db' table. You can move, or remove it, as needed. this.books_dbTableAdapter.Fill(this.lib_dbDataSet.books_db); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Close(); } private void issueBookToolStripMenuItem_Click(object sender, EventArgs e) { linkLabel3.Visible = false; groupBox1.Enabled = true; groupBox2.Enabled = false; groupBox3.Enabled = true; button1.Enabled = true; button2.Enabled = false; } private void returnBookToolStripMenuItem_Click(object sender, EventArgs e) { linkLabel3.Visible = false; groupBox2.Enabled = true; groupBox1.Enabled = false; button2.Enabled = true; Swapsofts | iLib

button1.Enabled = false; } private void textBox5_TextChanged(object sender, EventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { int j = ds2.Tables[0].Rows.Count; for (int i = 0; i < j; i++) { if (comboBox1.Text == ds2.Tables[0].Rows[i][1].ToString()) { textBox12.Text = ds2.Tables[0].Rows[i][3].ToString(); textBox12.ReadOnly = true; textBox2.Text = ds2.Tables[0].Rows[i][4].ToString(); textBox2.ReadOnly = true; textBox4.Text = ds2.Tables[0].Rows[i][2].ToString(); textBox4.ReadOnly = true; break; } else { MessageBox.Show("Sorry! No such user found! Please register the name"); } } } private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { int x = ds.Tables[0].Rows.Count; for (int i = 0; i < x; i++) { if (comboBox3.Text == ds.Tables[0].Rows[i][1].ToString()) { textBox5.Text = ds.Tables[0].Rows[i][5].ToString(); } } } private void button1_Click(object sender, EventArgs e) { DataRow r; r = ds3.Tables[0].NewRow(); r[1] = comboBox3.Text.ToString(); //bName r[2] = textBox5.Text.ToString(); //isbn r[3] = textBox1.Text.ToString(); //iss date r[4] = textBox3.Text.ToString(); //ret date r[5] = comboBox1.Text.ToString(); //sName r[6] = textBox4.Text.ToString(); //sEnroll r[7] = textBox2.Text.ToString(); //sSem r[8] = textBox12.Text.ToString(); //sBranch ds3.Tables[0].Rows.Add(r); da3.Update(ds3.Tables[0]); MessageBox.Show("Issued book "+comboBox3.Text.ToString()+ " successfully to "+comboBox1.Text.ToString()+" ! "); } private void browseIssuedBooksToolStripMenuItem_Click(object sender, EventArgs e) { Swapsofts | iLib

BrowseQuery q = new BrowseQuery(); q.Show(); } private void browseBooksToolStripMenuItem_Click(object sender, EventArgs e) { BrowseBooks b = new BrowseBooks(); b.Show(); } private void addStudentToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); AddStudent s = new AddStudent(); s.Show(); } private void checkStudentToolStripMenuItem_Click(object sender, EventArgs e) { BrowseStudent st = new BrowseStudent(); st.Show(); } private void checkBookStatusToolStripMenuItem_Click(object sender, EventArgs e) { linkLabel3.Visible = true; groupBox3.Enabled = true; } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { int j = ds.Tables[0].Rows.Count; for (int i = 0; i < j; i++) { if (textBox5.Text == ds3.Tables[0].Rows[i][2].ToString()) { MessageBox.Show("The Book " + comboBox3.Text.ToString() + " is issued to someone!"); } else { MessageBox.Show("The Book " + comboBox3.Text.ToString() + " is available!"); } } } private void addNewBooksToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); AddBooks b = new AddBooks(); b.Show(); } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("Swapsofts iLib+ v.1.01 build 8160\n\nCredits:\nSwapnil Bhatnagar\nRiddhi Surana"); } } } Swapsofts | iLib

BROWSE AVAILABLE BOOKS

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace iLib { public partial class BrowseBooks : Form { public BrowseBooks() { InitializeComponent(); } private void BrowseBooks_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lib_dbDataSet3.books_db' table. You can move, or remove it, as needed. this.books_dbTableAdapter.Fill(this.lib_dbDataSet3.books_db); } } }

Swapsofts | iLib

BROWSE STUDENTS Source Code:


using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace iLib { public partial class BrowseStudent : Form { public BrowseStudent() { InitializeComponent(); } private void BrowseStudent_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lib_dbDataSet4.student' table. You can move, or remove it, as needed. this.studentTableAdapter.Fill(this.lib_dbDataSet4.student); } } }

BROWSE ISSUED BOOKS

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace iLib { public partial class BrowseQuery : Form { public BrowseQuery() { InitializeComponent(); } private void BrowseQuery_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lib_dbDataSet2.query' table. You can move, or remove it, as needed. Swapsofts | iLib

this.queryTableAdapter.Fill(this.lib_dbDataSet2.query); } } }

ADD NEW BOOKS INTO LIBRARY

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace iLib { public partial class AddBooks : Form { public AddBooks() { InitializeComponent(); } private void AddBooks_Load(object sender, EventArgs e) { ds = new DataSet(); da = new OleDbDataAdapter("Select * from books_db;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da.Fill(ds); cmm = new OleDbCommandBuilder(da); Swapsofts | iLib

da.Update(ds.Tables[0]); } private void button2_Click(object sender, EventArgs e) { Close(); App a = new App(); a.Show(); } OleDbDataAdapter da; DataSet ds; OleDbCommandBuilder cmm; int i; private void button1_Click(object sender, EventArgs e) { DataRow r; r = ds.Tables[0].NewRow(); r[1] = textBox1.Text.ToString(); //book r[3] = textBox2.Text.ToString(); //catagory r[4] = int.Parse(textBox3.Text); //subject r[5] = int.Parse(textBox4.Text); //price r[6] = int.Parse(textBox5.Text); //ISBN r[2] = int.Parse(textBox6.Text); //auth ds.Tables[0].Rows.Add(r); da.Update(ds.Tables[0]); MessageBox.Show("Book added with attributes: \nName: " + textBox1.Text.ToString() + "\nAuthor: " + textBox2.Text.ToString() + "\nCatagory: " + textBox3.Text.ToString() + "\nSubject: " + textBox4.Text.ToString() + "\nISBN: " + textBox5.Text.ToString() + "\nPrice: " + textBox6.Text.ToString()); App a = new App(); Close(); a.Show(); } } }

ADD NEW STUDENT INFORMATION

Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace iLib { public partial class AddStudent : Form { public AddStudent() { InitializeComponent(); } OleDbDataAdapter da; DataSet ds; Swapsofts | iLib

OleDbCommandBuilder cmm; int i; private void AddStudent_Load(object sender, EventArgs e) { ds = new DataSet(); da = new OleDbDataAdapter("Select * from student;", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\iProjects\iLib\lib_db.mdb"); da.Fill(ds); cmm = new OleDbCommandBuilder(da); da.Update(ds.Tables[0]); } private void button1_Click(object sender, EventArgs e) { DataRow r; r = ds.Tables[0].NewRow(); r[1] = textBox1.Text.ToString(); //sName r[2] = textBox2.Text.ToString(); //sEnroll r[3] = textBox3.Text.ToString(); //sBranch r[4] = textBox4.Text.ToString(); //sSem ds.Tables[0].Rows.Add(r); da.Update(ds.Tables[0]); MessageBox.Show("Student added with attributes: \nName: " + textBox1.Text.ToString()+"\nEnrollment: "+textBox2.Text.ToString()+"\nBranch: "+textBox3.Text.ToString()+"\nSemester: "+textBox4.Text.ToString()); App a = new App(); Close(); a.Show(); } private void button2_Click(object sender, EventArgs e) { Close(); App a = new App(); a.Show(); } } }

Swapsofts | iLib

Das könnte Ihnen auch gefallen