using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using SPC.Kiosk.Common; namespace SPC.Kiosk.Popup.Model { /// /// Popup 사용 공통 기능 /// public static class Functions { /// /// Name with Encript Character /// /// /// public static string GetEncriptName(this string _name) { string result = _name; try { switch (_name.Length) { case 1: result = _name; break; case 2: result = _name.Substring(0, 1) + "*"; break; case 3: result = _name.Substring(0, 1) + "*" + _name.Substring(2, 1); break; case 4: result = _name.Substring(0, 1) + "*" + _name.Substring(2, 2); break; case 5: result = _name.Substring(0, 1) + "**" + _name.Substring(3, 2); break; default: var names = _name.Trim().Replace(" ", " ").Split(' '); int i = 0; result = string.Empty; foreach (var aName in names) { if (i.Equals(1)) { result += string.Empty.PadRight(aName.Length, '*'); } else { result += aName; } i++; } break; } } catch { result = _name; } return result; } /// /// Card Number With Encript Character /// /// /// public static string GetEncriptCardNo(this string _cardNo) { string result = _cardNo; try { switch (_cardNo.Length) { case 14: result = string.Format("{0}-{1}{2}-{3}-{4}" , _cardNo.Substring(0, 4) , _cardNo.Substring(4, 2) , "**" , "****" , "**"); break; case 15: result = string.Format("{0}-{1}{2}-{3}-{4}{5}" , _cardNo.Substring(0, 4) , _cardNo.Substring(4, 2) , "**" , "****" , "**" , _cardNo.Substring(14, 1)); break; case 16: result = string.Format("{0}-{1}{2}-{3}-{4}{5}" , _cardNo.Substring(0, 4) , _cardNo.Substring(4, 2) , "**" , "****" , "**" , _cardNo.Substring(14, 2)); break; } } catch { result = _cardNo; } return result; } /// /// Get Mobile Company Name by Type /// /// /// public static List GetMobileCompanyName(this MobileCompanyType _companyType) { List result = null; try { switch (_companyType) { case MobileCompanyType.KT_Mobile: result = new List { new M_Language { Type=SupportLanguageType.ko, LanguageData = "KT" } }; break; case MobileCompanyType.SK_Telecom: result = new List { new M_Language { Type=SupportLanguageType.ko, LanguageData = "SK Telecom" } }; break; case MobileCompanyType.LG_Uplus: result = new List { new M_Language { Type=SupportLanguageType.ko, LanguageData = "LG U+" }, }; break; } } catch { result = null; } return result; } } }