コード例 #1
0
        }         // CalculateRollovers

        private int CalculateSeniority()
        {
            if (this.customer == null)
            {
                this.log.Debug("CalculateSeniority: 0 because customer is null.");
                return(-1);
            }             // if

            DateTime oMpOriginationDate = this.db.ExecuteScalar <DateTime?>(
                "LoadCustomerFirstTransactionTime",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerID", this.customer.Id)
                ) ?? Now;

            this.log.Debug("CalculateSeniority: mp origination date is {0}.", oMpOriginationDate.MomentStr());

            DateTime oIncorporationDate = GetCustomerIncorporationDate();

            this.log.Debug("CalculateSeniority: incorporation date is {0}.", oIncorporationDate.MomentStr());

            DateTime oDate = (oMpOriginationDate < oIncorporationDate) ? oMpOriginationDate : oIncorporationDate;

            this.log.Debug("CalculateSeniority: chosen date is {0}.", oDate.MomentStr());

            this.log.Debug("CalculateSeniority: current date is {0}.", Now.MomentStr());

            int seniority = (int)(Now - oDate).TotalDays;

            this.log.Debug("CalculateSeniority: result is {0} days.", seniority);

            return(seniority);
        }         // CalculateSeniority