Пример #1
0
 private void btnDeleteQuatity_Click(object sender, RoutedEventArgs e)
 {
     if (dtGrid.Rows.Count > 0)
     {
         string InventoryID = GridVoucherInventory.GetFocusedRowCellValue(COL_InventoryID).ToString();
         int    n           = BLVoucher.GetCurrentRowIndex(GridVoucherInventory, "InventoryID");
         int    value_Old   = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_Quantity));
         int    stock_Old   = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_InStock));
         if (value_Old > 1)
         {
             GridVoucherInventory.SetCellValue(n, "Quantity", value_Old - 1);
             GridVoucherInventory.SetCellValue(n, "InStock", stock_Old + 1);
             CalAmountGrid(n);
         }
         else if (value_Old == 1)
         {
             GridVoucherInventory.DeleteRowFocusEvent();
         }
         CalAmount();
         btnSave.IsEnabled = true;
     }
     if (GridVoucherInventory.VisibleRowCount == 0)
     {
         btnAddQuatity.IsEnabled    = false;
         btnDeleteQuatity.IsEnabled = false;
         btnAdd10Quatity.IsEnabled  = false;
     }
 }