Ad

Tuesday, February 2, 2016

A Project On Hotel Management System using .net, Visual Studio, Sql Server for Beginners - by Vikash Chandra Das



PROJECT ON
Royal Hotel Management

HARDWARE AND SOFTWARE REQUIREMENTS


System Summary
The objective of this project or software is to provide a computerized system for the hotel management, the effort to design a user friendly, efficient and automated system that will be helpful to reduce tedious manual work. I have adopted a style that will be helpful to a user who may not be a computer professional to operate it or don’t knows the SQL queries to manage data.

The assigned project of mine is “Royal Hotel Management”. Which Management System is under construction. This is mainly based on the functionality on the log in page to validate user credentials and provide the user with appropriate features and functionality. Only the Housekeeping menu option is enabled and other menu options or the services are disabled. The functionality on the House Keeping form to view the cleaning status report containing the room number, floor number, status, and assigned to columns and the functionality of the house keeping page to update the cleaning status of the hotel rooms.

The other functionality of this project is to manage the employees form to manage the employee details like addition, updation, and deletion of employee records and allow user to search employee details, such as name, designation, address, telephone, fax, e-mail, and ID.

The house keeping department also allows the user to store the data as Extensible Markup Language (XML) or text file for the hotel staff and shows the report which is the Crystal Report is vied in a form for the print of the report.
The forms and the database file which contains the database tables are created by using Visual Studio 2005 and SQL Server 2005. The coding part of the application is done by the VC# (Visual C#) programming language.

Details below for Hardware, Software & Operating System are not minimum requirements for the project. The Project is made using these systems.


 Hardware
  • C.P.U(Central Processing Unit)   : I7
  • Co-Processor                                : Processor 3.40GHz
  • RAM(Random Access Memory) : 8GB
  • Cache memory                             : 256KB
  • Mother Board                               : Intel Chipset
  • Monitor                                         : LED
  • Keyboard                                      : PS2
  • Mouse                                           : Optical
  • Hard Disk                                     : 40 GB                           
  • Printer                                           : Inkjet
Operating system
  •  Widows 8
Software used
  • Visual Studio 2012
  • SQL Server 2012
  • MS Office 2010
  • MS Paint


SQL Queeries

create database hotel_Royal
use hotel_Royal

---------------------------------------------------------------------------

create table logininfo
(
user_name varchar(22),
password varchar(22)primary key,
user_type varchar(22)
)
go
insert into logininfo values('vikash','vikash','Manager')
insert into logininfo values('akash','room','Assistant Manager')

select * from logininfo

---------------------------------------------------------------------------

CREATE TABLE HouseKeeping
(
FloorNo int,
RoomNo int primary key,
Status varchar(25) ,
AssignedTo varchar(25),
    )

INSERT INTO HouseKeeping VALUES ('9','170','Cleaned','Macky')
INSERT INTO HouseKeeping VALUES ('3','235','NotCleaned','Shenry')
INSERT INTO HouseKeeping VALUES ('9','170','Cleaned','Harry')
INSERT INTO HouseKeeping VALUES ('5','235','NotCleaned','Mackew')
INSERT INTO HouseKeeping VALUES ('1','146','Cleaned','Jack')
INSERT INTO HouseKeeping VALUES ('2','278','NotCleaned','Tom')
INSERT INTO HouseKeeping VALUES ('8','204','Cleaned','Steev')
INSERT INTO HouseKeeping VALUES ('4','245','NotCleaned','Dick')
INSERT INTO HouseKeeping VALUES ('9','134','Cleaned','Thomas')
INSERT INTO HouseKeeping VALUES ('6','223','NotCleaned','Nelson')
INSERT INTO HouseKeeping VALUES ('3','133','Cleaned','Mickle')
INSERT INTO HouseKeeping VALUES ('1','231','NotCleaned','Jackson')

select * from HouseKeeping

-----------------------------------------------------------------------------

CREATE TABLE EmployeesDetails
(
      Name varchar(25),
      Designation varchar(25),
      Address varchar(25),
      Telephone varchar(10),
     Fax varchar(20),
      EMail varchar(25),
      ID varchar(11)
)

