Beispiel #1
0
        public void CheckIn()
        {
            if (lstCheckInCheckOut.SelectedItems != null)
            {
                ListViewItem item = lstCheckInCheckOut.SelectedItems[0];

                CheckInCheckOut info = new CheckInCheckOut();
                info.floor      = item.SubItems[0].Text;
                info.roomnumber = item.SubItems[1].Text;
                room_number     = item.SubItems[1].Text;
                addCheckDate();
                info.type      = item.SubItems[2].Text;
                info.price     = item.SubItems[3].Text;
                info.checkin   = checkin;
                info.checkout  = checkout;
                info.available = "NO";
                double Uprice = double.Parse(item.SubItems[3].Text);
                info.total = Uprice * diff + "$";
                info.connect();
                info.update();
                info.connect();
                info.addToCustomer();
            }
            ReadAllData();
            //MessageBox.Show("Done");
        }
Beispiel #2
0
 public void CheckOut()
 {
     try
     {
         if (lstCheckInCheckOut.SelectedItems != null)
         {
             ListViewItem    item = lstCheckInCheckOut.SelectedItems[0];
             CheckInCheckOut info = new CheckInCheckOut();
             info.roomnumber = item.SubItems[1].Text;
             info.available  = "YES";
             info.connect();
             info.update();
         }
     }
     catch (Exception) { }
     ReadAllData();
 }
Beispiel #3
0
        public void ReadAllData()
        {
            lstCheckInCheckOut.Items.Clear();
            SqlConnection con = new SqlConnection("Data Source=Rofat;Initial Catalog=hotel;Integrated Security=True");

            con.Open();
            SqlCommand cm = new SqlCommand();

            cm.Connection  = con;
            cm.CommandText = "SELECT tblRoom.floor, tblCheckinout.roomnum, tblRoom.type, tblRoom.price, tblCheckinout.available FROM tblRoom INNER JOIN tblCheckinout ON tblRoom.roomnum=tblCheckinout.roomnum";
            SqlDataReader dr = cm.ExecuteReader();

            while (dr.Read())
            {
                CheckInCheckOut info = new CheckInCheckOut();
                info.floor      = dr[0].ToString();
                info.roomnumber = dr[1].ToString();
                info.type       = dr[2].ToString();
                info.price      = dr[3].ToString();
                info.available  = dr[4].ToString();
                info.AddToList(lstCheckInCheckOut);
            }
        }