public static Booking Booking(System.Data.IDataReader reader) { Booking result = null; if (null != reader && reader.Read()) { result = new Booking(); PopulateBooking(result, reader); } return result; }
public Booking GetSavedBooking() { Room selectedRoom = uiRoom.SelectedItem as Room; Booking newItem = new Booking(); newItem.SiteId = selectedRoom.SiteId; newItem.SiteName = ucSitePicker.SiteDisplayName; newItem.RoomId = selectedRoom.RoomId; newItem.RoomName = selectedRoom.RoomName; newItem.BookingStatus = BookingStatus.New.ToString(); newItem.BookingStatusId = (int)BookingStatus.New; newItem.RoomPrice = newItem.TotalPrice = newItem.ContractTotalPrice = uiRoomPrice.Value.HasValue ? Convert.ToDecimal(uiRoomPrice.Value.Value) : 0; newItem.Description = uiDescription.Text; newItem.BookDate = DateTime.Now; newItem.ContractDateStart = uiDateFrom.SelectedDate; newItem.ContractDateEnd = uiDateTo.SelectedDate; newItem.BookingEquipments = new List<BookingRoomEquipment>(); newItem.BookingServices = new List<BookingRoomService>(); Customer customer = ucCustomerDetails.CustomerItem; if (customer != null) { newItem.CustomerItem = customer; newItem.CustomerId = customer.CustomerId; newItem.CustomerName = customer.FullName; } Customer customer2 = ucCustomerDetails2.CustomerItem; if (customer2 != null && !string.IsNullOrEmpty(customer2.FullName.Trim())) { newItem.CustomerItem2 = customer2; newItem.Customer2Id = customer2.CustomerId; newItem.Customer2Name = customer2.FullName; } newItem.IsChanged = true; return newItem; }
public static void PopulateBooking(Booking input, System.Data.IDataReader reader) { PopulateRecord(input, reader); input.RecordId = input.BookingId = Utilities.ToInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.BookingId]); input.SiteId = Utilities.ToInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.SiteId]); input.SiteName = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.SiteName]); input.RoomId = Utilities.ToInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.RoomId]); input.RoomName = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.RoomName]); input.CustomerId = Utilities.ToInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.CustomerId]); input.FirstName = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.FirstName]); input.LastName = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.LastName]); input.CustomerName = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.CustomerName]); input.Customer2Id = Utilities.ToNInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.Customer2Id]); input.Customer2Name = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.Customer2Name]); input.BookDate = Utilities.ToDateTime(reader[Mimosa.Apartment.Common.Booking.ColumnNames.BookDate]); input.BookingStatusId = Utilities.ToInt(reader[Mimosa.Apartment.Common.Booking.ColumnNames.BookingStatusId]); input.BookingStatus = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.BookingStatus]); input.Description = Utilities.ToString(reader[Mimosa.Apartment.Common.Booking.ColumnNames.Description]); input.RoomPrice = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.Booking.ColumnNames.RoomPrice]); input.TotalPrice = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.Booking.ColumnNames.TotalPrice]); input.ContractDateSign = Utilities.ToNDateTime(reader[Mimosa.Apartment.Common.Booking.ColumnNames.ContractDateSign]); input.ContractDateStart = Utilities.ToNDateTime(reader[Mimosa.Apartment.Common.Booking.ColumnNames.ContractDateStart]); input.ContractDateEnd = Utilities.ToNDateTime(reader[Mimosa.Apartment.Common.Booking.ColumnNames.ContractDateEnd]); input.RoomPrice = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.Booking.ColumnNames.RoomPrice]); input.RoomPrice = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.Booking.ColumnNames.RoomPrice]); input.ContractTotalPrice = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.Booking.ColumnNames.ContractTotalPrice]); }