Esempio n. 1
0
        static public int CheckValidRebates(DateTime time, Rebates rebate)
        {
            DateTime latestDate = rebate.Date;

            latestDate.AddDays(15);
            latestDate.AddMonths(1);
            // add 1month and 15 to see the expaire date.
            return(DateTime.Compare(latestDate, time));
        }
Esempio n. 2
0
        /// <summary>
        /// method function to combine FindVaildRebates and CheckValidRebates
        /// will return -1 if out of date. return 0 if no rebate found
        /// </summary>
        /// <param name="time"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        static public double GetOff(DateTime time, string item)
        {
            Rebates currentRebates = FindVaildRebates(item);

            if (currentRebates == null)
            {
                return(1);
            }
            if (CheckValidRebates(time, currentRebates) < 0)
            {
                return(1); // out of date
            }
            else
            {
                return(currentRebates.Off);
            }
        }