Ejemplo n.º 1
0
        public ActionResult GetEmployeeInfo(EmployeeInfoFindModel model, int searchPage)
        {
            SearchDataWithPagedDatas <EmployeeInfoFindModel, EmployeeInfoPageModel> result = new SearchDataWithPagedDatas <EmployeeInfoFindModel, EmployeeInfoPageModel>();

            result.SearchModel = model;
            //result.PagedDatas = EmployeeInfoBLL.GetPagedEmployeeInfo(result.SearchModel, searchPage, this.PageSize);
            result.PagedDatas = EmployeeInfoBLL.GetPagedEmployeeInfo_New(result.SearchModel, searchPage, this.PageSize, base.CurrentStrucID);
            return(PartialView("_EmployeeInfoPagedGrid", result));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取员工信息分页数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="searchPage"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public static AsiatekPagedList <EmployeeInfoPageModel> GetPagedEmployeeInfo_New(EmployeeInfoFindModel model, int searchPage, int pageSize, int strucID)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "EmployeeInfo AS E"),
                new SqlParameter("@joinStr", @" INNER JOIN  Func_GetStrucAndSubStrucByUserAffiliatedStrucID(" + strucID + ") AS S ON E.StrucID = S.ID"),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "E.ID DESC"),
                new SqlParameter("@showColumns", @"E.ID,E.EmployeeName,E.EmployeeGender,E.IsDriver,E.IsCarrier,
                                                                                 E.CertificateCode,E.ContactPhone,E.EmergePhone,S.StrucName"),
            };

            #region 筛选条件
            string conditionStr = "E.Status=0";
            if (!string.IsNullOrWhiteSpace(model.EmployeeName))
            {
                conditionStr += " AND E.EmployeeName LIKE '%" + model.EmployeeName + "%'";
            }

            if (!string.IsNullOrWhiteSpace(model.CertificateCode))
            {
                conditionStr += " AND E.CertificateCode LIKE '%" + model.CertificateCode + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.ContactPhone))
            {
                conditionStr += " AND E.ContactPhone LIKE '%" + model.ContactPhone + "%'";
            }
            if (model.IsCarriers != -1)
            {
                conditionStr += " AND E.IsCarrier LIKE '%" + model.IsCarriers + "%'";
            }
            if (model.IsDrivers != -1)
            {
                conditionStr += " AND E.IsDriver LIKE '%" + model.IsDrivers + "%'";
            }
            if (model.SearchStrucID.HasValue)
            {
                conditionStr += " AND E.StrucID = " + model.SearchStrucID + "";
            }

            paras.Add(new SqlParameter("@conditionStr", conditionStr));

            #endregion

            paras.Add(new SqlParameter()
            {
                ParameterName = "@totalItemCount",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            paras.Add(new SqlParameter()
            {
                ParameterName = "@newCurrentPage",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            List <EmployeeInfoPageModel> list = ConvertToList <EmployeeInfoPageModel> .Convert(MSSQLHelper.ExecuteDataTable(CommandType.StoredProcedure, "Proc_GetPagedDatas", paras.ToArray()));

            int totalItemCount = Convert.ToInt32(paras[paras.Count - 2].Value);
            int newCurrentPage = Convert.ToInt32(paras[paras.Count - 1].Value);
            return(list.ToPagedList(newCurrentPage, pageSize, totalItemCount));
        }