public static string toAttitudeAnsTypeName(this AttitudeAnsType statusType) { string str = ""; switch (statusType) { case AttitudeAnsType.Type2: str = "2 ตัวเลือก"; break; case AttitudeAnsType.Type3: str = "3 ตัวเลือก"; break; case AttitudeAnsType.Type4: str = "4 ตัวเลือก"; break; case AttitudeAnsType.Type5: str = "5 ตัวเลือก"; break; case AttitudeAnsType.Type6: str = "6 ตัวเลือก"; break; case AttitudeAnsType.Type7: str = "7 ตัวเลือก"; break; default: break; } return(str); }
public static AttitudeAnsType toAttitudeAnsType(this string text) { AttitudeAnsType str = AttitudeAnsType.Type3; switch (text) { case "2 ตัวเลือก": str = AttitudeAnsType.Type2; break; case "3 ตัวเลือก": str = AttitudeAnsType.Type3; break; case "4 ตัวเลือก": str = AttitudeAnsType.Type4; break; case "5 ตัวเลือก": str = AttitudeAnsType.Type5; break; case "6 ตัวเลือก": str = AttitudeAnsType.Type6; break; case "7 ตัวเลือก": str = AttitudeAnsType.Type7; break; case "2": str = AttitudeAnsType.Type2; break; case "3": str = AttitudeAnsType.Type3; break; case "4": str = AttitudeAnsType.Type4; break; case "5": str = AttitudeAnsType.Type5; break; case "6": str = AttitudeAnsType.Type6; break; case "7": str = AttitudeAnsType.Type7; break; default: break; } return(str); }