Create Database Create Varchar Varchar Create Varchar Varchar
Create Database Create Varchar Varchar Create Varchar Varchar
) insert loginvalidater1 values ( 'STAFF','1234' ) --insert loginvalidater values ( 'MANAGER','123' ) ------------------------------------------create table empdetail ( ID varchar(29) constraint sdf primary key,Name varchar(50),Address varchar(50),Email varchar(50),Destination varchar(50),Contact_no varchar(50),Fax varchar(50),Status varchar(20) ) insert empdetail values ( 'A001','Digvijay','Kankarbagh','[email protected]','Staf f','9876543210','2345678','Booked' ) select * from empdetail -------------------------------------------------------------create table Rooms (
Id varchar(20)constraint ma primary key,Name varchar(20),Floor_No varchar(10),Room_No varchar(10),Accepted_date varchar(50),Delivery_date varchar(50),No_Of_Cloths int,Total_bill int ) insert Rooms values ( 'B001','Manish','1st Floor','09','saturday/12/august','sunday/30/august','12 ','10000' ) -------------------------------create table clean ( Floor_no varchar(10),Room_no varchar(10),Assigned_by varchar(100),Status varchar(30) ) insert clean values ( '2nd Floor','L001','Umang Kaushal','cleaned' ) ------------------------------------create table booking ( Names varchar(50),Id varchar(10)constraint man primary key,Address varchar(60),City varchar(30), State varchar(40),Country varchar(50),Gender varchar(10),Phone varchar(11), Email varchar(40),Floor_no varchar(10),Room_no varchar(10), Check_in_date varchar(30),Check_out_date varchar(30),Days int, Payable varchar(30),Status varchar(10),Bill int,Amount int ) insert booking values (
------------------------------------------------------CREATE table p_available ( Id varchar(10) constraint zs primary key,Floor_no varchar(10),Room_no varchar(10),Status varchar(20) ) insert p_available values ( 'B004','1st floor','L002','N' ) ----------------------CREATE table l_available ( Id varchar(10) constraint xs primary key,Floor_no varchar(10),Room_no varchar(10),Status varchar(20) ) insert l_available values ( 'L003','1st floor','L002','N' ) ----------------------------------CREATE table e_available ( Id varchar(10) constraint vs primary key,Floor_no varchar(10),Room_no varchar(10),Status varchar(20) ) insert e_available values
( 'E003','1st floor','L002','N' ) --------------------------------create table luxary ( Names varchar(50),Id varchar(10)constraint adi primary key,Address varchar(60),City varchar(30), State varchar(40),Country varchar(50),Gender varchar(10),Phone varchar(11), Email varchar(40),Floor_no varchar(10),Room_no varchar(10), Check_in_date varchar(30),Check_out_date varchar(30),Days int, Payable varchar(30),Status varchar(10),Bill int,Amount int ) insert luxary values ( 'MANISH','C001','Kankarbagh','Patna','Bihar','India','M ale','98765654','[email protected]', '1st floor','L001','Sunday 31 oct 2012','Monday 31 oct 2012', 1,'cheque','booked',5000.00,5000.00 ) --------------------create table executive ( Names varchar(50),Id varchar(10)constraint adit primary key,Address varchar(60),City varchar(30), State varchar(40),Country varchar(50),Gender varchar(10),Phone varchar(11), Email varchar(40),Floor_no varchar(10),Room_no varchar(10), Check_in_date varchar(30),Check_out_date varchar(30),Days int, Payable varchar(30),Status varchar(10),Bill int,Amount int )
insert executive values ( 'MANISH','C001','Kankarbagh','Patna','Bihar','India','M ale','98765654','[email protected]', '1st floor','L001','Sunday 31 oct 2012','Monday 31 oct 2012', 1,'cheque','booked',5000.00,5000.00 ) --------------------------create table presidential ( Names varchar(50),Id varchar(10)constraint adity primary key,Address varchar(60),City varchar(30), State varchar(40),Country varchar(50),Gender varchar(10),Phone varchar(11), Email varchar(40),Floor_no varchar(10),Room_no varchar(10), Check_in_date varchar(30),Check_out_date varchar(30),Days int, Payable varchar(30),Status varchar(10),Bill int,Amount int ) insert presidential values ( 'MANISH','C001','Kankarbagh','Patna','Bihar','India','M ale','98765654','[email protected]', '1st floor','L001','Sunday 31 oct 2012','Monday 31 oct 2012', 1,'cheque','booked',5000.00,5000.00 ) ----------------------------------------
namespace Login_Form2 { public partial class Royal_Hotel : Form { public Royal_Hotel() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void logOk_Click(object sender, EventArgs e) { if (logBox.Text.Length == 0 || logTxt.Text.Length == 0) { MessageBox.Show("UserID or Password field must not be blank.", "Fill the User id and Password", MessageBoxButtons.OK, MessageBoxIcon.Question); return; }
if (logBox.Text == "MANAGER") { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.;Initial Catalog=project;user id=sa;password=kankarbagh"; con.Open(); SqlCommand cmd = new SqlCommand(" select count(*) from Loginvalidater where userid='" + logBox.Text.ToString().Trim() + "' and password='" + logTxt.Text.ToString().Trim() + "' ", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); int val = Convert.ToInt32(dr[0]); if (val > 0) { addClass.user = logBox.Text.Trim().ToString(); //if (logBox.Text == "MANAGER") //{ manager mn = new manager(); mn.Show(); this.Hide(); //} //else if (logBox.Text == "STAFF") //{ // staffhome sh = new staffhome(); // this.Hide(); // sh.Show(); //} } else { MessageBox.Show("Invalid userid and password.", "Data entry error.", MessageBoxButtons.OK, MessageBoxIcon.Error); }
logTxt.Text = ""; con.Close(); } if (logBox.Text == "STAFF") { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.;Initial Catalog=project;user id=sa;password=kankarbagh"; con.Open(); SqlCommand cmd = new SqlCommand(" select count(*) from Loginvalidater1 where userid='" + logBox.Text.ToString().Trim() + "' and password='" + logTxt.Text.ToString().Trim() + "' ", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); int val = Convert.ToInt32(dr[0]); if (val > 0) { addClass.user = logBox.Text.Trim().ToString(); //if (logBox.Text == "MANAGER") //{ //manager mn = new manager(); //mn.Show(); //this.Hide(); //} //if (logBox.Text == "STAFF") //{ staffhome sh = new staffhome(); this.Hide(); sh.Show(); } else { MessageBox.Show("Invalid userid and password.", "Data entry error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
} logTxt.Text = ""; con.Close(); } } private void logTxt_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { if (logBox.Text.Length == 0 || logTxt.Text.Length == 0) { MessageBox.Show("UserID or Password field must not be blank.", "Fill the User id and Password", MessageBoxButtons.OK, MessageBoxIcon.Question); return; } if (logBox.Text == "MANAGER") { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.;Initial Catalog=project;user id=sa;password=kankarbagh"; con.Open(); SqlCommand cmd = new SqlCommand(" select count(*) from Loginvalidater where userid='" + logBox.Text.ToString().Trim() + "' and password='" + logTxt.Text.ToString().Trim() + "' ", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); int val = Convert.ToInt32(dr[0]); if (val > 0) {
addClass.user = logBox.Text.Trim().ToString(); //if (logBox.Text == "MANAGER") //{ manager mn = new manager(); mn.Show(); this.Hide(); //} //else if (logBox.Text == "STAFF") //{ // staffhome sh = new staffhome(); // this.Hide(); // sh.Show(); //} } else { MessageBox.Show("Invalid userid and password.", "Data entry error.", MessageBoxButtons.OK, MessageBoxIcon.Error); } logTxt.Text = ""; con.Close(); } if (logBox.Text == "STAFF") { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=.;Initial Catalog=project;user id=sa;password=kankarbagh"; con.Open(); SqlCommand cmd = new SqlCommand(" select count(*) from Loginvalidater1 where userid='" + logBox.Text.ToString().Trim() + "' and password='" + logTxt.Text.ToString().Trim() + "' ", con);
SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); int val = Convert.ToInt32(dr[0]); if (val > 0) { addClass.user = logBox.Text.Trim().ToString(); //if (logBox.Text == "MANAGER") //{ //manager mn = new manager(); //mn.Show(); //this.Hide(); //} //if (logBox.Text == "STAFF") //{ staffhome sh = new staffhome(); this.Hide(); sh.Show(); //} } else { MessageBox.Show("Invalid userid and password.", "Data entry error.", MessageBoxButtons.OK, MessageBoxIcon.Error); } logTxt.Text = ""; con.Close(); } } } private void logTxt_TextChanged(object sender, EventArgs e) { }
private void button1_Click(object sender, EventArgs e) { Application.Exit(); } private void logBox_SelectedIndexChanged(object sender, EventArgs e) { } } }
namespace Login_Form2 { public partial class manager : Form { EmplyeeDetails det = new EmplyeeDetails(); EmployeeSearch b = new EmployeeSearch(); public manager() { InitializeComponent(); } private void roomServicesToolStripMenuItem_Click(object sender, EventArgs e) { } private void eitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void manageEmployeesToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); det.Show(); }
private void searchEmployeesToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); b.Show(); } private void frontDeskToolStripMenuItem1_Click(object sender, EventArgs e) { Staff h = new Staff(); h.Show(); this.Hide(); } private void button1_Click(object sender, EventArgs e) { Staff h = new Staff(); h.Show(); this.Hide(); } private void button2_Click(object sender, EventArgs e) { HouseKeeping d = new HouseKeeping(); //staffhome d = new staffhome(); this.Hide(); d.Show(); }
private void houseKeepingToolStripMenuItem1_Click(object sender, EventArgs e) { HouseKeeping h = new HouseKeeping(); h.Show(); this.Hide(); } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { } private void pictureBox1_Click(object sender, EventArgs e) { }
private void goToStaffToolStripMenuItem_Click(object sender, EventArgs e) { CustomerDetails g = new CustomerDetails(); g.Show(); this.Hide(); } private void manager_Load(object sender, EventArgs e) { }
private void button6_Click(object sender, EventArgs e) { MessageBox.Show("This is Taj Hotel.", "Always try to make like this.",MessageBoxButtons.OK ,MessageBoxIcon.Information); } private void button3_Click(object sender, EventArgs e) { CustomerDetails cd = new CustomerDetails(); cd.Show(); this.Hide(); } private void button4_Click(object sender, EventArgs e) { EmplyeeDetails ed = new EmplyeeDetails(); ed.Show(); this.Hide(); } private void button3_Click_1(object sender, EventArgs e) { CustomerDetails cd = new CustomerDetails(); cd.Show(); this.Hide(); } } }
namespace Login_Form2 { public partial class Staff : Form { public Staff() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { label5.Visible = false; label6.Visible = false; label7.Visible = false; label8.Visible = false; label9.Visible = false; label10.Visible = false; button2.Enabled = false; button4.Enabled = false; button6.Enabled = false; string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString; cn2.Open(); SqlDataAdapter da = new SqlDataAdapter("select Room_no,Status from p_available where status='" + "unbook" + "'", cn2); DataSet ds = new DataSet();
da.Fill(ds, "p_available"); dataGridView1.DataSource = ds.Tables[0]; if (ds.Tables[0].Rows.Count != 0) { button2.Enabled = true; label5.Visible = true; } else { label8.Visible = true; } } private void button7_Click(object sender, EventArgs e) { Application.Exit(); } private void button8_Click(object sender, EventArgs e) { manager m = new manager(); m.Show(); this.Hide(); } private void houseKeepingToolStripMenuItem_Click(object sender, EventArgs e) { HouseKeeping u = new HouseKeeping(); u.Show(); }
private void button2_Click(object sender, EventArgs e) { Booking m = new Booking(); m.Show(); this.Close(); } private void button4_Click(object sender, EventArgs e) { Booking m = new Booking(); m.Show(); this.Close(); } private void button6_Click(object sender, EventArgs e) { Booking m = new Booking(); m.Show(); this.Close(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) { }
private void Staff_Load(object sender, EventArgs e) { label5.Visible = false; label6.Visible = false; label7.Visible = false; label8.Visible = false; label9.Visible = false; label10.Visible = false; button2.Enabled = false; button4.Enabled = false; button6.Enabled = false; } private void button9_Click(object sender, EventArgs e) { if (addClass.user == "MANAGER") { manager r = new manager(); this.Hide(); r.Show(); } if (addClass.user == "STAFF") { staffhome g = new staffhome(); g.Show(); this.Hide(); } } private void button3_Click(object sender, EventArgs e) { label5.Visible = false; label6.Visible = false; label7.Visible = false; label8.Visible = false; label9.Visible = false; label10.Visible = false;
button2.Enabled = false; button4.Enabled = false; button6.Enabled = false; string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString; cn2.Open(); SqlDataAdapter da = new SqlDataAdapter("select Room_no,Status from e_available where status='" + "unbook" + "'", cn2); DataSet ds = new DataSet(); da.Fill(ds, "e_available"); dataGridView1.DataSource = ds.Tables[0]; if (ds.Tables[0].Rows.Count != 0) { button4.Enabled = true; label6.Visible = true; } else { label9.Visible = true; } } private void button5_Click(object sender, EventArgs e) { } private void button5_Click_1(object sender, EventArgs e) { label5.Visible = false; label6.Visible = false; label7.Visible = false; label8.Visible = false; label9.Visible = false;
label10.Visible = false; button2.Enabled = false; button4.Enabled = false; button6.Enabled = false; string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString; cn2.Open(); SqlDataAdapter da = new SqlDataAdapter("select Room_no,Status from l_available where status='" + "unbook" + "'", cn2); DataSet ds = new DataSet(); da.Fill(ds, "l_available"); dataGridView1.DataSource = ds.Tables[0]; if (ds.Tables[0].Rows.Count != 0) { button6.Enabled = true; label7.Visible = true; } else { label10.Visible = true; } } private void label10_Click(object sender, EventArgs e) { } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { string roomNo; int id = dataGridView1.SelectedRows[0].Index;
namespace Login_Form2 { public partial class HouseKeeping : Form { DataTable dt; DataRow dr; string code; public HouseKeeping() { InitializeComponent(); } private void HouseKeeping_Load(object sender, EventArgs e) { button3.Enabled = false; //button2.Enabled = false; textBox1.Enabled = false; comboBox1.Enabled = false; textBox2.Enabled = false; comboBox2.Enabled = false; } private void textBox1_TextChanged(object sender, EventArgs e) { }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { }
private void button5_Click(object sender, EventArgs e) { if (addClass.user == "MANAGER") { manager r = new manager(); this.Hide(); r.Show(); } if (addClass.user == "STAFF") { staffhome g = new staffhome(); g.Show(); this.Hide(); } } private void button1_Click(object sender, EventArgs e) { textBox1.Enabled = true; comboBox1.Enabled = true; textBox2.Enabled = true; comboBox2.Enabled = true; textBox1.Text = ""; comboBox1.Text = ""; textBox2.Text = ""; comboBox2.Text = ""; button1.Enabled = false; //button2.Enabled = true; } private void button2_Click(object sender, EventArgs e) { if (comboBox1.Text.Length == 0 || comboBox2.Text.Length == 0 || textBox1.Text.Length == 0 || textBox2.Text.Length == 0) { MessageBox.Show("All boxes must be filled.", "Data entry error.", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
} else { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn3 = new SqlConnection(); cn3.ConnectionString = connectionString; cn3.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from clean ", cn3); DataSet ds = new DataSet(); da.Fill(ds, "clean"); SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["clean"]; dr = dt.NewRow(); dr[1] = textBox1.Text; dr[0] = comboBox1.Text; dr[2] = textBox2.Text; dr[3] = comboBox2.Text; dt.Rows.Add(dr); da.Update(ds, "clean"); textBox1.Enabled = false; comboBox1.Enabled = false; textBox2.Enabled = false; comboBox2.Enabled = false; button1.Enabled = true; MessageBox.Show("Saved sucessfully."); dataGridView1.DataSource = ds.Tables[0]; } } private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) {
} private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e) { } private void button3_Click(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString; cn1.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * From clean", cn1); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da); DataSet ds = new DataSet(); da.FillSchema(ds, SchemaType.Source, "clean"); da.Fill(ds, "clean"); string code; code = textBox1.Text.Trim(); dr = ds.Tables["clean"].Rows.Find(code); dr.BeginEdit(); dr[0] = comboBox1.Text; dr[1] = textBox1.Text; dr[2] = textBox2.Text; dr[3] = comboBox2.Text; dr.EndEdit(); da.Update(ds, "clean"); dataGridView1.DataSource = ds.Tables[0]; MessageBox.Show("Update Successfully."); }
private void button4_Click(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn3 = new SqlConnection(); cn3.ConnectionString = connectionString; cn3.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from clean where floor_no='" + comboBox3.Text.Trim() + "'", cn3); DataSet ds = new DataSet(); da.Fill(ds, "clean"); dataGridView1.DataSource = ds.Tables[0]; } private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { int id = dataGridView1.SelectedRows[0].Index; comboBox1.Text = dataGridView1.Rows[id].Cells[0].Value.ToString().Trim() ; textBox1.Text = dataGridView1.Rows[id].Cells[1].Value.ToString().Trim() ; textBox2.Text = dataGridView1.Rows[id].Cells[2].Value.ToString().Trim() ;
comboBox2.Text = dataGridView1.Rows[id].Cells[3].Value.ToString().Trim() ; button3.Enabled = true; comboBox1.Enabled = true; textBox1.Enabled = true; textBox2.Enabled = true; comboBox2.Enabled = true; } private void comboBox3_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn3 = new SqlConnection(); cn3.ConnectionString = connectionString; cn3.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from clean where floor_no='" + comboBox3.Text.Trim() + "'", cn3); DataSet ds = new DataSet(); da.Fill(ds, "clean"); dataGridView1.DataSource = ds.Tables[0]; } } private void button2_Click_1(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh";
SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from clean", cn); DataSet ds = new DataSet(); da.Fill(ds, "clean"); SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["clean"]; dr = dt.NewRow(); dr[0] = comboBox1.Text; dr[1] = textBox1.Text; dr[2] = textBox2.Text; dr[3] = comboBox2.Text; dt.Rows.Add(dr); da.Update(ds, "clean"); textBox1.Text = System.Convert.ToString(dr[0]); MessageBox.Show("Saved sucessfully."); dataGridView1.DataSource = ds.Tables[0]; } } }
namespace Login_Form2 { public partial class EmplyeeDetails : Form { DataTable dt; DataRow dr; string code; EmployeeSearch C = new EmployeeSearch(); public EmplyeeDetails() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || textBox7.Text.Length == 0 || comboBox1.Text.Length == 0) { MessageBox.Show("All boxes must be filled."); } else { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh";
SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from empdetail", cn); DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["empdetail"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox2.Text; dr[2] = textBox3.Text; dr[3] = textBox4.Text; dr[4] = textBox5.Text; dr[5] = textBox6.Text; dr[6] = textBox7.Text; dr[7] = comboBox1.Text; dt.Rows.Add(dr); da.Update(ds, "empdetail"); textBox1.Text = System.Convert.ToString(dr[0]); textBox1.Enabled = false; textBox2.Enabled = false; textBox3.Enabled = false; textBox4.Enabled = false; textBox5.Enabled = false; textBox6.Enabled = false; textBox7.Enabled = false; comboBox1.Enabled = false; //da.Fill(ds, "empdetail"); button2.Enabled = true; button1.Enabled = false; MessageBox.Show("Saved sucessfully."); dataGridView1.DataSource = ds.Tables[0]; } }
private void homeToolStripMenuItem_Click(object sender, EventArgs e) { //a.Show(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void button5_Click(object sender, EventArgs e) { manager n = new manager(); n.Show(); this.Hide(); } private void searchToolStripMenuItem_Click(object sender, EventArgs e) { C.Show(); } private void EmplyeeDetails_Load(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * From empdetail", cn); DataSet ds = new DataSet();
da.Fill(ds,"empdetail"); dataGridView1.DataSource = ds.Tables["empdetail"]; button3.Enabled = false; textBox1.Enabled = false; textBox2.Enabled = false; textBox3.Enabled = false; textBox4.Enabled = false; textBox5.Enabled = false; textBox6.Enabled = false; textBox7.Enabled = false; comboBox1.Enabled = false; button1.Enabled = false; button4.Enabled = false; } private void button4_Click(object sender, EventArgs e) { //textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; comboBox1.Text = "-----Select-----"; } private void button2_Click(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * From empdetail", cn);
DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); textBox1.Enabled = false; textBox2.Enabled = true; textBox3.Enabled = true; textBox4.Enabled = true; textBox5.Enabled = true; textBox6.Enabled = true; textBox7.Enabled = true; comboBox1.Enabled = true; button1.Enabled = true; button3.Enabled = false; button4.Enabled = false; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; comboBox1.Text = "-----Select-----"; int ctr, len; string codeval; dt = ds.Tables["empdetail"]; len = dt.Rows.Count - 1; dr = dt.Rows[len]; code = dr["Id"].ToString(); codeval = code.Substring(1, 3); ctr = Convert.ToInt32(codeval); if ((ctr >= 1) && (ctr < 9)) { ctr = ctr + 1; textBox1.Text = "A00" + ctr.ToString(); } else if ((ctr >= 9) && (ctr < 99)) { ctr = ctr + 1; textBox1.Text = "A0" + ctr.ToString(); } else if (ctr >= 99)
{ ctr = ctr + 1; textBox1.Text = "A" + ctr.ToString(); } button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || textBox7.Text.Length == 0 || comboBox1.Text.Length == 0) { MessageBox.Show("All boxes must be filled."); } else { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString; cn1.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * From empdetail", cn1); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da); DataSet ds = new DataSet(); da.FillSchema(ds, SchemaType.Source, "empdetail"); da.Fill(ds, "empdetail"); string code; code = textBox1.Text.Trim();
dr = ds.Tables["empdetail"].Rows.Find(code); //dr.Delete(); dr.BeginEdit(); dr[0] = textBox1.Text; dr[1] = textBox2.Text; dr[2] = textBox3.Text; dr[3] = textBox4.Text; dr[4] = textBox5.Text; dr[5] = textBox6.Text; dr[6] = textBox7.Text; dr[7] = comboBox1.Text; dr.EndEdit(); da.Update(ds, "empdetail"); button4.Enabled = true; dataGridView1.DataSource = ds.Tables[0]; MessageBox.Show("Update Successfully."); } } private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) { } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { int id = dataGridView1.SelectedRows[0].Index; textBox1.Text = dataGridView1.Rows[id].Cells[0].Value.ToString().Trim() ;
textBox2.Text = dataGridView1.Rows[id].Cells[1].Value.ToString().Trim() ; textBox3.Text = dataGridView1.Rows[id].Cells[2].Value.ToString().Trim() ; textBox4.Text = dataGridView1.Rows[id].Cells[3].Value.ToString().Trim() ; textBox5.Text = dataGridView1.Rows[id].Cells[4].Value.ToString().Trim() ; textBox6.Text = dataGridView1.Rows[id].Cells[5].Value.ToString().Trim() ; textBox7.Text = dataGridView1.Rows[id].Cells[6].Value.ToString().Trim() ; comboBox1.Text = dataGridView1.Rows[id].Cells[7].Value.ToString().Trim() ; button3.Enabled = true; button1.Enabled = false; button4.Enabled = true; textBox1.Enabled = false; textBox2.Enabled = true; textBox3.Enabled = true; textBox4.Enabled = true; textBox5.Enabled = true; textBox6.Enabled = true; textBox7.Enabled = true; comboBox1.Enabled = true; } private void textBox6_KeyPress(object sender, KeyPressEventArgs e) { const char delete = (char)8; e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != delete;
} } using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient;
namespace Login_Form2 { public partial class EmployeeSearch : Form { public EmployeeSearch() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { manager r = new manager(); r.Show(); this.Hide(); } private void label4_Click(object sender, EventArgs e) { } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) {
} private void button1_Click(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); if(comboBox2.Text=="Name") { SqlDataAdapter da = new SqlDataAdapter("select * from empdetail where name ='" + textBox2.Text.Trim() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); dataGridView1.DataSource = ds.Tables["empdetail"]; } else if (comboBox2.Text == "Designation") { SqlDataAdapter da = new SqlDataAdapter("select * from empdetail where destination ='" + textBox2.Text.Trim() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); dataGridView1.DataSource = ds.Tables["empdetail"]; } else { MessageBox.Show("Please enter those written in combo box !"); } }
private void textBox2_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); if (comboBox2.Text == "Name") { SqlDataAdapter da = new SqlDataAdapter("select * from empdetail where name ='" + textBox2.Text.Trim() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); dataGridView1.DataSource = ds.Tables["empdetail"]; } else if (comboBox2.Text == "Designation") { SqlDataAdapter da = new SqlDataAdapter("select * from empdetail where destination ='" + textBox2.Text.Trim() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds, "empdetail"); dataGridView1.DataSource = ds.Tables["empdetail"]; } else { MessageBox.Show("Please enter those written in combo box !"); } } }
private void EmployeeSearch_Load(object sender, EventArgs e) { } }} using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient;
namespace Login_Form2 { public partial class CustomerDetails : Form { DataTable dt; DataRow dr; public CustomerDetails() { InitializeComponent(); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void button3_Click(object sender, EventArgs e)
{ if (addClass.user == "MANAGER") { manager r = new manager(); this.Hide(); r.Show(); } if (addClass.user == "STAFF") { staffhome g = new staffhome(); g.Show(); this.Hide(); } } private void button1_Click(object sender, EventArgs e) { if ((comboBox1.Text.Length == 0) && (textBox1.Text.Length == 0)) { MessageBox.Show("All boxes must be filled."); } else { if (comboBox1.Text == "Customer ID") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from booking where id ='" + textBox1.Text.Trim() + "'", cn); DataSet ds = new DataSet();
da.Fill(ds, "booking"); dataGridView1.DataSource = ds.Tables["booking"]; } else if (comboBox1.Text.Trim() == "Customer Name") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString; cn1.Open(); SqlDataAdapter da1 = new SqlDataAdapter("select * from booking where names ='" + textBox1.Text.Trim() + "'", cn1); DataSet ds1 = new DataSet(); da1.Fill(ds1, "booking"); dataGridView1.DataSource = ds1.Tables["booking"]; } else { MessageBox.Show("Please enter those written in combo box !"); } } } private void CustomerDetails_Load(object sender, EventArgs e) { button4.Enabled = false; button2.Enabled = false; string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection();
cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * From booking", cn); DataSet ds = new DataSet(); da.Fill(ds, "booking"); dataGridView1.DataSource = ds.Tables["booking"]; tableLayoutPanel1.Visible = false; label19.Visible= false; button5.Visible= false; button6.Visible = false; textBox4.Enabled = false; textBox5.Enabled = false; textBox6.Enabled = false; textBox7.Enabled = false; textBox8.Enabled = false; textBox9.Enabled = false; textBox10.Enabled = false; textBox11.Enabled = false; textBox12.Enabled = false; textBox3.Enabled = false; textBox2.Enabled = false; comboBox2.Enabled = false; } private void button2_Click(object sender, EventArgs e) { string ad = textBox2.Text.Substring(0, 1); if(ad == "L") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString; cn1.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * From l_available", cn1); SqlCommandBuilder cmd = new SqlCommandBuilder(da); DataSet ds1 = new DataSet(); da.FillSchema(ds1, SchemaType.Source, "l_available"); da.Fill(ds1, "l_available"); string code; code = textBox2.Text.Trim(); dr = ds1.Tables["l_available"].Rows.Find(code); dr.BeginEdit(); dr[0] = textBox2.Text; dr[1] = comboBox3.Text; dr.EndEdit(); da.Update(ds1, "l_available"); cn1.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString2; cn2.Open(); SqlDataAdapter da2 = new SqlDataAdapter("Select * From booking", cn2); SqlCommandBuilder cmd2 = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "booking"); da2.Fill(ds2, "booking"); string code2; code2 = textBox3.Text.Trim(); dr = ds2.Tables["booking"].Rows.Find(code2); dr.BeginEdit(); dr[1] = textBox3.Text;
dr[9] = comboBox2.Text; dr[10] = textBox2.Text; dr[15] = comboBox3.Text; dr.EndEdit(); da2.Update(ds2,"booking"); MessageBox.Show("Room has been unbooked...."); dataGridView1.DataSource = ds2.Tables["booking"]; } else if(ad == "E") { string connectionString1 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString1; cn.Open(); SqlDataAdapter da1 = new SqlDataAdapter("Select * From e_available", cn); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da1); DataSet ds = new DataSet(); da1.FillSchema(ds, SchemaType.Source, "e_available"); da1.Fill(ds, "e_available"); string code1; code1 = textBox2.Text.Trim(); dr = ds.Tables["e_available"].Rows.Find(code1); dr.BeginEdit(); dr[0] = textBox2.Text; dr[1] = comboBox3.Text; dr.EndEdit(); da1.Update(ds, "e_available"); cn.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh";
SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString2; cn2.Open(); SqlDataAdapter da2 = new SqlDataAdapter("Select * From booking", cn2); SqlCommandBuilder cmd2 = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "booking"); da2.Fill(ds2, "booking"); string code2; code2 = textBox3.Text.Trim(); dr = ds2.Tables["booking"].Rows.Find(code2); dr.BeginEdit(); dr[1] = textBox3.Text; dr[9] = comboBox2.Text; dr[10] = textBox2.Text; dr[15] = comboBox3.Text; dr.EndEdit(); da2.Update(ds2, "booking"); MessageBox.Show("Room has been unbooked...."); dataGridView1.DataSource = ds2.Tables["booking"]; } else if(ad == "P") { string connectionString1 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString1; cn.Open(); SqlDataAdapter da1 = new SqlDataAdapter("Select * From p_available", cn);
SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da1); DataSet ds = new DataSet(); da1.FillSchema(ds, SchemaType.Source, "p_available"); da1.Fill(ds, "p_available"); string code1; code1 = textBox2.Text.Trim(); dr = ds.Tables["p_available"].Rows.Find(code1); dr.BeginEdit(); dr[0] = textBox2.Text; dr[1] = comboBox3.Text; dr.EndEdit(); da1.Update(ds, "p_available"); cn.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString2; cn2.Open(); SqlDataAdapter da2 = new SqlDataAdapter("Select * From booking", cn2); SqlCommandBuilder cmd2 = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "booking"); da2.Fill(ds2, "booking"); string code2; code2 = textBox3.Text.Trim(); dr = ds2.Tables["booking"].Rows.Find(code2); dr.BeginEdit(); dr[1] = textBox3.Text; dr[9] = comboBox2.Text; dr[10] = textBox2.Text;
dr[15] = comboBox3.Text; dr.EndEdit(); da2.Update(ds2, "booking"); MessageBox.Show("Room has been unbooked...."); dataGridView1.DataSource = ds2.Tables["booking"]; } else { MessageBox.Show("Enter correct room number."); } } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { int id = dataGridView1.SelectedRows[0].Index; textBox3.Text = dataGridView1.Rows[id].Cells[1].Value.ToString().Trim() ; comboBox2.Text = dataGridView1.Rows[id].Cells[9].Value.ToString().Trim() ; textBox2.Text = dataGridView1.Rows[id].Cells[10].Value.ToString().Trim( ); comboBox3.Text = dataGridView1.Rows[id].Cells[16].Value.ToString().Trim( ); int re = dataGridView1.SelectedRows[0].Index; textBox4.Text = dataGridView1.Rows[re].Cells[1].Value.ToString().Trim() ;
textBox5.Text = dataGridView1.Rows[re].Cells[0].Value.ToString().Trim() ; textBox6.Text = dataGridView1.Rows[re].Cells[2].Value.ToString().Trim() ; textBox7.Text = dataGridView1.Rows[re].Cells[7].Value.ToString().Trim() ; textBox8.Text = dataGridView1.Rows[re].Cells[8].Value.ToString().Trim() ; textBox9.Text = dataGridView1.Rows[re].Cells[10].Value.ToString().Trim( ); textBox10.Text = dataGridView1.Rows[re].Cells[13].Value.ToString().Trim( ); textBox11.Text = dataGridView1.Rows[re].Cells[17].Value.ToString().Trim( ); textBox12.Text = dataGridView1.Rows[re].Cells[14].Value.ToString().Trim( ); button4.Enabled = true; button2.Enabled = true; } private void button4_Click(object sender, EventArgs e) { tableLayoutPanel1.Visible = true; label19.Visible = true; button5.Visible = true; button6.Visible = true; label2.Visible = false; label4.Visible = false; button4.Visible = false; button3.Visible = false; button2.Visible = false;
button1.Visible = false; dataGridView1.Visible = false; label1.Visible = false; label3.Visible = false; label5.Visible = false; label6.Visible = false; label7.Visible = false; label8.Visible = false; comboBox1.Visible = false; comboBox2.Visible = false; comboBox3.Visible = false; textBox1.Visible = false; textBox2.Visible = false; textBox3.Visible = false; } private void button6_Click(object sender, EventArgs e) { CustomerDetails n = new CustomerDetails(); n.Show(); this.Hide(); } private void button5_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; DialogResult man = printDialog1.ShowDialog(); if (man == DialogResult.OK) printDocument1.Print(); } private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) {
//e.Graphics.DrawString(textBox4.Text,new Font("Arial", 40, FontStyle.Bold), Brushes.Black, 150, 125); } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { if ((comboBox1.Text.Length == 0) && (textBox1.Text.Length == 0)) { MessageBox.Show("All boxes must be filled."); } else { if (comboBox1.Text == "Customer ID") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from booking where id ='" + textBox1.Text.Trim() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds, "booking"); dataGridView1.DataSource = ds.Tables["booking"]; } else if (comboBox1.Text.Trim() == "Customer Name")
{ string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString; cn1.Open(); SqlDataAdapter da1 = new SqlDataAdapter("select * from booking where names ='" + textBox1.Text.Trim() + "'", cn1); DataSet ds1 = new DataSet(); da1.Fill(ds1, "booking"); dataGridView1.DataSource = ds1.Tables["booking"]; } else { MessageBox.Show("Please enter those written in combo box !"); } } } } } }
namespace Login_Form2 { public partial class Booking : Form { DataTable dt; DataRow dr; string code; public Booking() { InitializeComponent(); } private void label2_Click(object sender, EventArgs e) { } private void label1_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) {
} private void label4_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void label6_Click(object sender, EventArgs e) { } private void textBox4_TextChanged(object sender, EventArgs e) { } private void textBox5_TextChanged(object sender, EventArgs e) { } private void label14_Click(object sender, EventArgs e) { }
private void checkBox6_CheckedChanged(object sender, EventArgs e) { } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { } private void button3_Click(object sender, EventArgs e) { if (addClass.user == "MANAGER") { manager r = new manager(); this.Hide(); r.Show(); } if (addClass.user == "STAFF") { staffhome g = new staffhome(); g.Show(); this.Hide(); } } private void textBox6_TextChanged(object sender, EventArgs e) { } private void textBox8_TextChanged(object sender, EventArgs e) {
} private void button1_Click(object sender, EventArgs e) { string ch = textBox9.Text.Substring(0, 1); // MessageBox.Show(ch); if (textBox1.Text.Length == 0 || textBox9.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || textBox7.Text.Length == 0 || textBox10.Text.Length == 0) { MessageBox.Show("All boxes must be filled."); } else { if (ch == "L") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from luxary", cn); DataSet ds = new DataSet(); da.Fill(ds, "luxary"); SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["luxary"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text;
dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; //dr[14] = textBox8.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da.Update(ds, "luxary"); cn.Close(); string connectionString1 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString1; cn1.Open(); SqlDataAdapter da1 = new SqlDataAdapter("select * from booking", cn); DataSet ds1 = new DataSet(); da1.Fill(ds1, "booking"); SqlCommandBuilder sc = new SqlCommandBuilder(da1);
dt = ds1.Tables["booking"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text; dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; // dr[14] = textBox8.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da1.Update(ds1, "booking"); cn1.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString2; cn2.Open();
SqlDataAdapter da2 = new SqlDataAdapter("Select * From l_available", cn2); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "l_available"); da2.Fill(ds2, "l_available"); string code2; code2 = textBox9.Text.Trim(); dr = ds2.Tables["l_available"].Rows.Find(code2); dr.BeginEdit(); dr[0] = textBox9.Text; dr[1] = comboBox4.Text; dr.EndEdit(); da2.Update(ds2, "l_available"); MessageBox.Show("Saved Sucessfully."); Staff zzz = new Staff(); zzz.Show(); } else if (ch == "P") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from presidential", cn); DataSet ds = new DataSet(); da.Fill(ds, "presidential"); SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["presidential"]; dr = dt.NewRow();
dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text; dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; //dr[14] = textBox8.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da.Update(ds, "presidential"); cn.Close(); string connectionString1 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString1; cn1.Open(); SqlDataAdapter da1 = new SqlDataAdapter("select * from booking", cn); DataSet ds1 = new DataSet();
da1.Fill(ds1, "booking"); SqlCommandBuilder sc = new SqlCommandBuilder(da1); dt = ds1.Tables["booking"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text; dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; //dr[14] = textBox8.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da1.Update(ds1, "booking"); cn1.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn2 = new SqlConnection();
cn2.ConnectionString = connectionString2; cn2.Open(); SqlDataAdapter da2 = new SqlDataAdapter("Select * From p_available", cn2); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "p_available"); da2.Fill(ds2, "p_available"); string code2; code2 = textBox9.Text.Trim(); dr = ds2.Tables["p_available"].Rows.Find(code2); dr.BeginEdit(); dr[0] = textBox9.Text; dr[1] = comboBox4.Text; dr.EndEdit(); da2.Update(ds2, "p_available"); MessageBox.Show("Saved Sucessfully."); Staff zzz = new Staff(); zzz.Show(); } else if (ch == "E") { string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from executive", cn); DataSet ds = new DataSet(); da.Fill(ds, "executive");
SqlCommandBuilder scb = new SqlCommandBuilder(da); dt = ds.Tables["executive"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text; dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; // dr[14] = textBox8.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da.Update(ds, "executive"); cn.Close(); string connectionString1 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn1 = new SqlConnection(); cn1.ConnectionString = connectionString1;
cn1.Open(); SqlDataAdapter da1 = new SqlDataAdapter("select * from booking", cn); DataSet ds1 = new DataSet(); da1.Fill(ds1, "booking"); SqlCommandBuilder sc = new SqlCommandBuilder(da1); dt = ds1.Tables["booking"]; dr = dt.NewRow(); dr[0] = textBox1.Text; dr[1] = textBox10.Text; dr[2] = textBox2.Text; dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = comboBox1.SelectedItem; if (radioButton1.Checked == true) { dr[6] = (radioButton1.Text); } if (radioButton2.Checked == true) { dr[6] = (radioButton2.Text); } dr[7] = textBox5.Text; dr[8] = textBox6.Text; dr[9] = comboBox2.SelectedItem; dr[10] = textBox9.Text; dr[11] = dateTimePicker1.Text; dr[12] = dateTimePicker2.Text; dr[13] = textBox7.Text; dr[14] = comboBox3.SelectedItem; dr[15] = comboBox4.SelectedItem; dr[16] = textBox11.Text; dr[17] = textBox8.Text; dt.Rows.Add(dr); da1.Update(ds1, "booking"); cn1.Close(); string connectionString2 = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh";
SqlConnection cn2 = new SqlConnection(); cn2.ConnectionString = connectionString2; cn2.Open(); SqlDataAdapter da2 = new SqlDataAdapter("Select * From e_available", cn2); SqlCommandBuilder cmdbuilder = new SqlCommandBuilder(da2); DataSet ds2 = new DataSet(); da2.FillSchema(ds2, SchemaType.Source, "e_available"); da2.Fill(ds2, "e_available"); string code2; code2 = textBox9.Text.Trim(); dr = ds2.Tables["e_available"].Rows.Find(code2); dr.BeginEdit(); dr[0] = textBox9.Text; dr[1] = comboBox4.Text; dr.EndEdit(); da2.Update(ds2, "e_available"); MessageBox.Show("Saved Sucessfully."); Staff zzz = new Staff(); zzz.Show(); } } } private void button2_Click(object sender, EventArgs e) { } private void Booking_Load(object sender, EventArgs e) { textBox9.Text = Room.roominfo;
string connectionString = "Data Source=.;Initial Catalog=project;User id=sa;Password=kankarbagh"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = connectionString; cn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from booking", cn); DataSet ds = new DataSet(); da.Fill(ds, "booking"); int ctr, len; string codeval; dt = ds.Tables["booking"]; len = dt.Rows.Count - 1; dr = dt.Rows[len]; code = dr["ID"].ToString(); codeval = code.Substring(1, 3); ctr = Convert.ToInt32(codeval); if ((ctr >= 1) && (ctr < 9)) { ctr = ctr + 1; textBox10.Text = "C00" + ctr.ToString(); } else if ((ctr >= 99) && (ctr < 99)) { ctr = ctr + 1; textBox10.Text = "C0" + ctr.ToString(); } else if (ctr >= 99) { ctr = ctr + 1; textBox10.Text = "C" + ctr.ToString(); } textBox10.Enabled = false; } private void textBox5_KeyPress(object sender, KeyPressEventArgs e) {
const char delete=(char)8; e.Handled=!char.IsDigit(e.KeyChar)&&e.KeyChar!=delete; } private void textBox11_KeyPress(object sender, KeyPressEventArgs e) { const char Delete = (char)8; e.Handled = !Char.IsDigit(e.KeyChar) && e.KeyChar != Delete; } } }