private double CalculateCostValue() { double qtd = 0; double?standardcost; double baseUoMQty = 0; if (string.IsNullOrEmpty(txtQty.Text)) { qtd = 0; } else { qtd = Convert.ToDouble(txtQty.Text); } if (string.IsNullOrEmpty(txtItem.Text)) { standardcost = 0; baseUoMQty = 0; } else { standardcost = Convert.ToDouble(txtStandardCost.Text); baseUoMQty = itemsService.GetBaseUoMQty(txtItem.Text); } return(Math.Round((Convert.ToDouble(standardcost) / baseUoMQty) * qtd, 2)); }