Ejemplo n.º 1
0
        private void BindData(int nextstatus, bool isneeddatasource)
        {
            drpUserRoles.Visible = false;
            DataTable reqList = null;

            int roleId   = Convert.ToInt32(Session["roleId"]);
            int daneshId = business.GetDaneshKadeIdByRoleId(roleId);

            if (nextstatus == (int)CheckOutStatusEnum.CheckOutAllStatusEnum.daneshkade)
            {
                if (daneshId == 0)
                {
                    reqList = business.GetListOFRequestByNextStatus(nextstatus);
                }
                else
                {
                    reqList = business.GetListOFRequestByNextStatusAndDaneshId(nextstatus, daneshId);
                }
            }
            else if (nextstatus == (int)CheckOutStatusEnum.CheckOutAllStatusEnum.archive && roleId != 1)
            {
                reqList = business.GetListOFRequestByNextStatusAndArchiveRole(nextstatus, roleId);
            }
            else
            {
                // reqList = business.GetListOFRequestByNextStatus(nextstatus);

                reqList = business.GetListOFRequestByNextStatusAndDaneshId((int)CheckOutStatusEnum.CheckOutAllStatusEnum.takmil_parvande, daneshId);
            }

            ViewState.Add("status", nextstatus);
            //SwitchColumnsByStatus(nextstatus);
            grd_CheckOutList.DataSource = reqList;
            //grd_CheckOutList.EmptyDataText = "هیچ درخواست تسویه ای پیدا نشد.";
            if (!isneeddatasource)
            {
                grd_CheckOutList.DataBind();
            }

            GridFilterMenu menu = grd_CheckOutList.FilterMenu;

            if (menu.Items.Count > 3)
            {
                int im = 0;
                while (im < menu.Items.Count)
                {
                    if (menu.Items[im].Text == "NoFilter" || menu.Items[im].Text == "Contains" || menu.Items[im].Text == "EqualTo")
                    {
                        im++;
                    }
                    else
                    {
                        menu.Items.RemoveAt(im);
                    }
                }
                foreach (RadMenuItem item in menu.Items)
                {    //change the text for the "StartsWith" menu item
                    if (item.Text == "NoFilter")
                    {
                        item.Text = "حذف فیلتر";
                        //item.Remove();
                    }
                    if (item.Text == "Contains")
                    {
                        item.Text = "شامل";
                        //item.Remove();
                    }
                    if (item.Text == "EqualTo")
                    {
                        item.Text = "مساوی با";
                        //item.Remove();
                    }
                }
            }
        }