Here I have got a method that will return the matched parameter with just string as return type and its working fine ....
private static string GetSortedParameter(string modelValue)
{
string returnValue = null;
if (modelValue == "UserId")
{
returnValue = "UsrID";
}
if (modelValue == "Status")
{
returnValue = "TransactionStatusTypeName";
}
if (modelValue == "ProjectCaseNumber")
{
returnValue = "PROJCASE";
}
if (modelValue == "CP")
{
returnValue = "CPNumber";
}
if (modelValue == "ItemID")
{
returnValue = "ItemID";
}
if (modelValue == "TypeOfChange")
{
returnValue = "TransactionTypeName";
}
if (modelValue == "ChangeDescription")
{
returnValue = "TransactionTypeDescription";
}
if (modelValue == "CreatedOnEnd")
{
returnValue = "CreatedDateTime";
}
if (modelValue == "UpdatedOnEnd")
{
returnValue = "UpdatedDateTime";
}
if (modelValue == "Comment")
{
returnValue = "Comments";
}
return returnValue;
}
and here I am calling this method
if (request.Sorts != null && request.Sorts.Count > 0)
{
sortField = request.Sorts[0].Member;
sortDirection = request.Sorts[0].SortDirection.ToString();
}
string SortFieldParameter = GetSortedParameter(sortField);
But I want to use enum for this type how can i use enum for this type of matching parameters that will take one value as input parameter and gives matched value .....
would you pls give any idea and any solutions for this one....
I am also looking for any generic solution for this .....