/// <summary>
        /// 将所需任务等数据提前读入变量并保存到viewstate中,避免在控件中反复用数据库查询,降低repeater控件效率
        /// </summary>
        protected void PreLoadData()
        {
            //获取一年中所有月份的每个月包含的周数量
            weeksOfMonth = tool.GetWeeksOfAllMonth();



            allWorkID = wc.GetAllWorkID();
            int[] existTaskMonths;
            existMonths = new Dictionary <Guid, int[]>();
            existWeeks  = new Dictionary <Guid, Dictionary <int, int> >();
            foreach (Guid wid in allWorkID)
            {
                existTaskMonths = sc.GetExistTaskMonths(wid);
                //判断此项工作是否有月节点计划
                if (existTaskMonths != null)
                {
                    existMonths.Add(wid, sc.GetExistTaskMonths(wid));
                }
                //将某项工作所有周的状态保存至existWeeks中
                existWeeks.Add(wid, sc.GetExistTaskWeeksAndState(wid, true));
            }
            projectCategoryLocationSN = wc.GetProjectCategoryLocationSN();
            //projectCategoryLocationID = wc.GetProjectCategoryLocationID();
            categoryName = wc.GetCategoryName();

            ViewState["weeksOfMonth"] = weeksOfMonth;
            ViewState["allWorkID"]    = allWorkID;
            ViewState["existMonths"]  = existMonths;
            ViewState["existWeeks"]   = existWeeks;
            ViewState["projectCategoryLocationSN"] = projectCategoryLocationSN;
            //ViewState["projectCategoryLocationID"] = projectCategoryLocationID;
            ViewState["categoryName"] = categoryName;
        }
Esempio n. 2
0
        /// <summary>
        /// 预读repeater控件中所需的数据以提高效率
        /// </summary>
        protected void PreLoadData()
        {
            //获取一年中所有月份的每个月包含的周数量
            weeksOfMonth = tool.GetWeeksOfAllMonth();

            allWorkID = wc.GetAllWorkID();

            //foreach(Guid wid in allWorkID)
        }
Esempio n. 3
0
        protected void PreLoadData()
        {
            //获取一年中所有月份的每个月包含的周数量
            weeksOfMonth = tool.GetWeeksOfAllMonth();

            allWorkID = wc.GetAllWorkID();

            existMonths = new Dictionary <Guid, int[]>();
            existWeeks  = new Dictionary <Guid, Dictionary <int, int> >();
            foreach (Guid wid in allWorkID)
            {
                existMonths.Add(wid, sc.GetExistTaskMonths(wid));
                existWeeks.Add(wid, sc.GetExistTaskWeeksAndState(wid, true));
            }

            ViewState["weeksOfMonth"] = weeksOfMonth;
            ViewState["allWorkID"]    = allWorkID;
            ViewState["existMonths"]  = existMonths;
            ViewState["existWeeks"]   = existWeeks;
        }