public static List<CheckIn> loadCheckOutBillData(string sql) { List<CheckIn> list = new List<CheckIn>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(sql)) { if (reader.HasRows) { while (reader.Read()) { CheckIn checkIn = new CheckIn(); checkIn.RoomNumber = reader.GetString(0); checkIn.GuestName = reader.GetString(1); checkIn.Date = reader.GetDateTime(2); checkIn.IdentityCardNumber = reader.GetString(3); checkIn.Address = reader.GetString(4); checkIn.TelephoneNumber = reader.GetString(5); list.Add(checkIn); } } } return list; }
public static void addCheckIn(CheckIn checkIn) { SqlParameter[] pams = new SqlParameter[] { new SqlParameter ("@Id",checkIn.Id ), new SqlParameter ("@RoomNumber",checkIn .RoomNumber ), new SqlParameter ("@GuestName",checkIn.GuestName ), new SqlParameter ("@Date",checkIn.Date ), new SqlParameter ("@IdentityCardNumber",checkIn.IdentityCardNumber ), new SqlParameter ("@Address",checkIn.Address ), new SqlParameter ("@TelephoneNumber",checkIn.TelephoneNumber ), }; SqlHelper.ExecuteNonQuery(AddCheckInDAL.sql, pams); }
private void btAddGuest_Click(object sender, RoutedEventArgs e) { Guest guest = new Guest(); guest.Id = Guid.NewGuid(); guest.Name = tbName.Text; if (rbMan .IsChecked==true&&rbWoman .IsChecked ==false ) { guest .Sex ="男"; } else if (rbMan.IsChecked ==false &&rbWoman .IsChecked ==true ) { guest .Sex ="女"; } else { MessageBox .Show ("请选择性别!"); } guest.TelephoneNumber = tbTelephoneNumber.Text; guest.Address = tbAddress.Text; guest.IdentityCardNumber = tbIdentityCardNumber.Text ; AddGuestBLL.addGuest(guest); CheckIn checkIn = new CheckIn(); checkIn.Id = Guid.NewGuid(); checkIn.RoomNumber = MainWondows.SelectRoomNumber; checkIn.GuestName = guest.Name; checkIn.Date = System.DateTime.Now; checkIn.IdentityCardNumber = guest.IdentityCardNumber; checkIn.Address = guest.Address; checkIn.TelephoneNumber = guest.TelephoneNumber; AddCheckInBLL.addCheckIn(checkIn); tbAddress.Text = ""; tbIdentityCardNumber.Text = ""; tbName.Text = ""; tbTelephoneNumber.Text = ""; NumberOfPeaple++; if (NumberOfPeaple ==1) { FirstGuestId = guest.Id; }; lbNumberOfPeaple.Content = NumberOfPeaple; }
public static void addCheckIn(CheckIn checkIn) { AddCheckInDAL.addCheckIn(checkIn); }