Exemplo n.º 1
0
        public void DeletOrderItem(OrderItemListView orderItem)
        {
            int index = this.OrderItems.IndexOf(orderItem);

            this.OrderItems[index].ItemDeleteClicked -= this.HandleItemDeleted;
            this.OrderItems.RemoveAt(index);
            orderItem.Dispose();
            RaisePropertyChanged("IsProceedEnabled");
        }
Exemplo n.º 2
0
 private void HandleCellEditEnded(DataGridCellEditEndingEventArgs obj)
 {
     if (obj.EditingElement is TextBox textBox)
     {
         string value = textBox.Text;
         if (decimal.TryParse(value, out decimal decimalValue))
         {
             Enum.TryParse(obj.Column.Tag.ToString(), out OrderColumnType orderColumnType);
             int rowIndex = obj.Row.GetIndex();
             OrderItemListView existingOrderItem = OrderItems[rowIndex];
             existingOrderItem.OrderItem.GetType().GetProperty(orderColumnType.ToString()).SetValue(existingOrderItem.OrderItem, decimalValue);
             var column = orderColumnType.ToString();
             OrderItemListView updatedOrderItem = this.GetDuplicatedItem(existingOrderItem);
             this.DeletOrderItem(existingOrderItem);
             this.OrderItems.Insert(rowIndex, updatedOrderItem);
             existingOrderItem.Dispose();
         }
     }
 }