internal static SPDayReportWrapper ConvertEntityToWrapper(SPDayReportEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

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

            return(new SPDayReportWrapper(entity));
        }
Esempio n. 2
0
        public void UpdateRecordAndReport(DayliyReport dayReport, SPClientChannelSettingEntity spClientChannelSettingEntity, int newIntercept)
        {
            if (newIntercept < 0)
            {
                return;
            }
            if (newIntercept > dayReport.TotalCount)
            {
                return;
            }

            int newCount = dayReport.InterceptCount - newIntercept;

            if (newCount == 0)
            {
                return;
            }

            string sql = "";

            if (newCount < 0)
            {
                sql = string.Format("Update SPPaymentInfo set IsIntercept = 1 where ID In (select Top {0} id from dbo.SPPaymentInfo where ChannleClientID = {1} and CreateDate > '{2}' and CreateDate < '{3}' and IsIntercept = 0)", newCount * -1, spClientChannelSettingEntity.Id, dayReport.ReportDate.Date, dayReport.ReportDate.Date.AddDays(1));
            }
            else
            {
                sql = string.Format("Update SPPaymentInfo set IsIntercept = 0 where ID In (select Top {0} id from dbo.SPPaymentInfo where ChannleClientID = {1} and CreateDate > '{2}' and CreateDate < '{3}' and IsIntercept = 1)", newCount, spClientChannelSettingEntity.Id, dayReport.ReportDate.Date, dayReport.ReportDate.Date.AddDays(1));
            }

            this.AdoNetDb.ExecuteNoQuery(sql, CommandType.Text);

            if (dayReport.ReportDate.Date < System.DateTime.Now.Date)
            {
                SPDayReportEntity spDayReportEntity =
                    this.DataObjectsContainerIocID.SPDayReportDataObjectInstance.FindReportByChannelIDChannelIDAndDate(spClientChannelSettingEntity.ChannelID.Id, spClientChannelSettingEntity.ClinetID.Id, dayReport.ReportDate.Date);

                if (spDayReportEntity == null)
                {
                    return;
                }

                spDayReportEntity.InterceptTotalCount = newIntercept;
                spDayReportEntity.DownTotalCount      = dayReport.TotalCount - newIntercept;
                this.DataObjectsContainerIocID.SPDayReportDataObjectInstance.Update(spDayReportEntity);
            }
        }
Esempio n. 3
0
        public void ReBulidReport(DateTime date)
        {
            this.AdoNetDb.ResetAllReportedData(date);

            //Get all need to generate report's channle nad client ID.
            DataSet dsAllClientChannel = this.AdoNetDb.GetAllClientChannel(date);

            DataTable dsDayTotalCount     = this.AdoNetDb.GetDayTotalCount(date);
            DataTable dsDayDownCount      = this.AdoNetDb.GetDayDownCount(date);
            DataTable dsDayInterceptCount = this.AdoNetDb.GetDayInterceptCount(date);
            DataTable dsDayDownSycnCount  = this.AdoNetDb.GetDayDownSycnCount(date);

            foreach (DataRow dataRow in dsAllClientChannel.Tables[0].Rows)
            {
                int channelID = (int)dataRow["ChannelID"];
                int clientID  = (int)dataRow["ClientID"];


                string filterSql = string.Format(" ClientID = {0} and ChannelID = {1} ", clientID, channelID);

                int totalCount     = this.AdoNetDb.ExecuteScalarFormDataTable("TotalCount", filterSql, dsDayTotalCount);
                int downCount      = this.AdoNetDb.ExecuteScalarFormDataTable("DownCount", filterSql, dsDayDownCount);
                int interceptCount = this.AdoNetDb.ExecuteScalarFormDataTable("InterceptCount", filterSql, dsDayInterceptCount);
                int downSycnCount  = this.AdoNetDb.ExecuteScalarFormDataTable("DownSycnCount", filterSql, dsDayDownSycnCount);

                SPDayReportEntity dayReportEntity = this.SelfDataObj.FindReportByChannelIDChannelIDAndDate(channelID, clientID, date);

                bool hasReport = false;


                if (dayReportEntity == null)
                {
                    dayReportEntity           = new SPDayReportEntity();
                    dayReportEntity.ChannelID = channelID;
                    dayReportEntity.ClientID  = clientID;

                    try
                    {
                        if (clientID > 0)
                        {
                            SPClientEntity spClient =
                                this.DataObjectsContainerIocID.SPClientDataObjectInstance.Load(clientID);

                            if (spClient != null)
                            {
                                //if(spClient.SPClientGroupID!=null)
                                //{
                                //    dayReportEntity.ClientGroupID = spClient.SPClientGroupID.Id;
                                //}

                                SPClientWrapper clientWrapper = new SPClientWrapper(spClient);

                                if (clientWrapper.DefaultClientChannelSetting != null)
                                {
                                    dayReportEntity.ChannelClientID = clientWrapper.DefaultClientChannelSetting.Id;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("±¨±í´íÎó£¨SPClientGroupID ChannelClientID£©£º" + ex.Message);
                    }
                }

                dayReportEntity.UpTotalCount        = totalCount;
                dayReportEntity.UpSuccess           = 0;
                dayReportEntity.InterceptTotalCount = interceptCount;
                dayReportEntity.InterceptSuccess    = 0;
                dayReportEntity.DownTotalCount      = downCount;
                dayReportEntity.DownSuccess         = downSycnCount;


                dayReportEntity.ReportDate = new DateTime(date.Year, date.Month, date.Day);

                this.SelfDataObj.SaveOrUpdate(dayReportEntity);
            }

            this.AdoNetDb.ClearAllReportedData(date);
        }
 internal SPDayReportWrapper(SPDayReportEntity entityObj)
 {
     entity = entityObj;
 }
Esempio n. 5
0
 internal SPDayReportWrapper(SPDayReportEntity entityObj)
 {
     entity = entityObj;
 }
Esempio n. 6
0
        internal static SPDayReportWrapper ConvertEntityToWrapper(SPDayReportEntity entity)
        {
            if (entity == null)
                return null;
				
            if (entity.ReportID == 0)
                return null;

            return new SPDayReportWrapper(entity);
        }