private void BindData()
        {
            QueryEmployeeSuper query = new QueryEmployeeSuper();

            //分页参数赋值
            if (Request.QueryString["EmName"] != null)
            {
                query.TrueName = Request.QueryString["EmName"] == "" ?
                                 Entities.Constants.Constant.STRING_INVALID_VALUE : Request.QueryString["EmName"].ToString();
            }
            int intval = 0;

            if (Request.QueryString["GroupID"] != null && int.TryParse(Request.QueryString["GroupID"].ToString(), out intval))
            {
                query.BGID = Request.QueryString["GroupID"] == "-1" ?
                             Entities.Constants.Constant.INT_INVALID_VALUE : int.Parse(Request.QueryString["GroupID"].ToString());
            }
            int userid = BLL.Util.GetLoginUserID();

            //当用户选择请选择时,查询条件:数据中的分组 in  ( 用户的管辖分组和所属分组  )
            if (query.BGID == Entities.Constants.Constant.INT_INVALID_VALUE)
            {
                query.BGIDs = BLL.EmployeeSuper.Instance.GetCurrentUserGroupIDs(userid);
            }
            //弹出层没有区域查询条件 强斐 2014-12-4
            //query.RegionID = BitAuto.ISDC.CC2012.BLL.EmployeeAgent.Instance.GetEmployeeAgentRegionID(userid);
            //按条件找人:条件-姓名,角色
            DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeSuper(query, "", BLL.PageCommon.Instance.PageIndex, pageSize, out RecordCount);

            RptEm.DataSource = dt;
            RptEm.DataBind();
            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, pageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
        private void BindData()
        {
            int RecordCount          = 0;
            QueryEmployeeSuper query = new QueryEmployeeSuper();

            //分页参数赋值
            query.BGID = 9;
            if (!string.IsNullOrEmpty(TrueName))
            {
                query.TrueName = TrueName;
            }
            //按条件找人:条件-部门,角色-
            DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeSuper(query, "", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount);

            repterPersonlist.DataSource = dt;
            repterPersonlist.DataBind();

            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
Esempio n. 3
0
        //private const string P_CUSTHISTORYINFO_INSERT = "p_CustHistoryInfo_Insert";
        //private const string P_CUSTHISTORYINFO_UPDATE = "p_CustHistoryInfo_Update";
        #endregion

        #region Select
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetEmployeeSuper(QueryEmployeeSuper query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = "";

            #region 部门条件
            if (query.OnlyCCDepart)
            {
                where += " AND UserInfo.Status=0 ";

                if (string.IsNullOrEmpty(query.PartIDType))
                {
                    query.PartIDType = "YichePartID";
                }
                string PartIDs  = BitAuto.Utils.Config.ConfigurationUtil.GetAppSettingValue(query.PartIDType);
                int    DepCount = PartIDs.Split(',').Length;
                if (DepCount > 0)
                {
                    where += " AND (";
                    for (int i = 0; i < DepCount; i++)
                    {
                        if (i != 0)
                        {
                            where += " OR ";
                        }
                        where += " UserInfo.DepartID IN (SELECT ID FROM SysRightsManager.dbo.f_Cid('" + PartIDs.Split(',')[i] + "')) ";
                    }
                    where += " )";
                }
            }
            #endregion

            if (query.UsercodeNotEmpty)
            {
                where += " AND SysRightsManager.dbo.UserInfo.UserCode >''";
            }

            if (query.TrueName != Constant.STRING_INVALID_VALUE)
            {
                where += " AND TrueName LIKE '%" + Utils.StringHelper.SqlFilter(query.TrueName) + "%'";
            }
            if (query.AgentNum != Constant.STRING_INVALID_VALUE)
            {
                where += " AND AgentNum='" + StringHelper.SqlFilter(query.AgentNum.ToString()) + "'";
            }
            if (query.RightType != Constant.INT_INVALID_VALUE)
            {
                where += " AND RightType=" + query.RightType.ToString();
            }
            if (query.Role != Constant.STRING_INVALID_VALUE)
            {
                where += " AND SysRightsManager.dbo.UserRole.RoleID IN (" + Dal.Util.SqlFilterByInCondition(query.Role) + ")";
            }
            if (query.BGID != Constant.INT_INVALID_VALUE && query.BGID > 0)
            {
                where += " AND CC2012.dbo.EmployeeAgent.BGID=" + query.BGID;
            }
            else
            {
                where += " AND CC2012.dbo.EmployeeAgent.BGID IS NOT NULL ";
            }
            if (query.RegionID != Constant.INT_INVALID_VALUE && query.RegionID > 0)
            {
                where += " AND CC2012.dbo.EmployeeAgent.RegionID=" + query.RegionID;
            }
            if (!string.IsNullOrEmpty(query.BGIDs))
            {
                //where += " and CC2012.dbo.EmployeeAgent.BGID in (" + Dal.Util.SqlFilterByInCondition(query.BGIDs) + ")";
                //包含本人
                where += " AND (CC2012.dbo.EmployeeAgent.BGID IN (" + Dal.Util.SqlFilterByInCondition(query.BGIDs) + ") "
                         + "OR SysRightsManager.dbo.UserInfo.UserID=" + query.ContainLoginUserID + ")";
            }
            if (query.UserID != Constant.INT_INVALID_VALUE)
            {
                where += " AND SysRightsManager.dbo.UserInfo.UserID=" + query.UserID.ToString();
            }
            if (query.ADName != Constant.STRING_INVALID_VALUE && query.ADName != Constant.STRING_EMPTY_VALUE)
            {
                where += " AND SysRightsManager.dbo.UserInfo.ADName='" + StringHelper.SqlFilter(query.ADName.Trim()) + "'";
            }
            if (!string.IsNullOrEmpty(query.SelectUserIdSql))
            {
                where += " AND CC2012.dbo.EmployeeAgent.UserID IN (SELECT UserID FROM #tmp) ";
            }
            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = order;
            parameters[2].Value     = pageSize;
            parameters[3].Value     = currentPage;
            parameters[4].Direction = ParameterDirection.Output;

            using (SqlConnection connection = new SqlConnection(CONNECTIONSTRINGS))
            {
                connection.Open();
                if (!string.IsNullOrEmpty(query.SelectUserIdSql))
                {
                    SqlHelper.ExecuteNonQuery(connection, CommandType.Text, query.SelectUserIdSql);
                }
                ds         = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, P_ZuoxiList_Select, parameters);
                totalCount = (int)(parameters[4].Value);
                return(ds.Tables[0]);
            }
        }
        public DataTable GetAgentInfoByCondition(string Verifycode, AgentInfoCondition AgentInfoCondition, int PageSize, int PageIndex, ref int RecordCount, ref string msg)
        {
            try
            {
                #region 记接口调用日志

                StringBuilder infoSb = new StringBuilder();
                infoSb.Append("调用接口GetAgentInfoByCondition!");
                infoSb.Append(";验证码:" + Verifycode);
                if (AgentInfoCondition == null)
                {
                    infoSb.Append(";条件为空;");
                }
                else
                {
                    infoSb.Append(";条件:{LoginUserID:" + AgentInfoCondition.LoginUserID + ",UserID:" + AgentInfoCondition.UserID + ",TrueName:" + AgentInfoCondition.TrueName + ",ADName:" + AgentInfoCondition.ADName + "},");
                }
                infoSb.Append(";PageSize;" + PageSize);
                infoSb.Append(";PageIndex;" + PageIndex);
                BLL.Loger.Log4Net.Info(infoSb.ToString());
                #endregion

                RecordCount = 0;
                if (BLL.CallRecord_ORIG_Authorizer.Instance.Verify(Verifycode, 0, ref msg, "根据当前登录者ID或真实姓名,查询坐席信息,授权失败。"))
                {
                    QueryEmployeeSuper query = new QueryEmployeeSuper();
                    if (AgentInfoCondition != null)
                    {
                        if (AgentInfoCondition.LoginUserID > 0)
                        {
                            Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(AgentInfoCondition.LoginUserID);
                            if (model != null && model.BGID != null && model.BGID > 0)
                            {
                                query.BGID = model.BGID.Value;
                            }
                        }
                        if (AgentInfoCondition.BGID > 0)
                        {
                            query.BGID = AgentInfoCondition.BGID;
                        }
                        if (!string.IsNullOrEmpty(AgentInfoCondition.TrueName))
                        {
                            query.TrueName = AgentInfoCondition.TrueName.Trim();
                        }
                        if (AgentInfoCondition.UserID > 0)
                        {
                            query.UserID = AgentInfoCondition.UserID;
                        }
                        if (AgentInfoCondition.ADName != "")
                        {
                            query.ADName = AgentInfoCondition.ADName.Trim();
                        }
                        query.OnlyCCDepart = true;
                    }
                    query.PartIDType = "PartID";
                    DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeSuper(query, "", PageIndex, PageSize, out RecordCount);
                    return(dt);
                }
                else
                {
                    BLL.Loger.Log4Net.Info("GetAgentInfoByCondition验证失败!msg=" + msg);
                    return(null);
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                BLL.Loger.Log4Net.Info("GetAgentInfoByCondition运行报错!msg=" + ex.StackTrace);
                return(null);
            }
        }
        /// 绑定数据
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            int RecordCount          = 0;
            int userid               = BLL.Util.GetLoginUserID();
            QueryEmployeeSuper query = new QueryEmployeeSuper();

            query.OnlyCCDepart       = true;
            query.ContainLoginUserID = userid;
            //分组
            query.BGID = CommonFunction.ObjectToInteger(BGID, -2);

            //下拉框
            if (query.BGID <= 0)
            {
                string str = "";
                foreach (ListItem item in ddlBussiGroup.Items)
                {
                    str += item.Value + ",";
                }
                if (str.Length > 0)
                {
                    query.BGIDs = str.TrimEnd(',');
                }
                else
                {
                    query.BGIDs = null;
                }
            }
            else
            {
                query.BGIDs = null;
            }

            //用户名称
            if (!string.IsNullOrEmpty(TrueName))
            {
                query.TrueName = TrueName;
            }

            #region 特殊条件
            if (Action == "createuser")
            {
                //创建人-其他任务
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserID as UserID INTO #tmp FROM OtherTaskInfo";
            }
            else if (Action == "operuser")
            {
                //操作人-其他任务
                query.SelectUserIdSql = "SELECT DISTINCT LastOptUserID as UserID INTO #tmp FROM OtherTaskInfo";
            }
            else if (Action == "addblackdatauser")
            {
                //添加入—黑名单
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserId as UserID INTO #tmp FROM dbo.BlackWhiteList WHERE [type] = 0 and [Status]=0";
            }
            else if (Action == "addwhitedatauser")
            {
                //添加人—白名单
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserId as UserID INTO #tmp FROM dbo.BlackWhiteList WHERE [type] = 1 and [Status]=0";
            }
            else if (Action == "employee")
            {
                //坐席-其他任务
                query.SelectUserIdSql = "SELECT DISTINCT UserID as UserID INTO #tmp FROM ProjectTask_Employee WHERE PTID like 'OTH%'";
            }
            else if (Action == "shensuemployee")
            {
                //质量管理-申诉统计
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserID as UserID INTO #tmp FROM CallRecord_ORIG_Business_qs";
            }
            else if (Action == "workordersubmituser")
            {
                //工单记录提交人
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserID as UserID INTO #tmp FROM WorkOrderInfo";
            }
            else if (Action == "worderV2submituser")
            {
                //工单记录提交人
                query.SelectUserIdSql = "SELECT DISTINCT CreateUserID as UserID INTO #tmp FROM WOrderInfo";
            }

            #endregion

            //按条件找人:条件-部门,角色-
            DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeSuper(query, "TrueName", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount);
            repterPersonlist.DataSource = dt;
            repterPersonlist.DataBind();
            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 201);
        }
 /// <summary>
 /// 分页获取员工(多条件搜索)
 /// </summary>
 /// <param name="query"></param>
 /// <param name="order"></param>
 /// <param name="currentPage"></param>
 /// <param name="pageSize"></param>
 /// <param name="totalCount"></param>
 /// <returns></returns>
 public DataTable GetEmployeeSuper(QueryEmployeeSuper query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.EmployeeSuper.Instance.GetEmployeeSuper(query, order, currentPage, pageSize, out totalCount));
 }