Пример #1
0
        protected void LoadData()
        {
            string dptList = GetChildrenBySelft();


            Maticsoft.BLL.tTask BLL = new Maticsoft.BLL.tTask();
            string sortField        = GridDpt.SortField;
            string sortDirection    = GridDpt.SortDirection;

            string where = "";
            where       += " SaveDpt in (" + dptList + ")";
            if (drpSearch.SelectedValue != "")
            {
                where += " and IsCheck='" + drpSearch.SelectedValue + "' ";
            }
            if (txtValue.Text.Trim() != "")
            {
                where += " and Title like '%" + txtValue.Text.Trim() + "%' ";
            }


            GridDpt.RecordCount = BLL.GetRecordCount(where);
            DataView view = BLL.GetListByPage(where, " SaveTime desc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;

            view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
            GridDpt.DataSource = view.ToTable();

            GridDpt.DataBind();
        }
        protected void LoadData()
        {
            int dptId = GetIdentityUser().dptId;


            Maticsoft.BLL.tTask BLL = new Maticsoft.BLL.tTask();
            string sortField        = GridDpt.SortField;
            string sortDirection    = GridDpt.SortDirection;

            string where = " IsCheck='已审核' ";


            if (drpSearch.SelectedValue == "")
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0}) ", dptId);
            }
            else if (drpSearch.SelectedValue == "已上报")
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0} and SavaDpt={1}) ", dptId, dptId);
            }
            else
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0} and SavaDpt is null) ", dptId);
            }


            if (txtValue.Text.Trim() != "")
            {
                where += " and (Title like '%" + txtValue.Text.Trim() + "%') or (TaskLevel like '%" + txtValue.Text.Trim() + "%') ";
            }


            GridDpt.RecordCount = BLL.GetRecordCount(where);
            DataView view = BLL.GetListByPage(where, " SaveTime desc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;

            view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
            GridDpt.DataSource = view.ToTable();

            GridDpt.DataBind();
        }