Пример #1
0
        /// <summary>
        /// 统计用户记录过活动的每个地点的活动数
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="dtStart">起始时间</param>
        /// <param name="dtEnd">结束时间</param>
        /// <returns></returns>
        public static ArrayList MyLaCountsEveryLocation(long userId, DateTime dtStart, DateTime dtEnd)
        {
            ArrayList cLocaArray = new ArrayList();

            //Dictionary<string,int> dictLa=new Dictionary<string, int>();
            long[] ads = GetAddress(userId, dtStart, dtEnd);
            if (ads.Length > 0)
            {
                string[] nameStrs  = new string[ads.Length];
                int[]    countInts = new int[ads.Length];
                int      i         = 0;
                foreach (long locationId in ads)
                {
                    nameStrs[i]   = LocationDAL.GetLoctionById(locationId)[0].Address;
                    countInts [i] = LearningActivityDal.GetActivitiesByLocation(userId, locationId).Count;
                    //dictLa.Add(locaName,laCount);

                    i++;
                }
                cLocaArray.Add(nameStrs);
                cLocaArray.Add(countInts);
            }
            //else
            //{
            //    DAL.Common.Alert("您未曾记录过任何地点的活动!");
            //}
            return(cLocaArray);
        }
Пример #2
0
        /// <summary>
        /// 返回地点和记录数组成的两列数据表
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="dtStart"></param>
        /// <param name="dtEnd"></param>
        /// <returns></returns>
        public static DataTable DtMyLaCountsEveryLocation(long userId, DateTime dtStart, DateTime dtEnd)
        {
            DataTable cLocaDt = new DataTable();

            cLocaDt.Columns.Add("地点", typeof(string));
            cLocaDt.Columns.Add("记录数", typeof(int));
            long[] ads = GetAddress(userId, dtStart, dtEnd);
            if (ads.Length > 0)
            {
                //int i = 0;
                foreach (long locationId in ads)
                {
                    string nameStrs  = LocationDAL.GetLoctionById(locationId)[0].Address;
                    int    countInts = LearningActivityDal.GetActivitiesByLocation(userId, locationId).Count;
                    //dictLa.Add(locaName,laCount);
                    if (countInts != 0)
                    {
                        cLocaDt.Rows.Add(nameStrs, countInts);
                    }
                }
            }
            return(cLocaDt);
        }