Checked actamount before calculating

This commit is contained in:
2021-03-03 23:46:21 +01:00
parent b41b2b0076
commit 234cdbf9e8

View File

@ -3,13 +3,7 @@ using Helpers;
using StockDAL.Interface; using StockDAL.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace StockInfo namespace StockInfo
@ -87,7 +81,7 @@ namespace StockInfo
if (txtSoldPrice.Text.IsNumeric() && txtSoldAmount.Text.IsNumeric()) if (txtSoldPrice.Text.IsNumeric() && txtSoldAmount.Text.IsNumeric())
{ {
txtSellValue.Text = (decimal.Parse(txtSoldPrice.Text) * long.Parse(txtSoldAmount.Text)).ToString(); txtSellValue.Text = (decimal.Parse(txtSoldPrice.Text) * long.Parse(txtSoldAmount.Text)).ToString();
txtRemainingNo.Text = (stkMemSelected.PostAmount - long.Parse(txtSoldAmount.Text)).ToString(); txtRemainingNo.Text = stkMemSelected.ActAmount > 0 ? (stkMemSelected.PostAmount - long.Parse(txtSoldAmount.Text)).ToString() : 0.ToString();
} }
} }