コード例 #1
0
        public void CreateDate()
        {
            int minDay, minMounth, minYeaer;

            PersianDate persianDate =
                Infrastructure.Utility.ConvertMiladiToShamsi(System.DateTime.Now);

            minDay    = persianDate.Day;
            minMounth = persianDate.Month;
            minYeaer  = persianDate.Year;

            yearLabel.Text = minYeaer.ToString();
            dayLabel.Text  = minDay.ToString();

            mounthLabel.Text = Infrastructure.MountChange.numbertoname(minMounth);

            date = minYeaer + "/" + minMounth + "/" + minDay;
        }
コード例 #2
0
        private static string checkchange(string day, string mounth, string year)
        {
            int yearnumber, mounthnumber, daynumber;

            yearnumber   = System.Convert.ToInt32(year);
            daynumber    = System.Convert.ToInt32(day);
            mounthnumber = Infrastructure.MountChange.nametonumber(mounth);

            PersianDate persianDate =
                Infrastructure.Utility.ConvertMiladiToShamsi(System.DateTime.Now);

            if (persianDate.Year > yearnumber)
            {
                return("Cancel");
            }
            else
            {
                if (persianDate.Year == yearnumber)
                {
                    if (persianDate.Month > mounthnumber)
                    {
                        return("Cancel");
                    }
                    else
                    {
                        if (persianDate.Month == 1 && mounthnumber == 12)
                        {
                            return("Cancel");
                        }
                        if (persianDate.Month == mounthnumber)
                        {
                            if (persianDate.Day > daynumber)
                            {
                                return("Cancel");
                            }
                        }
                    }
                }
            }
            return("Ok");
        }