Exemple #1
0
        public static void InsertVC(object source, ElapsedEventArgs e)
        {
            var list = Controllers.HomeController.vcList;

            Controllers.HomeController.vcList = new List <string>();

            if (list.Count > 0)
            {
                Model.MVisitorCount model = Logic.LVisitorCount.GetVisitorCount();

                if (model != null)
                {
                    model.Count = model.Count + list.Count;
                    Logic.LVisitorCount.UpdateVC(model);
                }
                else
                {
                    model = new Model.MVisitorCount
                    {
                        Count = list.Count
                    };
                    Logic.LVisitorCount.InsertVC(model);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 添加访问计数
        /// </summary>
        /// <param name="inModel"></param>
        /// <returns></returns>
        public static int InsertVC(Model.MVisitorCount inModel)
        {
            string       sql  = @" INSERT INTO nw_VisitorCount ( Count ) VALUES ( @inCount ) ";
            SqlParameter para = new SqlParameter("@inCount", SqlDbType.Int);

            para.Value = inModel.Count;

            int result = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, para);

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 更新访问计数
        /// </summary>
        /// <param name="inModel"></param>
        /// <returns></returns>
        public static int UpdateVC(Model.MVisitorCount inModel)
        {
            string sql = @" UPDATE nw_VisitorCount SET Count = @inCount WHERE VCID = @inVCID ";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@inCount", SqlDbType.Int),
                new SqlParameter("@inVCID", SqlDbType.Int)
            };
            paras[0].Value = inModel.Count;
            paras[1].Value = inModel.VCID;

            int result = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, paras);

            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 获取访问人数
        /// </summary>
        /// <returns></returns>
        public static Model.MVisitorCount GetVisitorCount()
        {
            string sql = @" SELECT * FROM nw_VisitorCount ";

            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql);

            Model.MVisitorCount model = null;

            if (dt.Rows.Count > 0)
            {
                model = new Model.MVisitorCount
                {
                    VCID  = Convert.ToInt32(dt.Rows[0]["VCID"]),
                    Count = Convert.ToInt32(dt.Rows[0]["Count"])
                };
            }

            return(model);
        }
Exemple #5
0
 /// <summary>
 /// 更新访问计数
 /// </summary>
 /// <param name="inModel"></param>
 /// <returns></returns>
 public static int UpdateVC(Model.MVisitorCount inModel)
 {
     return(Data.DVisitorCount.UpdateVC(inModel));
 }
Exemple #6
0
 /// <summary>
 /// 添加访问计数
 /// </summary>
 /// <param name="inModel"></param>
 /// <returns></returns>
 public static int InsertVC(Model.MVisitorCount inModel)
 {
     return(Data.DVisitorCount.InsertVC(inModel));
 }