Exemplo n.º 1
0
        /// <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 GetEmployeeAgent(QueryEmployeeAgent query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;
            if (!string.IsNullOrEmpty(query.AgentNum))
            {
                where += " and AgentNum='" + Utils.StringHelper.SqlFilter(query.AgentNum) + "'";
            }
            if (query.UserID != Constant.INT_INVALID_VALUE)
            {
                where += " and ea.UserID=" + query.UserID.ToString() + "";
            }
            if (query.BGID != Constant.INT_INVALID_VALUE)
            {
                where += " and ea.BGID=" + query.BGID.ToString() + "";
            }

            if (query.RecID != Constant.INT_INVALID_VALUE)
            {
                where += " and ea.RecID=" + query.RecID.ToString() + "";
            }
            if (query.AgentName != Constant.STRING_INVALID_VALUE)
            {
                where += " And TrueName like '%" + Utils.StringHelper.SqlFilter(query.AgentName) + "%'";
            }
            if (query.RegionID != Constant.INT_INVALID_VALUE)
            {
                where += " and ea.RegionID=" + query.RegionID.ToString() + "";
            }
            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;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_EMPLOYEEAGENT_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
        public string LoadSelectedEmployees()
        {
            string selectedStr  = "";
            string EmployeesIDs = "";

            if (Request.QueryString["UserIDs"] == null)
            {
                return("");
            }
            else
            {
                EmployeesIDs = Request.QueryString["UserIDs"].ToString();
            }

            if (EmployeesIDs.Trim() != "")
            {
                string[] EmplloyeeIDArr = EmployeesIDs.Split(',');
                foreach (string EID in EmplloyeeIDArr)
                {
                    int    EID_Int   = Convert.ToInt32(EID);
                    string name      = "";
                    string agentNum  = "";
                    string groupname = "";

                    Entities.QueryEmployeeAgent agentQuery = new QueryEmployeeAgent();
                    agentQuery.UserID = EID_Int;
                    int       totle    = 0;
                    DataTable agent_dt = BLL.EmployeeAgent.Instance.GetEmployeeAgent(agentQuery, "", 1, 1, out totle);

                    if (agent_dt != null && agent_dt.Rows.Count > 0)
                    {
                        agentNum  = agent_dt.Rows[0]["AgentNum"].ToString();
                        groupname = agent_dt.Rows[0]["GroupName"].ToString();
                        name      = agent_dt.Rows[0]["TrueName"].ToString();
                    }

                    selectedStr += "<tr class=\"back\" onmouseout=\"this.className='back'\" onmouseover=\"this.className='hover'\">"
                                   + "<td><a id='" + EID + "' name='" + name + "' href='javascript:DelSelectCustBrand(\"" + EID + "\");\'>"
                                   + "<img title='删除' src='/Images/close.png'></a></td>"
                                   + "<td class='l'> " + name + " </td>"
                                   + "<td class='l'><span style='display:none;'>" + EID_Int + "</span><label>" + agentNum + "</label></td>"
                                   + "<td class='l'> " + getRolesByUserID(EID_Int.ToString()) + " </td>"
                                   + "<td class='l' style='padding-right:10px;'> " + groupname + " </td>"
                                   + "</tr>";
                }
            }
            return(selectedStr);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通过UserID得到一个对象实体
        /// </summary>
        public Entities.EmployeeAgent GetEmployeeAgentByUserID(int UserID)
        {
            QueryEmployeeAgent query = new QueryEmployeeAgent();

            query.UserID = UserID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetEmployeeAgent(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(LoadSingleEmployeeAgent(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
 /// <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 GetEmployeeAgent(QueryEmployeeAgent query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.EmployeeAgent.Instance.GetEmployeeAgent(query, order, currentPage, pageSize, out totalCount));
 }