protected void UpdateExpenseCategory(string category) { JT_MiscellaneousCodes categoryRecord = App.Database.GetExpenseCategory(category); string[] brokenDescription = App_Expense.BreakDescription(categoryRecord.AddtlDescNum); try { _expenseItem.ChargeCode = brokenDescription[0]; } catch { _expenseItem.ChargeCode = null; } try { _expenseItem.UnitOfMeasure = brokenDescription[1]; } catch { _expenseItem.UnitOfMeasure = null; } try { _expenseItem.UnitPrice = double.Parse(brokenDescription[2]); } catch { _expenseItem.UnitPrice = 0; } }
protected void UpdateExpenseCategory(string category) { // dch rkl 12/07/2016 catch exception try { // dch rkl 11/21/2016 make sure category is not blank/null BEGIN if (category != null && category.Trim().Length > 0) { // dch rkl 11/21/2016 make sure category is not blank/null END JT_MiscellaneousCodes categoryRecord = App.Database.GetExpenseCategory(category); string[] brokenDescription = App_Expense.BreakDescription(categoryRecord.AddtlDescNum); try { _expenseItem.ChargeCode = brokenDescription[0]; } catch { _expenseItem.ChargeCode = null; } try { _expenseItem.UnitOfMeasure = brokenDescription[1]; } catch { _expenseItem.UnitOfMeasure = null; } try { _expenseItem.UnitPrice = double.Parse(brokenDescription[2]); } catch { _expenseItem.UnitPrice = 0; } // dch rkl 11/21/2016 make sure category is not blank/null BEGIN } else { _expenseItem.ChargeCode = ""; _expenseItem.UnitOfMeasure = null; _expenseItem.UnitPrice = 0; } // dch rkl 11/21/2016 make sure category is not blank/null END } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.ExpensesEditPageViewModel.UpdateExpenseCategory"); } }