Beispiel #1
0
        internal static SPInterceptRateWrapper ConvertEntityToWrapper(SPInterceptRateEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            if (entity.Id == 0)
            {
                return(null);
            }

            return(new SPInterceptRateWrapper(entity));
        }
        //public static void InsertRecord(SPPaymentInfoWrapper paymentInfo)
        //{
        //    SPInterceptRateWrapper spInterceptRateWrappe  =new SPInterceptRateWrapper();

        //}
        public static void InsertRate(SPChannelWrapper channelId, SPClientWrapper clinetId, bool isInterCept)
        {
            SPInterceptRateEntity spInterceptRateWrapper = businessProxy.FindRateByChannelIdAndClinetId(channelId.Id, clinetId.Id);

            if (isInterCept)
            {
                spInterceptRateWrapper.InterceptCount = spInterceptRateWrapper.InterceptCount + 1;
            }

            spInterceptRateWrapper.TotalCount = spInterceptRateWrapper.TotalCount + 1;

            spInterceptRateWrapper.InterceptRate = Convert.ToDecimal(spInterceptRateWrapper.InterceptCount) / Convert.ToDecimal(spInterceptRateWrapper.TotalCount);

            spInterceptRateWrapper.LastSycnDate = System.DateTime.Now;

            Update(ConvertEntityToWrapper(spInterceptRateWrapper));
        }
        public SPInterceptRateEntity FindRateByChannelIdAndClinetId(int channelID, int clientID)
        {
            SPInterceptRateEntity spInterceptRateEntity = this.SelfDataObj.FindRateByChannelIdAndClinetId(channelID, clientID);

            if (spInterceptRateEntity == null)
            {
                spInterceptRateEntity                = new SPInterceptRateEntity();
                spInterceptRateEntity.ChannelID      = channelID;
                spInterceptRateEntity.ClientID       = clientID;
                spInterceptRateEntity.InterceptCount = 0;
                spInterceptRateEntity.TotalCount     = 0;
                spInterceptRateEntity.InterceptRate  = 0;
                spInterceptRateEntity.LastSycnDate   = System.DateTime.Now;
                this.SelfDataObj.Save(spInterceptRateEntity);
            }

            return(spInterceptRateEntity);
        }
Beispiel #4
0
 internal SPInterceptRateWrapper(SPInterceptRateEntity entityObj)
 {
     entity = entityObj;
 }