Ejemplo n.º 1
0
        public override bool check()
        {
            licenseEndDate = installDate;
            licenseEndDate.plusDay(dayOffFree);

            DataTime_My localDate = new DataTime_My().localDateTime();

            return(new DataTime_My().compareDates(licenseEndDate, localDate) >= 0);
        }
Ejemplo n.º 2
0
        // return and SET date of the next day
        public DataTime_My Nextday(DataTime_My ob)
        {
            day   = ob.day;
            month = ob.month;
            year  = ob.year;
            day++;

            if (((month <= 7) && (month % 2 == 1)) || ((month >= 8) && (month % 2 == 0)))
            {
                if (day > 31)
                {
                    day = 1; month++;
                }
            }
            else
            {
                if ((month == 4) || (month == 6) || (month == 9) || (month == 11))
                {
                    if (day > 30)
                    {
                        day = 1; month++;
                    }
                }
                else
                {
                    if (((year % 4 == 0) && (year % 100 != 0)) ||
                        ((year % 4 == 0) && (year % 100 != 0) && (year % 400 == 0)))
                    {
                        if (day > 29)
                        {
                            day = 1; month++;
                        }
                    }
                    else
                    {
                        if (day > 28)
                        {
                            day = 1; month++;
                        }
                    }
                }
            }
            if (month > 12)
            {
                month = 1; year++;
            }

            return(new DataTime_My(day, month, year));
        }
Ejemplo n.º 3
0
        // return and SET date of the previous day
        public DataTime_My Previousday(DataTime_My ob)
        {
            day   = ob.day;
            month = ob.month;
            year  = ob.year;
            day--;

            if (((month <= 7) && (month % 2 == 1)) || ((month >= 8) && (month % 2 == 0)))
            {
                if (day < 1)
                {
                    if (month == 1 || month == 8)
                    {
                        day = 31; month--;
                    }
                    else
                    {
                        day = 30; month--;
                        if (month == 2)
                        {
                            if (((year % 4 == 0) && (year % 100 != 0)) ||
                                ((year % 4 == 0) && (year % 100 != 0) && (year % 400 == 0)))
                            {
                                day = 29;
                            }
                            else
                            {
                                day = 28;
                            }
                        }
                    }
                }
            }
            else if ((month == 2) || (month == 4) || (month == 6) || (month == 9) || (month == 11))
            {
                if (day < 1)
                {
                    day = 31; month--;
                }
            }
            if (month == 0)
            {
                day   = 31;
                month = 12;
                year--;
            }
            return(new DataTime_My(day, month, year));
        }
Ejemplo n.º 4
0
 // Compare two dates
 // if the first is later (larger) and the second is earlier (less) then it return 1
 // if they are equal, it return 0
 // if the first date is earlier (less) and the second later (greater) it return -1
 public int compareDates(DataTime_My firstDate, DataTime_My secondDate)
 {
     if (firstDate.year > secondDate.year)
     {
         return(1);
     }
     else if (firstDate.year < secondDate.year)
     {
         return(-1);
     }
     else
     { // years are equals
         if (firstDate.month > secondDate.month)
         {
             return(1);
         }
         else if (firstDate.month < secondDate.month)
         {
             return(-1);
         }
         else
         { // month are equals
             if (firstDate.day > secondDate.day)
             {
                 return(1);
             }
             else if (firstDate.day < secondDate.day)
             {
                 return(-1);
             }
             else
             {
                 return(0);
             }
         }
     }
     return(-1);
 }
Ejemplo n.º 5
0
 public Shareware(string name, string dev, DataTime_My date, int days) : base(name, dev)
 {
     this.installDate = date;
     this.dayOffFree  = days;
 }
Ejemplo n.º 6
0
 public ComercialSoftware(string name, string dev, DataTime_My install, int freeDays) : base(name, dev)
 {
     this.installDate = install;
     this.dayOffFree  = freeDays;
 }