1

Closed

Approving process does not work for WebClient

description

It seems the approving process was not fully tested when connecting to the host services. It would sometimes throw "out of date" exception for the submitted Expense object.
After investigation, it looks the code of forming the expense object for approval service has problem. My workaround is, replace these code block,
"
                Expense expense = new Expense();
                expense.EmployeeID = row.Cells[1].Text;
                expense.Category = (ExpenseCategory)
                Enum.Parse(typeof(ExpenseCategory), row.Cells[2].Text);
                expense.Amount = Convert.ToDouble(row.Cells[3].Text);
                expense.Status = (ExpenseStatus)
                Enum.Parse(typeof(ExpenseStatus), row.Cells[4].Text);
                expense.Comments = row.Cells[5].Text;
                expense.DateSubmitted = Convert.ToDateTime(row.Cells[6].Text);
                expense.LastModified = Convert.ToDateTime(row.Cells[7].Text);
                expense.ExpenseID = new Guid(row.Cells[8].Text);
                expense.AssignedTo = roleBox.SelectedValue;
"
 
with one single line,
"
                Expense expense = FetchCachedObject(new Guid(row.Cells[8].Text));
", wheras the FetchCachedObject is to get the original expense object cached in session variable. (I think it is the right way because there is timestamp of Expense object).
 
One other minor issue was,
"
ExpenseReview review = new ExpenseReview(expense.ExpenseID,
    roleBox.SelectedValue, approved, remarksBox.Text);
"
there is such construct signature actually, need to assign the individual property one by one, like this,
"
                ExpenseReview review = new ExpenseReview();
                review.ExpenseID = expense.ExpenseID;
                review.ReviewerID = roleBox.SelectedValue;

                review.Approved = approved;
                review.Remarks = remarksBox.Text;
"
Closed Nov 28, 2008 at 8:12 AM by firedancer
Fixed in November 2008 Release.

comments