/// <summary>
        /// Query count of likes for a content
        /// </summary>
        /// <param name="contentHandle">Content handle</param>
        /// <returns>Likes count for a content</returns>
        public async Task <long?> QueryLikesCount(string contentHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Likes);

            CountTable  countTable  = this.tableStoreManager.GetTable(ContainerIdentifier.Likes, TableIdentifier.LikesCount) as CountTable;
            CountEntity countEntity = await store.QueryCountAsync(countTable, contentHandle, this.tableStoreManager.DefaultCountKey);

            if (countEntity == null)
            {
                return(null);
            }

            return((long)countEntity.Count);
        }
        /// <summary>
        /// Query count of pins for a user in an app
        /// </summary>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <returns>Pin count for a user handle and app handle</returns>
        public async Task <long?> QueryPinsCount(string userHandle, string appHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Pins);

            CountTable  countTable  = this.tableStoreManager.GetTable(ContainerIdentifier.Pins, TableIdentifier.PinsCount) as CountTable;
            CountEntity countEntity = await store.QueryCountAsync(countTable, userHandle, appHandle);

            if (countEntity == null)
            {
                return(null);
            }

            return((long)countEntity.Count);
        }
Beispiel #3
0
        /// <summary>
        /// Query count of blocked users for a user in an app
        /// </summary>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <returns>Blocked users count for a user handle and app handle</returns>
        public async Task <long?> QueryBlockedUsersCount(string userHandle, string appHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.UserFollowers);

            CountTable  countTable  = this.tableStoreManager.GetTable(ContainerIdentifier.UserFollowers, TableIdentifier.FollowersCount) as CountTable;
            string      countKey    = this.GetCountKey(appHandle, UserRelationshipStatus.Blocked);
            CountEntity countEntity = await store.QueryCountAsync(countTable, userHandle, countKey);

            if (countEntity == null)
            {
                return(null);
            }

            return((long)countEntity.Count);
        }
Beispiel #4
0
        /// <summary>
        /// Look up the number of unique users reporting against a particular user
        /// </summary>
        /// <param name="appHandle">uniquely identifies the app that the user is in</param>
        /// <param name="reportedUserHandle">uniquely identifies the user who is being reported</param>
        /// <returns>a task that returns the number of reports</returns>
        public async Task <long> QueryUserReportCount(string appHandle, string reportedUserHandle)
        {
            // get the table interface
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.UserReports);

            CountTable countByReportedUserTable = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsCountByReportedUser) as CountTable;

            // query the count
            CountEntity countEntity = await store.QueryCountAsync(countByReportedUserTable, appHandle, reportedUserHandle);

            if (countEntity == null || countEntity.PartitionKey != appHandle || countEntity.CountKey != reportedUserHandle)
            {
                return(0);
            }

            return(Convert.ToInt64(countEntity.Count));
        }
        public List <CountEntity> getForm2Verifier(string App_Status, string Division_Cd)
        {
            List <CountEntity> lst = new List <CountEntity>();

            try
            {
                DataSet ds = operation.DDL("Sp_get_Form2_details", App_Status, Division_Cd);
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    var str = new CountEntity
                    {
                        count = item[0].ToString()
                    };
                    lst.Add(str);
                }
            }
            catch (Exception e)
            {
                Log log = new Log();
                log.LogFile("Exception:" + e.Message.ToString(), appRunningId);
            }
            return(lst);
        }
Beispiel #6
0
 // DELETE api/<controller>/5
 public void Delete(CountEntity value)
 {
     BL.deleteCount(value);
 }
Beispiel #7
0
 // PUT api/<controller>/5
 public void Put(int id, [FromBody] CountEntity value)
 {
     BL.updateCount(id, value);
 }
Beispiel #8
0
 // POST api/<controller>
 public void Post([FromBody] CountEntity value)
 {
     BL.saveCount(value);
 }
Beispiel #9
0
 public bool deleteCount(CountEntity count)
 {
     return(DA.deleteCount(count));
 }
Beispiel #10
0
 public bool updateCount(int id, CountEntity count)
 {
     return(DA.updateCount(id, count));
 }
Beispiel #11
0
 public bool saveCount(CountEntity count)
 {
     return(DA.saveCount(count));
 }
Beispiel #12
0
 /// <summary>
 /// 转为计数实体
 /// </summary>
 /// <returns></returns>
 public CountEntity AsCountEntity()
 {
     CountEntity entity = new CountEntity();
     entity.CountType = this.CountType;
     entity.ObjectId = this.ObjectId;
     entity.OwnerId = this.OwnerId;
     entity.StatisticsCount = this.StatisticsCount;
     return entity;
 }