示例#1
0
        public void EditBalance(string newBalance, int index)
        {
            DataStruct p      = db.GetPersonByIndex(index);
            double     result = 0.0;

            try
            {
                if (newBalance.Contains("$"))
                {
                    newBalance = newBalance.Replace("$", "");//Removing $ from balance
                }
                result = Double.Parse(newBalance);
                Debug.WriteLine(result);
                p.setBalance(result);
            }
            catch (FormatException ex)                                               //If they enter a string
            {
                Log("Message: " + ex.Message + "Stack Trace: " + ex.StackTrace);     //Logging
                throw new FaultException <ExceptionDetail>(new ExceptionDetail(ex)); //Caught later
            }
        }