Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProjectManager     projectManager     = new ProjectManager();
            CalculationManager calculationManager = new CalculationManager();

            projectManager.OverDate();

            this.EnableViewState            = false;
            Session["SumOfProject"]         = calculationManager.SumOfProject();
            Session["SumOfCurrentMoney"]    = calculationManager.SumOfCurrentMoney();
            Session["SumOfSupportProjects"] = calculationManager.SumOfSupportProjects();
            ClassifyManager classifyManager = new ClassifyManager();

            this.TypeList.DataSource = classifyManager.GetAllList();
            int pageIndex;
            int pageSize = 16;

            if (!int.TryParse(Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageCount = projectManager.GetPageCount(pageSize);

            PageCount = pageCount;
            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            PageIndex = pageIndex;
            string keyword = Request.QueryString["KeyWords"];

            this.ProjectList.DataSource = projectManager.GetPageList(PageIndex, pageSize, keyword);
            string       id         = Request["classifyId"];
            int          classifyId = Session["classifyId"] == null ? 0 : Convert.ToInt32(Session["classifyId"]);
            ProjectState state      = Session["state"] == null ? ProjectState.Null : (ProjectState)Enum.Parse(typeof(ProjectState), Session["state"].ToString());

            if (ProjectState.TryParse(Request["state"], out state) | int.TryParse(Request["classifyId"], out classifyId))
            {
                State                       = state;
                ClassifyId                  = classifyId;
                Session["classifyId"]       = classifyId;
                Session["state"]            = state;
                PageCount                   = projectManager.GetPageCount(classifyId, state, pageSize);
                pageIndex                   = pageIndex < 1 ? 1 : pageIndex;
                pageIndex                   = pageIndex > PageCount ? PageCount : pageIndex;
                PageIndex                   = pageIndex;
                this.ProjectList.DataSource = projectManager.GetPageListForState(PageIndex, pageSize, classifyId, state);
            }
            else
            {
                PageCount = projectManager.GetPageCount(pageSize);
                pageIndex = pageIndex < 1 ? 1 : pageIndex;
                pageIndex = pageIndex > PageCount ? PageCount : pageIndex;
                PageIndex = pageIndex;
                this.ProjectList.DataSource = projectManager.GetPageList(PageIndex, pageSize, keyword);
            }
            DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.EnableViewState = false;
            ProjectManager projectManager = new ProjectManager();
            //int State = int.Parse(Request.QueryString["State"]);
            //projectManager.GetPageListForState()
            int pageIndex;
            int pageSize = 16;

            if (!int.TryParse(Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            //ProjectState state = Session["state"] == null ? ProjectState.Null : (ProjectState)Enum.Parse(typeof(ProjectState), Session["state"].ToString());
            ProjectState state = Request["state"] == null ? ProjectState.Null : (ProjectState)Enum.Parse(typeof(ProjectState), Request["state"].ToString());

            if (Request["state"] != null)
            {
                Session["state"] = Convert.ToInt32(state);
            }
            int classifyId = Request["classifyId"] == null ? 0 : Convert.ToInt32(Request["classifyId"]);

            if (Request["classifyId"] != null)
            {
                Session["classifyId"] = classifyId;
            }
            //第二次
            State = state;
            //if (State == Model.ProjectState.Null)
            //{
            //    ClassifyId = classifyId;
            //    Session["classifyId"] = classifyId;
            //    Session["state"] = state;
            //    PageCount = projectManager.GetPageCount(classifyId, state, pageSize);
            //    pageIndex = pageIndex < 1 ? 1 : pageIndex;
            //    pageIndex = pageIndex > PageCount ? PageCount : pageIndex;
            //    PageIndex = pageIndex;
            //    this.ProjectList.DataSource = projectManager.GetPageListForState(PageIndex, pageSize, classifyId, state);
            //}
            ClassifyId = classifyId;
            PageCount  = projectManager.GetPageCount(classifyId, state, pageSize);
            pageIndex  = pageIndex < 1 ? 1 : pageIndex;
            pageIndex  = pageIndex > PageCount ? PageCount : pageIndex;
            PageIndex  = pageIndex;
            this.ProjectList.DataSource = projectManager.GetPageListForState(PageIndex, pageSize, classifyId, state);
            ClassifyManager classifyManager = new ClassifyManager();

            this.TypeList.DataSource = classifyManager.GetAllList();
            DataBind();
        }