/// <summary>
        /// get farsi mah number
        /// </summary>
        /// <param name="selectedYear"></param>
        /// <param name="selectedMonth"></param>
        /// <param name="selectedDay"></param>
        /// <returns></returns>
        internal static int?SaalNum(int?selectedYear, int?selectedMonth, int?selectedDay)
        {
            var shamsi = ConvertDate.ToShamsiDate(selectedYear, selectedMonth, selectedDay);

            if (shamsi == null)
            {
                return(null);
            }

            return(shamsi.Saal);
        }
        public static Dictionary <String, int> GetAllFarsiMonths()
        {
            Dictionary <String, int> ht = new Dictionary <String, int>();

            for (int i = 1; i <= 12; i++)
            {
                ht.Add(ConvertDate.MapFarsiMonthNumToName(i), i);
            }
            //ht.Add(string.Format("{1} - {0}",Convert_Date.Map_FarsiMonthNum_ToName(i),i), i);

            return(ht);
        }
Exemple #3
0
        /// <summary>
        /// this constructor uses PersianCalendar and store its method returned values in a more friendler structor
        /// and properties of this class
        /// </summary>
        /// <param name="date"></param>
        internal ShamsiDate(DateTime date)
        {
            EquivalentGoergianDate = date;
            var pDate = new System.Globalization.PersianCalendar();

            Saal     = pDate.GetYear(date);
            Mah      = pDate.GetMonth(date);
            RoozeMah = pDate.GetDayOfMonth(date);
            //time
            Saat     = pDate.GetHour(date);
            Daghighe = pDate.GetMinute(date);
            Saniyeh  = pDate.GetSecond(date);

            RoozeHafteh = ConvertDate.MapWeekDayToNum(pDate.GetDayOfWeek(date));
        }
Exemple #4
0
        internal ShamsiDate(int saal, int mah, int rooz)
        {
            Saal     = saal;
            Mah      = mah;
            RoozeMah = rooz;

            var pDate = new System.Globalization.PersianCalendar();

            EquivalentGoergianDate = pDate.ToDateTime(saal, mah, rooz, 0, 0, 0, 0);

            Saat     = pDate.GetHour(EquivalentGoergianDate);
            Daghighe = pDate.GetMinute(EquivalentGoergianDate);
            Saniyeh  = pDate.GetSecond(EquivalentGoergianDate);

            RoozeHafteh = ConvertDate.MapWeekDayToNum(pDate.GetDayOfWeek(EquivalentGoergianDate));
        }
 /// <summary>
 /// return only the year, used for example in the footer and copyright in one shot
 /// </summary>
 /// <param name="dateTime"></param>
 /// <returns></returns>
 public static int SaalNum(DateTime dateTime)
 {
     return(ConvertDate.ToShamsiDate(dateTime).Saal);
 }
 /// <summary>
 /// روزه ماه
 /// </summary>
 /// <param name="dateTime"></param>
 /// <returns></returns>
 public static int RoozNum(DateTime dateTime)
 {
     return(ConvertDate.ToShamsiDate(dateTime).RoozeMah);
 }
 /// <summary>
 /// return only the month , used for example in the footer and copyright in one shot
 /// </summary>
 /// <param name="dateTime"></param>
 /// <returns></returns>
 public static int MahNum(DateTime dateTime)
 {
     return(ConvertDate.ToShamsiDate(dateTime).Mah);
 }