INSERT INTO EmployeesDetails VALUES ('Kim','Assistant Manager','California','9431300000','2480000','kim@rediff.com','p001')
INSERT INTO EmployeesDetails VALUES ('Adachi','Front Desk Manager','California','9537289212','250000','adachi@rediff.com','p002')
     
select * from EmployeesDetails

-----------------------------------------------------------------------------



create table FrontDesk
(
confno int ,
roomno int,
check_in_date int,
check_out_date int,
price int,
Days_of_stays int,
roomcatagory varchar(22),
description varchar(22),
)
insert into FrontDesk values(001,101,1-1-2000,12-4-2000,$300,2,'presidential_suite','sea_side')
insert into FrontDesk values(002,102,11-3-2000,12-6-2000,$300,2,'presidential_suite','scenery_side')
insert into FrontDesk values(003,103,14-3-2000,11-7-2000,$650,2,'executive_suite','sea_side')
insert into FrontDesk values(004,104,17-4-2000,15-7-2000,$650,2,'executive_suite','sea_side')
insert into FrontDesk values(005,105,22-4-2000,19-8-2000,$1000,2,'luxury_suite','gateway_of_india_side')
insert into FrontDesk values(006,106,31-4-2000,22-8-2000,$1000,2,'luxury_suite','scnery_side')
insert into FrontDesk values(007,107,10-5-2000,22-9-2000,$1200,2,'luxury_suite','sea_side')
insert into FrontDesk values(008,108,23-5-2000,28-9-2000,$1200,2,'executive_suite','sea_side')
insert into FrontDesk values(009,109,29-5-2000,1-10-2000,$300,2,'presidential_suite','gateway_of_india_side')
insert into FrontDesk values(110,110,11-6-2000,19-10-2000,$300,2,'presidential_suite','sea_side')
insert into FrontDeske values(111,111,25-6-2000,27-11-2000,$4000,2,'luxury_suite','sea_side')
insert into FrontDesk values(112,112,7-7-2000,19-11-2000,$650,2,'executive_suite','scnery_side')

select * from FrontDesk

-----------------------------------------------------------------------------


LogIn Form                                                             
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Hotel_Management_System
{
    public partial class LogIn : Form
    {
        public LogIn()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnLogini_Click(object sender, EventArgs e)
        {
            label1.Show();
            label2.Show();
            label3.Show();
            label4.Hide();
            button2.Hide();
            btnLogIn.Show();
            button3.Show();
            pictureBox2.Show();
            pictureBox3.Hide();
            textBox1.Show();
            textBox2.Show();
            comboBox1.Show();
        }

        private void btnLogIn_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string password = textBox2.Text;
            string usertype = comboBox1.Text;
            SqlConnection con = new SqlConnection();
            con.ConnectionString = "Data Source= .;Initial Catalog = hotel_taj; User Id= sa; Password = p@ssw0rd";
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from logininfo where user_name='" + username + "' and password='" + password + "' and user_type='" + usertype + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if ((textBox1.Text.Length == 0) || (textBox2.Text.Length == 0) || (comboBox1.Text.Length == 0))
            {
                MessageBox.Show("Please enter all the details");
            }
            else if (dr.Read() == true)
            {
                Main f1 = new Main();
                f1.Show();
                Welcome f2 = new Welcome();
                f2.Show();
                this.Hide();
                MessageBox.Show("The Hotel Management System is under construction");
            }
        }
     }
}


Welcome Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Data.SqlClient;
using System.Xml.Schema;

namespace Hotel_Management_System
{
    public partial class Welcome : Form
    {
        public Welcome()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
           this.Close();
        }

        private void btnMaini_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnHome_Click(object sender, EventArgs e)
        {
            process1.Start();
        }

        private void btnMain_Click(object sender, EventArgs e)
        {
            btnMaini.Show();
            btnHome.Show();
            btnHelpTopics.Hide();
            btnAboutUs.Hide();
            btnReportCrystal.Hide();
            btnReportXml.Hide();
        }

        private void btnHelp_Click(object sender, EventArgs e)
        {
            btnMaini.Hide();
            btnHome.Hide();
            btnHelpTopics.Show();
            btnAboutUs.Show();
            btnReportCrystal.Hide();
            btnReportXml.Hide();
        }

