Ejemplo n.º 1
0
 public bool IsExists(string relatedTableName, string relatedIdentity, ECountType countType)
 {
     if (GetCountNum(relatedTableName, relatedIdentity, countType) == 0)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public CountInfo()
 {
     countID             = 0;
     publishmentSystemID = 0;
     countYear           = 0;
     countMonth          = 0;
     countDay            = 0;
     countType           = ECountType.UserSubscribe;
     count = 0;
 }
Ejemplo n.º 3
0
 public CountInfo(int countId, int publishmentSystemId, int countYear, int countMonth, int countDay, ECountType countType, int count)
 {
     CountId             = countId;
     PublishmentSystemId = publishmentSystemId;
     CountYear           = countYear;
     CountMonth          = countMonth;
     CountDay            = countDay;
     CountType           = countType;
     Count = count;
 }
Ejemplo n.º 4
0
 public CountInfo(int countID, int publishmentSystemID, int countYear, int countMonth, int countDay, ECountType countType, int count)
 {
     this.countID             = countID;
     this.publishmentSystemID = publishmentSystemID;
     this.countYear           = countYear;
     this.countMonth          = countMonth;
     this.countDay            = countDay;
     this.countType           = countType;
     this.count = count;
 }
Ejemplo n.º 5
0
        public static ListItem GetListItem(ECountType type, bool selected)
        {
            var item = new ListItem(GetText(type), GetValue(type));

            if (selected)
            {
                item.Selected = true;
            }
            return(item);
        }
Ejemplo n.º 6
0
 public static void AddCount(string relatedTableName, string relatedIdentity, ECountType countType)
 {
     if (DataProvider.CountDao.IsExists(relatedTableName, relatedIdentity, countType))
     {
         DataProvider.CountDao.AddCountNum(relatedTableName, relatedIdentity, countType);
     }
     else
     {
         DataProvider.CountDao.Insert(relatedTableName, relatedIdentity, countType, 1);
     }
 }
Ejemplo n.º 7
0
 public static string GetValue(ECountType type)
 {
     if (type == ECountType.View)
     {
         return("View");
     }
     if (type == ECountType.Download)
     {
         return("Download");
     }
     throw new Exception();
 }
Ejemplo n.º 8
0
 public static bool Equals(ECountType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
 public static string GetText(ECountType type)
 {
     if (type == ECountType.UserSubscribe)
     {
         return("用户关注");
     }
     else if (type == ECountType.UserUnsubscribe)
     {
         return("用户取消关注");
     }
     else if (type == ECountType.RequestText)
     {
         return("文本回复");
     }
     else if (type == ECountType.RequestNews)
     {
         return("图文回复");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 14
0
 public static string GetText(ECountType type)
 {
     if (type == ECountType.UserSubscribe)
     {
         return("�û���ע");
     }
     else if (type == ECountType.UserUnsubscribe)
     {
         return("�û�ȡ����ע");
     }
     else if (type == ECountType.RequestText)
     {
         return("�ı��ظ�");
     }
     else if (type == ECountType.RequestNews)
     {
         return("ͼ�Ļظ�");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 15
0
 public static string GetValue(ECountType type)
 {
     if (type == ECountType.UserSubscribe)
     {
         return("UserSubscribe");
     }
     else if (type == ECountType.UserUnsubscribe)
     {
         return("UserUnsubscribe");
     }
     else if (type == ECountType.RequestText)
     {
         return("RequestText");
     }
     else if (type == ECountType.RequestNews)
     {
         return("RequestNews");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 16
0
 public static int GetCount(string relatedTableName, int siteId, ECountType countType)
 {
     return(DataProvider.CountDao.GetCountNum(relatedTableName, siteId, countType));
 }
Ejemplo n.º 17
0
 public static int GetCount(string relatedTableName, string relatedIdentity, ECountType countType)
 {
     return(DataProvider.CountDao.GetCountNum(relatedTableName, relatedIdentity, countType));
 }
Ejemplo n.º 18
0
 public static int GetCount(string relatedTableName, int publishmentSystemId, ECountType countType)
 {
     return(BaiRongDataProvider.CountDao.GetCountNum(relatedTableName, publishmentSystemId, countType));
 }
Ejemplo n.º 19
0
 public static bool Equals(string typeStr, ECountType type)
 {
     return(Equals(type, typeStr));
 }