Exemplo n.º 1
0
        void btnInsertBookingEquipment_Click(object sender, RoutedEventArgs e)
        {
            RoomEquipment equipment = uiEquipmentList.SelectedItem as RoomEquipment;

            if (equipment != null && _selectedBookingId > 0)
            {
                List <BookingRoomEquipment> list = (List <BookingRoomEquipment>)gvwBookingEquipment.ItemsSource;
                if (list.Count(i => i.EquipmentId == equipment.EquipmentId) > 0)
                {
                    MessageBox.Show(ResourceHelper.GetReourceValue("Common_ItemExist"));
                }
                else
                {
                    BookingRoomEquipment newBookingEquipment = new BookingRoomEquipment();
                    newBookingEquipment.BookingId   = _selectedBookingId;
                    newBookingEquipment.EquipmentId = equipment.EquipmentId;
                    newBookingEquipment.Equipment   = equipment.Equipment;
                    newBookingEquipment.IsChanged   = true;
                    newBookingEquipment.Price       = equipment.Price;
                    newBookingEquipment.Unit        = equipment.Unit;
                    newBookingEquipment.Description = equipment.Description;
                    list.Add(newBookingEquipment);
                    gvwBookingEquipment.ItemsSource = null;
                    gvwBookingEquipment.ItemsSource = list;
                }
            }
        }
Exemplo n.º 2
0
 void BookingEquipment_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName != "IsChanged")
     {
         BookingRoomEquipment item = (BookingRoomEquipment)sender;
         item.IsChanged = true;
     }
 }
Exemplo n.º 3
0
 void ListBookingRoomEquipmentCompleted(List <BookingRoomEquipment> equipments)
 {
     if (equipments != null && equipments.Count > 0)
     {
         _bookingRoomEquipmentItem = equipments[0];
         DataServiceHelper.ListBookingRoomEquipmentDetailAsync(null, this.BookingEquipmentId, null, null, null, ListBookingRoomEquipmentDetailCompleted);
     }
 }
Exemplo n.º 4
0
 void gvwBookingEquipment_Deleting(object sender, GridViewDeletingEventArgs e)
 {
     if (e.Items != null && e.Items.Count() > 0)
     {
         BookingRoomEquipment deleteItem = e.Items.First() as BookingRoomEquipment;
         if (deleteItem != null)
         {
             if (deleteItem.CanDelete)
             {
                 MessageBoxResult result = MessageBox.Show(ResourceHelper.GetReourceValue("Common_ConfirmDeleteNoParam"), ResourceHelper.GetReourceValue("Common_ConfirmationRequired"), MessageBoxButton.OKCancel);
                 if (result == MessageBoxResult.Cancel)
                 {
                     e.Cancel = true;
                 }
             }
             else
             {
                 MessageBoxResult result = MessageBox.Show(string.Format(ResourceHelper.GetReourceValue("Common_DeleteFailedBeingUsed"), deleteItem.Equipment),
                                                           ResourceHelper.GetReourceValue("Common_OperationFailed"), MessageBoxButton.OK);
                 e.Cancel = true;
             }
         }
     }
 }