Esempio n. 1
0
        public IList <UserStatisticsForDate> GetUserAdd(int?year, int?month, int?days)
        {
            int num6;
            IList <UserStatisticsForDate> list = new List <UserStatisticsForDate>();
            DbCommand sqlStringCommand         = this.database.GetSqlStringCommand("SELECT (SELECT COUNT(*) FROM aspnet_Members WHERE CreateDate BETWEEN @StartDate AND @EndDate) AS UserAdd ");

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
            DateTime time  = new DateTime();
            DateTime time2 = new DateTime();

            if (days.HasValue)
            {
                time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1.0).AddDays((double)-days.Value);
            }
            else if (year.HasValue && month.HasValue)
            {
                time = new DateTime(year.Value, month.Value, 1);
            }
            else if (year.HasValue && !month.HasValue)
            {
                time = new DateTime(year.Value, 1, 1);
            }
            if (!days.HasValue)
            {
                if (year.HasValue && month.HasValue)
                {
                    int num2 = DateTime.DaysInMonth(year.Value, month.Value);
                    for (int i = 1; i <= num2; i++)
                    {
                        UserStatisticsForDate item = new UserStatisticsForDate();
                        if (i > 1)
                        {
                            time = time2;
                        }
                        time2 = time.AddDays(1.0);
                        this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                        this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                        item.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                        item.TimePoint  = i;
                        list.Add(item);
                    }
                    return(list);
                }
                if (year.HasValue && !month.HasValue)
                {
                    int num4 = 12;
                    for (int j = 1; j <= num4; j++)
                    {
                        UserStatisticsForDate date3 = new UserStatisticsForDate();
                        if (j > 1)
                        {
                            time = time2;
                        }
                        time2 = time.AddMonths(1);
                        this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                        this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                        date3.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                        date3.TimePoint  = j;
                        list.Add(date3);
                    }
                }
                return(list);
            }
            int num = 1;

Label_0174:
            num6 = num;
            if (num6 <= days)
            {
                UserStatisticsForDate date = new UserStatisticsForDate();
                if (num > 1)
                {
                    time = time2;
                }
                time2 = time.AddDays(1.0);
                this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                date.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                date.TimePoint  = time.Day;
                list.Add(date);
                num++;
                goto Label_0174;
            }
            return(list);
        }
