public static RoomService RoomService(System.Data.IDataReader reader) { RoomService result = null; if (null != reader && reader.Read()) { result = new RoomService(); PopulateRoomService(result, reader); } return result; }
public static void PopulateRoomService(RoomService input, System.Data.IDataReader reader) { PopulateRecord(input, reader); input.RecordId = input.RoomServiceId = Utilities.ToInt(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.RoomServiceId]); input.RoomId = Utilities.ToInt(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.RoomId]); input.ServiceId = Utilities.ToInt(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.ServiceId]); input.Service = Utilities.ToString(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.Service]); input.Price = Utilities.ToNDecimal(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.Price]); input.Description = Utilities.ToString(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.Description]); input.Unit = Utilities.ToString(reader[Mimosa.Apartment.Common.RoomService.ColumnNames.Unit]); }
void btnInsertRoomService_Click(object sender, RoutedEventArgs e) { Service service = uiServiceList.SelectedItem as Service; if (service != null && _selectedRoomId > 0) { List<RoomService> list = (List<RoomService>)gvwRoomService.ItemsSource; if (list.Count(i => i.ServiceId == service.ServiceId) > 0) { MessageBox.Show(ResourceHelper.GetReourceValue("Common_ItemExist")); } else { RoomService newRoomService = new RoomService(); newRoomService.RoomId = _selectedRoomId; newRoomService.ServiceId = service.ServiceId; newRoomService.Service = service.Name; newRoomService.IsChanged = true; newRoomService.Unit = service.Unit; newRoomService.Price = service.Price; newRoomService.Description = service.Description; list.Add(newRoomService); gvwRoomService.ItemsSource = null; gvwRoomService.ItemsSource = list; } } }