The object here is to update the UI. I normally do this on the client however this application uses the code behind. Anyways my question is I am trying to clean up these if else statements and I thought the strategy pattern may be appropriate. I don't need everything done for me but if you could give me a couple pointers to get going. Do I create an interface first and then each strategy implement the interface? Are generics helpful here? What types of methods should be in the interface? Any thing to get me going would be very much appreciated.
if (someObject.Status == 'A') {
btnRecordCall.Enabled = false;
btnAddMailOrStatusAction.Enabled = false;
btnPayments.Enabled = false;
btnAddressMaint.Enabled = false;
btnFilter.Enabled = false;
btnAddCoverage.Enabled = false;
btnPolicyForms.Enabled = false;
lblIsArchived.Text = "********** THIS CLAIM HAS BEEN ARCHIVED **********";
} else if (someObject.Status == 'D') {
btnRecordCall.Enabled = false;
btnAddMailOrStatusAction.Enabled = false;
btnPayments.Enabled = false;
btnAddressMaint.Enabled = false;
btnFilter.Enabled = false;
btnAddCoverage.Enabled = false;
btnPolicyForms.Enabled = false;
lblIsArchived.Text = "- De-archive Request Pending";
} else {
btnRecordCall.Enabled = true;
btnAddMailOrStatusAction.Enabled = true;
btnPayments.Enabled = true;
btnAddressMaint.Enabled = true;
btnFilter.Enabled = true;
btnAddCoverage.Enabled = true;
btnPolicyForms.Enabled = true;
lblIsArchived.Text = "";
}
Thanks, ~ck