using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Globalization; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Shared { public static class ExMethod { public static string ShamciToFormatShamciinFront(this string str) { if (string.IsNullOrEmpty(str)) return ""; return str.Substring(0, 4) + "/" + str.Substring(4, 2) + "/" + str.Substring(6, 2); } public static string ConvertMiladiToShamsiinFront(this DateTime date) { PersianCalendar PersianCal = new PersianCalendar(); return PersianCal.GetYear(date).ToString("0000") + PersianCal.GetMonth(date).ToString("00") + PersianCal.GetDayOfMonth(date).ToString("00") ; } public static string GetEnumDisplayName(this Enum enumType) { return enumType.GetType().GetMember(enumType.ToString()) .First() .GetCustomAttribute() .Name; } } }