Esempio n. 1
0
        private void BindRepeater()
        {
            int      recordCount;
            DateTime startDate;

            if (!DateTime.TryParse(txtStartDate.Text, out startDate)) //如果没有填时间,就当前时间减一个星期
            {
                startDate = MinDate;
            }

            DateTime endDate;

            if (!DateTime.TryParse(txtEndDate.Text, out endDate))
            {
                endDate = MinDate;
            }

            List <RequestStatus> status = new List <RequestStatus>();

            switch (UserInfo.Role)
            {
            case RolesEnum.ADMIN:
                status.Add(RequestStatus.Submit);
                break;

            case RolesEnum.PM:
                status.Add(RequestStatus.Open);
                status.Add(RequestStatus.Sealed);
                break;

            default:
                status.Add(RequestStatus.Approved);
                break;
            }

            List <SealRequestsEntity> list =
                app.GetSealRequestsList(UserInfo.UserID, status, int.Parse(ddlSeal.SelectedValue), startDate, endDate
                                        , hidOrderBy.Value, hidOrderDirection.Value, aspNetPager1.CurrentPageIndex, aspNetPager1.PageSize, out recordCount);

            if (recordCount == 0)
            {
                trNoRecords.Visible        = true;
                rptSealsRequest.DataSource = null;
                rptSealsRequest.DataBind();
            }
            else
            {
                trNoRecords.Visible        = false;
                rptSealsRequest.DataSource = list;
                rptSealsRequest.DataBind();
            }
            aspNetPager1.RecordCount = recordCount;
        }
Esempio n. 2
0
        private void BindRepeater()
        {
            int      recordCount;
            DateTime startDate;

            if (!DateTime.TryParse(QS("start"), out startDate))
            {
                startDate = MinDate;
            }
            else
            {
                txtStartDate.Text = startDate.ToString("MM/dd/yyyy");
            }

            DateTime endDate;

            if (!DateTime.TryParse(QS("end"), out endDate))
            {
                endDate = MinDate;
            }
            else
            {
                if (endDate >= startDate)
                {
                    txtEndDate.Text = endDate.ToString("MM/dd/yyyy");
                }
            }
            List <RequestStatus> status = new List <RequestStatus>();

            if (int.Parse(ddlStatus.SelectedValue) >= -1)
            {
                status.Add((RequestStatus)int.Parse(ddlStatus.SelectedValue));
            }

            List <SealRequestsEntity> list =
                app.GetSealRequestsList(UserInfo.UserID, QS("keyword"), int.Parse(ddlType.SelectedValue), status, int.Parse(ddlSeal.SelectedValue), startDate, endDate
                                        , OrderBy, OrderDirection, CurrentPageIndex, anpWaitting.PageSize, out recordCount);

            if (recordCount == 0)
            {
                trNoRecords.Visible        = true;
                rptSealsRequest.DataSource = null;
                rptSealsRequest.DataBind();
            }
            else
            {
                trNoRecords.Visible        = false;
                rptSealsRequest.DataSource = list;
                rptSealsRequest.DataBind();
            }
            anpWaitting.RecordCount = recordCount;
        }