Background: About 4 weeks C#, please bear with me. I have a drop down box where users update the status of a project as either Active or Inactive.
I have the following methods that create and assign values to my dropdown list:
public class CommonSVC
{
#region Fill Item Status
public void FillItemStatus(DropDownList uxStatusDdl, bool blankEntry, string blankEntryText, bool includeBothListItem)
{
if (includeBothListItem)
{
uxStatusDdl.Items.Add(new ListItem("Both", "-1"));
}
uxStatusDdl.Items.Add(new ListItem("Active", "0"));
uxStatusDdl.Items.Add(new ListItem("Inactive", "1"));
FillControl.AddBlankAndAllValues(uxStatusDdl, false, "", blankEntry, blankEntryText);
}
#endregion
#region Fill Yes No
public void FillYesNo(DropDownList ddl, bool blankEntry, string blankEntryText, bool includeBothListItem)
{
if (includeBothListItem)
{
ddl.Items.Add(new ListItem("Both", "-1"));
}
ddl.Items.Add(new ListItem("Yes", "1"));
ddl.Items.Add(new ListItem("No", "0"));
FillControl.AddBlankAndAllValues(ddl, false, "", blankEntry, blankEntryText);
}
#endregion
#region Get Yes No Value By DDL Value
public static string GetYesNoValueByDDLValue(string ddlValue)
{
switch (ddlValue)
{
case "0":
return "0";
case "1":
return "1";
case "-1":
return "0,1";
default:
return string.Empty;
}
}
#endregion
The actual method that invokes a change to my project status is:
: accountTrackersvc.UpdateConnectionType(DataConverter.StringToInteger(ViewState["ConnectionTypeID"].ToString()),
uxConnectionTypeDescTxt.Text.Trim(),
Enums.GetIsDisabledByItemStatusValue(SafeValueAccessor.GetControlValue(uxStatusDdl)), /* This line updates project status */
CommonSVC.GetUserInfoFormattedFromSession());
I've generated a method stub for the GetIsDisabledByItemStatusValue() method and made some changes as well, so far this is what I've got:
public static object GetIsDisabledByItemStatusValue(string p)
{
bool ActiveIndicator = true;
if (ActiveIndicator)
{
CommonSVC.GetYesNoValueByDDLValue(string ddlValue)
}
return p;
}
#endregion
You'll notice that the method of interest is within an enum class, I'm working within a pre-built template and thus am confined to work with what I have already there. There are no errors in the top 2 code blocks above. My question is: how would I implement a method in the enums class that would connect the 2 blocks of code from my CommonSVC class and the invocation class?