Exemplo n.º 1
0
        public object Clone()
        {
            Vars stat = new Vars();
            stat.MaxOnlineCount = MaxOnlineCount;
            stat.MaxOnlineDate = MaxOnlineDate;
            stat.MaxPostDate = MaxPostDate;
            stat.MaxPosts = MaxPosts;
            stat.NewUserID = NewUserID;
            stat.NewUsername = NewUsername;
            stat.TotalUsers = TotalUsers;
            stat.YestodayPosts = YestodayPosts;
            stat.LastResetDate = LastResetDate;
            stat.YestodayTopics = YestodayTopics;

            return stat;
        }
Exemplo n.º 2
0
        public override Vars GetVars()
        {
            Vars stat = null;
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_GetVars";
                query.CommandType = CommandType.StoredProcedure;

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        stat = new Vars(reader);
                    }
                }
            }

            if (stat == null)
            {
                stat = UpdateNewUserStat();
            }

            return stat;
        }
Exemplo n.º 3
0
 public static void UpdateVars(Vars vars)
 {
     try
     {
         VarDao.Instance.UpdateVars(vars);
         VarsManager.stat = vars;
     }
     catch(Exception ex)
     {
         LogHelper.CreateErrorLog(ex);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 重新统计用户数  只用于后台 的重新统计
 /// </summary>
 public static void UpdateUserCount()
 {
     Vars newStat = VarDao.Instance.UpdateNewUserStat();
     stat = newStat;
 }
Exemplo n.º 5
0
 public static void ResetVars()
 {
     stat = null;
 }
Exemplo n.º 6
0
        public override void UpdateVars(Vars vars)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_UpdateVars";
                query.CommandType = CommandType.StoredProcedure;

                query.CreateParameter<int>("@MaxPosts", vars.MaxPosts, SqlDbType.Int);
                query.CreateParameter<int>("@NewUserID", vars.NewUserID, SqlDbType.Int);
                query.CreateParameter<int>("@TotalUsers", vars.TotalUsers, SqlDbType.Int);
                query.CreateParameter<int>("@YestodayPosts", vars.YestodayPosts, SqlDbType.Int);
                query.CreateParameter<int>("@YestodayTopics", vars.YestodayTopics, SqlDbType.Int);
                query.CreateParameter<int>("@MaxOnlineCount", vars.MaxOnlineCount, SqlDbType.Int);
                query.CreateParameter<DateTime>("@MaxPostDate", vars.MaxPostDate, SqlDbType.DateTime);
                query.CreateParameter<DateTime>("@MaxOnlineDate", vars.MaxOnlineDate, SqlDbType.DateTime);
                query.CreateParameter<DateTime>("@LastResetDate", vars.LastResetDate, SqlDbType.DateTime);
                query.CreateParameter<string>("@NewUsername", vars.NewUsername, SqlDbType.NVarChar, 50);

                query.ExecuteNonQuery();
            }
        }
Exemplo n.º 7
0
        public override Vars UpdateNewUserStat()
        {
            Vars stat = null;
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_UpdateNewUserVars";
                query.CommandType = CommandType.StoredProcedure;
                query.CreateParameter<bool>("@GetVars", true, SqlDbType.Bit);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        stat = new Vars(reader);
                    }
                }
            }

            if (stat == null)
            {
                stat = new Vars();
                stat.NewUserID = 1;
                stat.NewUsername = "******";
            }

            return stat;
        }