        private void btnReport_Click(object sender, EventArgs e)
        {
            btnMaini.Hide();
            btnHome.Hide();
            btnHelpTopics.Hide();
            btnAboutUs.Hide();
            btnReportCrystal.Show();
            btnReportXml.Show();
        }

        private void btnReportCrystal_Click(object sender, EventArgs e)
        {
            Report f1 = new Report();
            f1.Show();
            this.Close();
        }
        string connectionString = "Data Source =.; Initial Catalog=hotel_taj; User Id=sa; Password=p@ssw0rd";

        private void btnReportXml_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection();
            connection.ConnectionString = connectionString;
            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter("Select * from HouseKeeping", connection);
            DataSet dataset = new DataSet();
            adapter.Fill(dataset, "HouseKeeping");
            dataset.WriteXml("C:\\Housekeeping.xml");
            process2.Start();
            MessageBox.Show("XML file Created");
            connection.Close();
        }

        private void btnHelpTopics_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This is not available due to under construction");
        }

        private void btnAboutUs_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This is not available due to under construction");
        }
    }
}  



Main(Royal Hotel Management System) Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Hotel_Management_System
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }

        private void frontDeskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide();
            Front_Desk f1 = new Front_Desk();
            f1.MdiParent = this;
            f1.Show();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void employeeDetailsToolStripMenuItem_Click(object sender, EventArgs e)
        {

            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide(); Employee_Details f2 = new Employee_Details();
            f2.MdiParent = this;
            f2.Show();
        }

     private void houseKeepingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide();
            House_Keeping f3 = new House_Keeping();
            f3.MdiParent = this;
            f3.Show();
        }

    private void miscellaneousOperatingDepartmentsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("The Hotel Management System is Under Construction");
        }

      private void foodAndBeveragesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("The Hotel Management System is Under Construction");
        }

      private void roomServiceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("The Hotel Management System is Under Construction");
        }

      private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Welcome w = new Welcome();
            w.Show();
        }

      private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            pictureBox1.Show();
            pictureBox2.Show();
            pictureBox3.Show();
            pictureBox4.Show();
            pictureBox5.Show();
            pictureBox6.Show();
            pictureBox7.Show();
            pictureBox8.Show();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide();
        }

       private void image2ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Show();
            pictureBox10.Show();
            pictureBox11.Show();
            pictureBox12.Show();
            pictureBox13.Show();
            pictureBox14.Show();
            pictureBox15.Show();
            pictureBox16.Show();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide();
        }

       private void image3ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Show();
            pictureBox18.Show();
            pictureBox19.Show();
            pictureBox20.Show();
            pictureBox21.Show();
            pictureBox22.Show();
            pictureBox23.Show();
            pictureBox24.Show();
        }

      private void toolStripMenuItem9_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileVertical);
        }

      private void toolStripMenuItem6_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileHorizontal);
        }

      private void toolStripMenuItem5_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.Cascade);
        }

      private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.ArrangeIcons);
        }

      private void toolStripMenuItem10_Click(object sender, EventArgs e)
        {
            pictureBox1.Hide();
            pictureBox2.Hide();
            pictureBox3.Hide();
            pictureBox4.Hide();
            pictureBox5.Hide();
            pictureBox6.Hide();
            pictureBox7.Hide();
            pictureBox8.Hide();
            pictureBox9.Hide();
            pictureBox10.Hide();
            pictureBox11.Hide();
            pictureBox12.Hide();
            pictureBox13.Hide();
            pictureBox14.Hide();
            pictureBox15.Hide();
            pictureBox16.Hide();
            pictureBox17.Hide();
            pictureBox18.Hide();
            pictureBox19.Hide();
            pictureBox20.Hide();
            pictureBox21.Hide();
            pictureBox22.Hide();
            pictureBox23.Hide();
            pictureBox24.Hide();
        }

      private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            Welcome wel = new Welcome();
            wel.Show();
        }

      private void toolStripMenuItem8_Click(object sender, EventArgs e)
        {
            Welcome wec = new Welcome();
            wec.Show();
        }

        private void toolStripMenuItem11_Click(object sender, EventArgs
        {
            Search_Employee_Details se = new Search_Employee_Details();
            se.MdiParent = this;
            se.Show();
        }

      private void toolStripButton1_Click(object sender, EventArgs e)
        {
            process1.Start();
        }

      private void toolStripButton2_Click(object sender, EventArgs e)
        {
            process2.Start();
        }

      private void Main_Load(object sender, EventArgs e)
        {

        }
    }
}               