Esempio n. 2
0
        public IList <UserStatisticsForDate> GetUserAdd(int?year, int?month, int?days)
        {
            IList <UserStatisticsForDate> list = new List <UserStatisticsForDate>();

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT (SELECT COUNT(*) FROM aspnet_Members WHERE CreateDate BETWEEN @StartDate AND @EndDate) AS UserAdd ");
            this.database.AddInParameter(sqlStringCommand, "@StartDate", System.Data.DbType.DateTime);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", System.Data.DbType.DateTime);
            DateTime date     = default(DateTime);
            DateTime dateTime = default(DateTime);

            if (days.HasValue)
            {
                date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1.0).AddDays((double)(-(double)days.Value));
            }
            else if (year.HasValue && month.HasValue)
            {
                date = new DateTime(year.Value, month.Value, 1);
            }
            else if (year.HasValue && !month.HasValue)
            {
                date = new DateTime(year.Value, 1, 1);
            }
            if (days.HasValue)
            {
                for (int i = 1; i <= days; i++)
                {
                    UserStatisticsForDate userStatisticsForDate = new UserStatisticsForDate();
                    if (i > 1)
                    {
                        date = dateTime;
                    }
                    dateTime = date.AddDays(1.0);
                    this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(date));
                    this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(dateTime));
                    userStatisticsForDate.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                    userStatisticsForDate.TimePoint  = date.Day;
                    list.Add(userStatisticsForDate);
                }
            }
            else if (year.HasValue && month.HasValue)
            {
                int num = DateTime.DaysInMonth(year.Value, month.Value);
                for (int i = 1; i <= num; i++)
                {
                    UserStatisticsForDate userStatisticsForDate = new UserStatisticsForDate();
                    if (i > 1)
                    {
                        date = dateTime;
                    }
                    dateTime = date.AddDays(1.0);
                    this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(date));
                    this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(dateTime));
                    userStatisticsForDate.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                    userStatisticsForDate.TimePoint  = i;
                    list.Add(userStatisticsForDate);
                }
            }
            else if (year.HasValue && !month.HasValue)
            {
                int num2 = 12;
                for (int i = 1; i <= num2; i++)
                {
                    UserStatisticsForDate userStatisticsForDate = new UserStatisticsForDate();
                    if (i > 1)
                    {
                        date = dateTime;
                    }
                    dateTime = date.AddMonths(1);
                    this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(date));
                    this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(dateTime));
                    userStatisticsForDate.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                    userStatisticsForDate.TimePoint  = i;
                    list.Add(userStatisticsForDate);
                }
            }
            return(list);
        }
        public override IList <UserStatisticsForDate> GetUserIncrease(int?year, int?month, int?days)
        {
            int num;
            UserStatisticsForDate date;
            int num4;
            IList <UserStatisticsForDate> list = new List <UserStatisticsForDate>();
            DbCommand sqlStringCommand         = this.database.GetSqlStringCommand("SELECT (SELECT COUNT(*) FROM vw_distro_Members WHERE ParentUserId = @ParentUserId AND CreateDate >=@StartDate AND  CreateDate<= @EndDate) AS UserIncrease;");

            this.database.AddInParameter(sqlStringCommand, "ParentUserId", DbType.Int32, HiContext.Current.User.UserId);
            this.database.AddInParameter(sqlStringCommand, "StartDate", DbType.DateTime);
            this.database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime);
            DateTime time  = new DateTime();
            DateTime time2 = new DateTime();

            if (days.HasValue)
            {
                time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1.0).AddDays((double)-days.Value);
            }
            else if (year.HasValue && month.HasValue)
            {
                time = new DateTime(year.Value, month.Value, 1);
            }
            else if (!(!year.HasValue || month.HasValue))
            {
                time = new DateTime(year.Value, 1, 1);
            }
            if (!days.HasValue)
            {
                if (year.HasValue && month.HasValue)
                {
                    int num2 = DateTime.DaysInMonth(year.Value, month.Value);
                    for (num = 1; num <= num2; num++)
                    {
                        date = new UserStatisticsForDate();
                        if (num > 1)
                        {
                            time = time2;
                        }
                        time2 = time.AddDays(1.0);
                        this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                        this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                        date.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                        date.TimePoint  = num;
                        list.Add(date);
                    }
                    return(list);
                }
                if (year.HasValue && !month.HasValue)
                {
                    int num3 = 12;
                    for (num = 1; num <= num3; num++)
                    {
                        date = new UserStatisticsForDate();
                        if (num > 1)
                        {
                            time = time2;
                        }
                        time2 = time.AddMonths(1);
                        this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                        this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                        date.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                        date.TimePoint  = num;
                        list.Add(date);
                    }
                }
                return(list);
            }
            num = 1;
Label_01D1:
            num4 = num;
            if (num4 <= days)
            {
                date = new UserStatisticsForDate();
                if (num > 1)
                {
                    time = time2;
                }
                time2 = time.AddDays(1.0);
                this.database.SetParameterValue(sqlStringCommand, "@StartDate", DataHelper.GetSafeDateTimeFormat(time));
                this.database.SetParameterValue(sqlStringCommand, "@EndDate", DataHelper.GetSafeDateTimeFormat(time2));
                date.UserCounts = (int)this.database.ExecuteScalar(sqlStringCommand);
                date.TimePoint  = time.Day;
                list.Add(date);
                num++;
                goto Label_01D1;
            }
            return(list);
        }