Note that there are some explanatory texts on larger screens.

plurals
  1. POrefactor help - strategy pattern
    primarykey
    data
    text
    <p>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.</p> <pre><code>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 = ""; } </code></pre> <p>Thanks, ~ck</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload