예제 #1
0
        /// <summary>
        /// 统计用户记录过的活动类型
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="dtStart">起始时间</param>
        /// <param name="dtEnd">结束时间</param>
        /// <returns></returns>
        public static long[] GetTypes(long userId, DateTime dtStart, DateTime dtEnd)
        {
            List <QuerylearningActivity> la = LearningActivityDal.GetlearningActivityByUser(userId);

            long[] typeIds = la.Select(a => a.ActivityTypeID).Distinct().ToArray();
            return(typeIds);
        }
예제 #2
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);
        }
예제 #3
0
        public static DataTable DtMyLaCountsEveryType(long userId, DateTime dtStart, DateTime dtEnd)
        {
            DataTable dtcType = new DataTable();

            //Dictionary<string, int> dictLa = new Dictionary<string, int>();
            long[] tps = GetTypes(userId, dtStart, dtEnd);
            if (tps.Length > 0)
            {
                foreach (long typeId in tps)
                {
                    string nameStrs  = DAL.ActivityTypeDAL.GetTypeById(typeId).Action;
                    int    countInts = LearningActivityDal.GetActivitiesByType(userId, typeId).Count;
                    if (countInts != 0)
                    {
                        dtcType.Rows.Add(nameStrs, countInts);
                    }
                }
            }
            return(dtcType);
        }
예제 #4
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);
        }