Пример #1
0
 private void BtnDone_Click(object sender, EventArgs e)
 {
     if (btnDone.Text == "Done")
     {
         AddItem();
         ReadAllData();
         clearTextbox();
     }
     else
     {
         Customer_ info = new Customer_();
         info.name = txtFirstName.Text + " " + txtLastName.Text;
         if (btnMale.Checked == true)
         {
             info.gender = "Male";
         }
         else
         {
             info.gender = "Female";
         }
         info.country  = txtCountry.Text;
         info.phone    = txtPhone.Text;
         info.id       = txtID.Text;
         info.room     = txtRoom.Text;
         info.checkin  = txtCheckIn.Text;
         info.checkout = txtCheckOut.Text;
         info.staff    = staff_name;
         info.connect();
         info.updateList();
         btnOff();
         ReadAllData();
         clearTextbox();
     }
 }
Пример #2
0
        public void ReadAllData()
        {
            if (refreshCIO != null)
            {
                refreshCIO(null, null);
            }
            lstCustomer.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 tblCustomer.* , tblRoom.price from tblCustomer INNER JOIN tblRoom ON tblRoom.roomnum=tblCustomer.roomnum ";
            SqlDataReader dr = cm.ExecuteReader();

            while (dr.Read())
            {
                Customer_ info = new Customer_();
                info.name    = dr[0].ToString();
                info.gender  = dr[1].ToString();
                info.country = dr[2].ToString();
                info.id      = dr[3].ToString();
                info.phone   = dr[4].ToString();

                info.room      = dr[5].ToString();
                info.checkin   = dr[6].ToString();
                info.checkout  = dr[7].ToString();
                info.unitprice = dr[10].ToString();
                info.total     = dr[8].ToString();
                info.staff     = dr[9].ToString();;
                info.AddToList(lstCustomer);
            }
        }
Пример #3
0
        public void AddItem()
        {
            Customer_ info = new Customer_();

            info.name = txtFirstName.Text + " " + txtLastName.Text;
            if (btnMale.Checked == true)
            {
                info.gender = "Male";
            }
            else
            {
                info.gender = "Female";
            }
            info.country  = txtCountry.Text;
            info.phone    = txtPhone.Text;
            info.id       = txtID.Text;
            info.room     = txtRoom.Text;
            info.checkin  = txtCheckIn.Text;
            info.checkout = txtCheckOut.Text;
            info.staff    = staff_name;
            info.connect();
            info.update();
        }