House Keeping Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Hotel_Management_System
{
    public partial class House_Keeping : Form
    {
        DataTable dt;
        DataRow dr;
        public House_Keeping()
        {
            InitializeComponent();
        }

        private void House_Keeping_Load(object sender, EventArgs e)
        {

            // TODO: This line of code loads data into the 'hotel_tajDataSet1.HouseKeeping' table. You can move, or remove it, as needed.
            this.houseKeepingTableAdapter.Fill(this.hotel_tajDataSet1.HouseKeeping);
            houseKeepingChildFrmMenuItem.MergeAction = MergeAction.MatchOnly;

            this.houseKeepingTableAdapter.Fill(this.hotel_tajDataSet1.HouseKeeping);
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = false;
            btnSave.Enabled = false;
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            btnSave.Enabled = true;
            textBox1.Enabled = true;
            textBox2.Enabled = true;
            textBox3.Enabled = true;
            textBox4.Enabled = true;
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            btnAdd.Enabled = false;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            dt = hotel_tajDataSet1.Tables["HouseKeeping"];
            dr = dt.NewRow();
            dr[0] = textBox1.Text;
            dr[1] = textBox2.Text;
            dr[2] = textBox3.Text;
            dr[3] = textBox4.Text;
            dt.Rows.Add(dr);
            houseKeepingTableAdapter.Update(hotel_tajDataSet1);
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = false;
            this.houseKeepingTableAdapter.Fill(this.hotel_tajDataSet1.HouseKeeping);
            btnAdd.Enabled = true;
            btnSave.Enabled = false;
            MessageBox.Show("Data Saved");

        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            String code;
            code = textBox5.Text;
            string connectionstring = "Data Source= .;Initial Catalog = hotel_taj; User Id= sa; Password = p@ssw0rd";
            SqlConnection con = new SqlConnection(connectionstring);
            con.Open();
            SqlCommand cmd = new SqlCommand("Delete HouseKeeping where RoomNo = '"+ code +"'",con);
            cmd.ExecuteNonQuery();
            MessageBox.Show("Data Deleted");
        }
    }
}


Employee Details Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Hotel_Management_System
{
    public partial class Employee_Details : Form
    {
        DataTable dt;
        DataRow dr;
        //string code;
        public Employee_Details()
        {
            InitializeComponent();
        }

        private void Employee_Details_Load(object sender, EventArgs e)
        {
             //TODO: This line of code loads data into the 'hotel_tajDataSet2.EmployeesDetails' table. You can move, or remove it, as needed.
            this.employeesDetailsTableAdapter.Fill(this.hotel_tajDataSet2.EmployeesDetails);
            employeeDetailsChildFrmMenuItem.MergeAction = MergeAction.MatchOnly;
            this.employeesDetailsTableAdapter.Fill(this.hotel_tajDataSet2.EmployeesDetails);
            textBox1.Enabled = false;
            comboBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox6.Enabled = false;
            textBox5.Enabled = false;
            textBox4.Enabled = false;
            textBox3.Enabled = false;
            btnSave.Enabled = false;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            btnSave.Enabled = true;
            textBox1.Enabled = true;
            comboBox1.Enabled = true;
            textBox2.Enabled = true;
            textBox6.Enabled = true;
            textBox5.Enabled = true;
            textBox4.Enabled = true;
            textBox3.Enabled = true;
            textBox1.Text = "";
            comboBox1.Text = "";
            textBox2.Text = "";
            textBox6.Text = "";
            textBox5.Text = "";
            textBox4.Text = "";
            textBox3.Text = "";
            btnAdd.Enabled = false;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
        dt = hotel_tajDataSet2.Tables["EmployeesDetails"];
            dr = dt.NewRow();
            dr[0] = textBox1.Text;
            dr[1] = comboBox1.Text;
            dr[2] = textBox2.Text;
            dr[3] = textBox6.Text;
            dr[4] = textBox5.Text;
            dr[5] = textBox4.Text;
            dr[6] = textBox3.Text;
            dt.Rows.Add(dr);
            employeesDetailsTableAdapter.Update(hotel_tajDataSet2);
            textBox1.Enabled = false;
            comboBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox6.Enabled = false;
            textBox5.Enabled = false;
            textBox4.Enabled = false;
            textBox3.Enabled = false;
            this.employeesDetailsTableAdapter.Fill(this.hotel_tajDataSet2.EmployeesDetails);
            btnAdd.Enabled = true;
            btnSave.Enabled = false;
            MessageBox.Show("Data Updated");

        }

      

 private void btnDelete_Click(object sender, EventArgs e)
        {
        String code;
            code = textBox7.Text;
            string connectionstring = "Data Source= .;Initial Catalog = hotel_taj; User Id= sa; Password = p@ssw0rd";
            SqlConnection con = new SqlConnection(connectionstring);
            con.Open();
            SqlCommand cmd = new SqlCommand("Delete EmployeesDetails where ID = '"+ code +"'",con);
            cmd.ExecuteNonQuery();
            MessageBox.Show("Data Deleted");
        }
        }

    }

