Ejemplo n.º 1
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>();

            status.Add(RequestStatus.Draft);
            status.Add(RequestStatus.Denied);
            status.Add(RequestStatus.Submitted);
            status.Add(RequestStatus.PendingApproval);
            status.Add(RequestStatus.Approved);
            status.Add(RequestStatus.PendingProcess);
            status.Add(RequestStatus.Processed);

            //switch (UserInfo.Role)
            //{
            //    case RolesEnum.ADMIN:
            //        status.Add(RequestStatus.Submitted);
            //        break;
            //    case RolesEnum.Sales:
            //        status.Add(RequestStatus.Submitted);
            //        break;
            //    case RolesEnum.PM:
            //        status.Add(RequestStatus.Draft);
            //        status.Add(RequestStatus.Processed);
            //        break;
            //    default:
            //        status.Add(RequestStatus.Approved);
            //        break;
            //}

            List <SealRequestsEntity> list =
                app.GetSealRequestsWaitingList(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;
        }