コード例 #1
0
ファイル: PersonController.cs プロジェクト: RaoLeigf/msyh
        /// <summary>
        /// 获取员工列表数据
        /// </summary>
        /// <returns></returns>
        public string GetEmpList()
        {
            string limit     = System.Web.HttpContext.Current.Request.Params["limit"];
            string page      = System.Web.HttpContext.Current.Request.Params["page"];
            string sqlFilter = System.Web.HttpContext.Current.Request.Params["sqlfilter"];   //组件定义时传入的默认查询串
            string searchTxt = System.Web.HttpContext.Current.Request.Params["searchtxt"];   //输入的查询串
            string empstatus = System.Web.HttpContext.Current.Request.Params["empstatus"];   //员工状态
            string emptype   = System.Web.HttpContext.Current.Request.Params["emptype"];     //员工类型
            string partMark  = System.Web.HttpContext.Current.Request.Params["partmark"];    //显示兼职
            string proyMark  = System.Web.HttpContext.Current.Request.Params["proymark"];    //显示代理

            string oCode      = System.Web.HttpContext.Current.Request.Params["ocode"];      //当前节点
            string leaf       = System.Web.HttpContext.Current.Request.Params["leaf"];       //是否叶子节点
            string relatIndex = System.Web.HttpContext.Current.Request.Params["relatindex"]; //节点关系索引

            string and = " and ", assigntypeFilter = "assigntype is null or assigntype='0'";

            if (string.IsNullOrEmpty(sqlFilter))
            {
                and       = "";
                sqlFilter = "";
            }
            if (!string.IsNullOrEmpty(searchTxt))  //查询串
            {
                sqlFilter += and + searchTxt;
                and        = " and ";
            }
            if (!string.IsNullOrEmpty(empstatus))
            {
                sqlFilter += and + string.Format("hr_epm_main.empstatus='{0}'", empstatus); //员工状态
                and        = " and ";
            }
            if (!string.IsNullOrEmpty(emptype))
            {
                sqlFilter += and + string.Format("hr_epm_main.emptype='{0}'", emptype); //员工类型
                and        = " and ";
            }
            if (!string.IsNullOrEmpty(partMark)) //显示兼职
            {
                assigntypeFilter += " or assigntype='1'";
            }
            if (!string.IsNullOrEmpty(proyMark)) //显示代理
            {
                assigntypeFilter += " or assigntype='2'";
            }

            sqlFilter += and + "(" + assigntypeFilter + ")";
            int totalRecord = 0, pageSize = 20, pageIndex = 0;

            int.TryParse(limit, out pageSize);
            int.TryParse(page, out pageIndex);

            DataTable tmpDT = proxy.GetEmpList(sqlFilter, pageSize, pageIndex, ref totalRecord, oCode, leaf == "true", relatIndex);
            string    str   = DataConverterHelper.ToJson(tmpDT, totalRecord);

            return(str);
        }