Exemplo n.º 1
0
        public void bindGrid()
        {
            DataGrid1.Columns[2].Visible = false;
            string Sql = " where 1=1 ";

            switch (jpdProcesstype.SelectedValue)
            {
            case "0":      //未处理
                Sql += " and HandleDate is null and Isdelete=0 and HandleStatus=0 ";
                DataGrid1.Columns[2].Visible = true;
                break;

            case "1":      //已处理
                Sql += " and HandleDate is not null and Isdelete=0 and (HandleStatus=9 or HandleStatus=8 or HandleStatus=3 or HandleStatus=2) ";
                break;

            case "2":      //暂不处理
                Sql += " and Isdelete=1 and HandleStatus!=3 and HandleBoxGuid='' ";
                break;

            case "3":      //全部
                break;
            }

            #region  出可用的信箱过滤
            if (Request.QueryString["BoxGuid"] != "" && Request.QueryString["BoxGuid"] != null)
            {
                //选择单个信箱的内容
                Sql += " and BoxGuid='" + Request.QueryString["BoxGuid"] + "'";
            }
            else
            {
                //先选出所有具有权限的信箱
                string FilterStr = "(HandleType='P' and HandleDetail='" + Session["UserGuid"].ToString() + "') ";
                string OuGuid    = Session["OuGuid"].ToString();
                while (OuGuid != "")
                {
                    FilterStr += " or (HandleType='D' and HandleDetail='" + OuGuid + "') ";
                    OuGuid     = dept.GetDetail(OuGuid).ParentOUGuid;
                }
                DataView dvRight = BoxMana.SelectHandleUserBySql(FilterStr);

                if (Request.QueryString["BoxGroupID"] != "" && Request.QueryString["BoxGroupID"] != null)
                {                                                                                         //选择单个组别下的
                    DataView dvGroups = BoxMana.BoxSelectByBoxGroupID(Request.QueryString["BoxGroupID"]); //选择组别下所有的邮箱

                    FilterStr = "(";
                    for (int i = 0; i < dvGroups.Count; i++)
                    {
                        dvRight.RowFilter = "BoxGuid='" + dvGroups[i]["BoxGuid"] + "'";
                        if (dvRight.Count > 0)
                        {
                            FilterStr += "'" + dvRight[0]["BoxGuid"].ToString() + "',";
                        }
                    }
                    if (FilterStr != "(")
                    {
                        Sql += " and BoxGuid in " + FilterStr.Substring(0, FilterStr.Length - 1) + ") ";
                    }
                }
                else//选择所有的
                {
                    if (dvRight.Count == 0)//没有可用的信箱
                    {
                        Sql += " and 1=2";
                    }
                    else
                    {
                        if (dvRight.Count == 1)
                        {
                            Sql += " and BoxGuid='" + dvRight[0]["BoxGuid"].ToString() + "'";
                        }
                        else
                        {
                            //FilterStr = "(";
                            //for (int i = 0; i < dvRight.Count; i++)
                            //{
                            //    FilterStr += "'" + dvRight[i]["BoxGuid"].ToString() + "',";
                            //}
                            //Sql += " and BoxGuid in " + FilterStr.Substring(0, FilterStr.Length - 1) + ") ";

                            for (int i = 0; i < dvRight.Count; i++)
                            {
                                if (i == 0)
                                {
                                    FilterStr = "('" + dvRight[i]["BoxGuid"].ToString() + "'";
                                }
                                else if (i == dvRight.Count - 1)
                                {
                                    FilterStr += ",'" + dvRight[i]["BoxGuid"].ToString() + "')";
                                }
                                else
                                {
                                    FilterStr += ",'" + dvRight[i]["BoxGuid"].ToString() + "'";
                                }
                            }
                            Sql += " and BoxGuid in " + FilterStr.ToString() + "  ";
                        }
                    }
                }
            }
            #endregion

            if (txtpostuser.Text.Trim().Replace("'", "") != "")
            {
                Sql += " and PostUserName like '%" + txtpostuser.Text.Trim().Replace("'", "") + "%'";
            }

            // added by lulj at 2009/4/27
            if (this.txtConsultPWD.Text.Trim().Replace("'", "") != "")
            {
                Sql += " and ConsultPWD like '%" + txtConsultPWD.Text.Trim().Replace("'", "") + "%'";
            }
            if (this.txtShouLiDept.Text.Trim().Replace("'", "") != "")
            {
                Sql += " and OUName like '%" + txtShouLiDept.Text.Trim().Replace("'", "") + "%'";
            }

            int      TotalNum = 0;
            DataView myDt;
            myDt = mana.GetDataPage(
                "*",
                "VIEW_WEBDBCONSULTANDHANDLE",//
                Sql,
                " order by OrderNum desc,Row_ID desc",
                "Row_ID",
                Pager.PageSize,
                Pager.CurrentPageIndex,
                txtTitle.Text,
                DateFromTo1.FromValue,
                DateFromTo1.ToValue,
                out TotalNum
                );

            Pager.RecordCount     = TotalNum;
            Pager.CustomInfoText  = "记录总数:<font color=\"blue\"><b>" + Pager.RecordCount.ToString() + "</b></font>";
            Pager.CustomInfoText += " 每页:<font color=\"blue\"><b>" + Pager.PageSize.ToString() + "</b></font>";
            Pager.CustomInfoText += " 总页数:<font color=\"blue\"><b>" + Pager.PageCount.ToString() + "</b></font>";
            Pager.CustomInfoText += " 当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>";

            AspNetPager1.RecordCount     = TotalNum;
            AspNetPager1.CustomInfoText  = "记录总数:<font color=\"blue\"><b>" + Pager.RecordCount.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 每页:<font color=\"blue\"><b>" + Pager.PageSize.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 总页数:<font color=\"blue\"><b>" + Pager.PageCount.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>";

            Epoint.Frame.Bizlogic.common.DisplayPagerControl(Pager.PageCount, Pp1, Pp2);

            DataGrid1.DataSource = myDt;
            DataGrid1.DataBind();

            /// 判断是否现实在网上发布列
            if (new Epoint.Frame.Bizlogic.Frame_Config().GetDetail("Consult_EnablePubAtReply").ConfigValue == "0")
            {
                foreach (DataGridColumn column in DataGrid1.Columns)
                {
                    if (column.HeaderText == "网上发布")
                    {
                        column.Visible = false;
                    }
                }
            }

            if (new Epoint.Frame.Bizlogic.Frame_Config().GetDetail("IsShowConsultBoxManyidu").ConfigValue == "0")
            {
                foreach (DataGridColumn column in DataGrid1.Columns)
                {
                    if (column.HeaderText == "满意度反馈")
                    {
                        column.Visible = false;
                    }
                }
            }
        }
        public void bindGrid()
        {
            string Sql = " where HandleBoxGuid='' ";

            switch (jpdProcesstype.SelectedValue)
            {
            case "0":      //未分发
                Sql += " and (InfoStatus=0 or infostatus=2) and Isdelete='0'";
                break;

            case "1":      //已分发
                Sql += " and (InfoStatus =1 or infostatus=3) and Isdelete='0'";
                break;

            case "2":      //暂不处理
                Sql += " and Isdelete='1'";
                break;

            case "4":      //待交办、已处理、未处理
                Sql += " and Isdelete='0' and (InfoStatus =1 or infostatus=3 or InfoStatus=0 or infostatus=2 or InfoStatus=8)";
                break;

            case "5":      //待交办
                Sql += " and Isdelete='0' and (InfoStatus =0 or infostatus=2)";
                break;

            case "6":      //未处理
                Sql += " and Isdelete='0' and (InfoStatus =1 or infostatus=3)";
                break;

            case "7":      //已处理
                Sql += " and Isdelete='0' and (InfoStatus=8)";
                break;

            case "8":      //已办结
                Sql += " and Isdelete='0' and (InfoStatus=9)";
                break;

            case "3":      //全部
                break;
            }


            #region  出可用的信箱过滤
            if (Request.QueryString["BoxGuid"] != "" && Request.QueryString["BoxGuid"] != null)
            {
                //选择单个信箱的内容
                Sql += " and UserSendToBoxGuid='" + Request.QueryString["BoxGuid"] + "'";
            }
            else
            {
                //先选出所有具有权限的信箱
                string FilterStr = "(HandleType='P' and HandleDetail='" + Session["UserGuid"].ToString() + "') ";
                string OuGuid    = Session["OuGuid"].ToString();
                while (OuGuid != "")
                {
                    FilterStr += " or (HandleType='D' and HandleDetail='" + OuGuid + "') ";
                    OuGuid     = dept.GetDetail(OuGuid).ParentOUGuid;
                }
                DataView dvRight = BoxMana.SelectHandleUserBySql(FilterStr);

                if (Request.QueryString["BoxGroupID"] != "" && Request.QueryString["BoxGroupID"] != null)
                {                                                                                         //选择单个组别下的
                    DataView dvGroups = BoxMana.BoxSelectByBoxGroupID(Request.QueryString["BoxGroupID"]); //选择组别下所有的邮箱

                    FilterStr = "(";
                    for (int i = 0; i < dvGroups.Count; i++)
                    {
                        dvRight.RowFilter = "BoxGuid='" + dvGroups[i]["BoxGuid"] + "'";
                        if (dvRight.Count > 0)
                        {
                            FilterStr += "'" + dvRight[0]["BoxGuid"].ToString() + "',";
                        }
                    }
                    if (FilterStr != "(")
                    {
                        Sql += " and UserSendToBoxGuid in " + FilterStr.Substring(0, FilterStr.Length - 1) + ") ";
                    }
                }
                else//选择所有的
                {
                    if (dvRight.Count == 0)//没有可用的信箱
                    {
                        Sql += " and 1=2";
                    }
                    else
                    {
                        if (dvRight.Count == 1)
                        {
                            Sql += " and UserSendToBoxGuid='" + dvRight[0]["BoxGuid"].ToString() + "'";
                        }
                        else
                        {
                            for (int i = 0; i < dvRight.Count; i++)
                            {
                                if (i == 0)
                                {
                                    FilterStr = "('" + dvRight[i]["BoxGuid"].ToString() + "'";
                                }
                                else if (i == dvRight.Count - 1)
                                {
                                    FilterStr += ",'" + dvRight[i]["BoxGuid"].ToString() + "')";
                                }
                                else
                                {
                                    FilterStr += ",'" + dvRight[i]["BoxGuid"].ToString() + "'";
                                }
                            }
                            Sql += " and UserSendToBoxGuid in " + FilterStr.ToString() + "  ";
                        }
                    }
                }
            }
            #endregion

            if (txtpostuser.Text.Trim().Replace("'", "") != "")
            {
                Sql += " and PostUserName like '%" + txtpostuser.Text.Trim().Replace("'", "") + "%'";
            }

            int      TotalNum = 0;
            DataView myDt;
            myDt = mana.GetDataPage(
                "*",
                "RG_ConsultHistory",
                Sql,
                " order by OrderNum desc,InfoKey desc",
                "InfoKey",
                Pager.PageSize,
                Pager.CurrentPageIndex,
                txtTitle.Text,
                DateFromTo1.FromValue,
                DateFromTo1.ToValue,
                out TotalNum
                );

            Pager.RecordCount     = TotalNum;
            Pager.CustomInfoText  = "记录总数:<font color=\"blue\"><b>" + Pager.RecordCount.ToString() + "</b></font>";
            Pager.CustomInfoText += " 每页:<font color=\"blue\"><b>" + Pager.PageSize.ToString() + "</b></font>";
            Pager.CustomInfoText += " 总页数:<font color=\"blue\"><b>" + Pager.PageCount.ToString() + "</b></font>";
            Pager.CustomInfoText += " 当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>";

            AspNetPager1.RecordCount     = TotalNum;
            AspNetPager1.CustomInfoText  = "记录总数:<font color=\"blue\"><b>" + Pager.RecordCount.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 每页:<font color=\"blue\"><b>" + Pager.PageSize.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 总页数:<font color=\"blue\"><b>" + Pager.PageCount.ToString() + "</b></font>";
            AspNetPager1.CustomInfoText += " 当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>";
            Epoint.Frame.Bizlogic.common.DisplayPagerControl(Pager.PageCount, Pp1, Pp2);
            DataGrid1.DataSource = myDt;
            DataGrid1.DataBind();
        }