示例#1
0
        public void AddCountNum(string relatedTableName, string relatedIdentity, ECountType countType)
        {
            var sqlString = $"UPDATE siteserver_Count SET {SqlUtils.ToPlusSqlString("CountNum")} WHERE RelatedTableName = @RelatedTableName AND RelatedIdentity = @RelatedIdentity AND CountType = @CountType";

            var insertParms = new IDataParameter[]
            {
                GetParameter(ParmRelatedTableName, DataType.VarChar, 255, relatedTableName),
                GetParameter(ParmRelatedIdentity, DataType.VarChar, 255, relatedIdentity),
                GetParameter(ParmCountType, DataType.VarChar, 50, ECountTypeUtils.GetValue(countType)),
            };

            ExecuteNonQuery(sqlString, insertParms);
        }
示例#2
0
        public void Insert(string relatedTableName, string relatedIdentity, ECountType countType, int countNum)
        {
            const string sqlString = "INSERT INTO siteserver_Count (RelatedTableName, RelatedIdentity, CountType, CountNum) VALUES (@RelatedTableName, @RelatedIdentity, @CountType, @CountNum)";

            var insertParms = new IDataParameter[]
            {
                GetParameter(ParmRelatedTableName, DataType.VarChar, 255, relatedTableName),
                GetParameter(ParmRelatedIdentity, DataType.VarChar, 255, relatedIdentity),
                GetParameter(ParmCountType, DataType.VarChar, 50, ECountTypeUtils.GetValue(countType)),
                GetParameter(ParmCountNum, DataType.Integer, countNum)
            };

            ExecuteNonQuery(sqlString, insertParms);
        }
示例#3
0
        public object GetValue(string attributeName)
        {
            foreach (var name in AllAttributes)
            {
                if (!StringUtils.EqualsIgnoreCase(name, attributeName))
                {
                    continue;
                }

                var nameVlaue = GetType().GetProperty(name).GetValue(this, null);

                return(attributeName == "CountType" ? ECountTypeUtils.GetEnumType(nameVlaue.ToString()) : nameVlaue);
            }
            return(null);
        }
示例#4
0
        /// <summary>
        /// 获取站点的统计数据
        /// </summary>
        /// <param name="relatedTableName"></param>
        /// <param name="siteId"></param>
        /// <param name="countType"></param>
        /// <returns></returns>
        public int GetCountNum(string relatedTableName, int siteId, ECountType countType)
        {
            var countNum = 0;

            string sqlString =
                $@"select sum(cou.CountNum) from siteserver_Count cou left join {relatedTableName} con on cou.RelatedIdentity = con.ID
where cou.RelatedTableName = '{relatedTableName}'
and con.SiteId = {siteId}
and cou.CountType = '{ECountTypeUtils.GetValue(countType)}'";

            using (var rdr = ExecuteReader(sqlString))
            {
                if (rdr.Read())
                {
                    countNum = GetInt(rdr, 0);
                }
                rdr.Close();
            }
            return(countNum);
        }
示例#5
0
        public int GetCountNum(string relatedTableName, string relatedIdentity, ECountType countType)
        {
            var countNum = 0;

            var parms = new IDataParameter[]
            {
                GetParameter(ParmRelatedTableName, DataType.VarChar, 255, relatedTableName),
                GetParameter(ParmRelatedIdentity, DataType.VarChar, 255, relatedIdentity),
                GetParameter(ParmCountType, DataType.VarChar, 50, ECountTypeUtils.GetValue(countType))
            };

            using (var rdr = ExecuteReader(SqlSelectCountNum, parms))
            {
                if (rdr.Read())
                {
                    countNum = GetInt(rdr, 0);
                }
                rdr.Close();
            }

            return(countNum);
        }