Search Employee Details Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Hotel_Management_System
{
    public partial class Search_Employee_Details : Form
    {
        public Search_Employee_Details()
        {
            InitializeComponent();
        }

        private void btnShow_Click(object sender, EventArgs e)
        {
           try
            {
                string search = textBox3.Text;
                SqlConnection con = new SqlConnection();
                con.ConnectionString = "Data Source= .;Initial Catalog = hotel_taj; User Id= sa; Password = p@ssw0rd";
                con.Open();
                SqlCommand cmd = new SqlCommand("SELECT Name,Designation,Address,Telephone,Fax,EMail,ID from EmployeesDetails WHERE ID like '" + search + "%'", con);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    textBox1.Text = Convert.ToString(dr[0]);
                    comboBox1.Text = Convert.ToString(dr[1]);
                    textBox2.Text = Convert.ToString(dr[2]);
                    textBox6.Text = Convert.ToString(dr[3]);
                    textBox5.Text = Convert.ToString(dr[4]);
                    textBox4.Text = Convert.ToString(dr[5]);
                    textBox3.Text = Convert.ToString(dr[6]);
                 }
               
                dr.Close();
                con.Close();
                {
                }
            }
                catch(SqlException E1)
            {
              MessageBox.Show(Convert.ToString(E1));
            }
        }
          
       

        private void Search_Employee_Details_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'hotel_tajDataSet2.EmployeesDetails' table. You can move, or remove it, as needed.
            this.employeesDetailsTableAdapter.Fill(this.hotel_tajDataSet2.EmployeesDetails);
            fileToolStripMenuItem.MergeAction = MergeAction.MatchOnly;

        }
    }
}





Front Desk Form(Disabled)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Hotel_Management_System
{
    public partial class Front_Desk : Form
    {
        public Front_Desk()
        {
            InitializeComponent();
        }

        private void Fromt_Desk_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'hotel_tajDataSet5.FrontDesk' table. You can move, or remove it, as needed.
            this.frontDeskTableAdapter1.Fill(this.hotel_tajDataSet5.FrontDesk);
        frontDeskChildFrmMenuItem.MergeAction = MergeAction.MatchOnly;
        }
    }
}



Report(Coding is in LogIn Form)



Crystal Report


Saved as Xml File
        private void btnReportXml_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection();
            connection.ConnectionString = connectionString;
            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter("Select * from HouseKeeping", connection);
            DataSet dataset = new DataSet();
            adapter.Fill(dataset, "HouseKeeping");
            dataset.WriteXml("C:\\Housekeeping.xml");
            process2.Start();
            MessageBox.Show("XML file Created");
            connection.Close();
        }

VIkash Chandra Das
Rourkela
Odisha

No comments:

Post a Comment