/// <summary> /// 获取机构列表 /// </summary> /// <param name="paraList"></param> /// <returns></returns> public ManageResponse <List <Org> > GetOrgsList(ManagePara <SearhOrg> paraList) { ManageResponse <List <Org> > result = new ManageResponse <List <Org> > { Ok = true }; try { result = userDal.GetOrgsList(paraList); } catch (Exception ex) { result.Ok = false; result.Result = "异常";//CustomInfo result.Code = "002"; } return(result); }
// GET: Data //public ActionResult Index() //{ // return View(); //} /// <summary> /// 获取列表信息 /// </summary> /// <returns></returns> public JsonResult GetOrgsList() { string data = Request["data"] ?? string.Empty; SearhOrg serPre = new SearhOrg(); //JsonConvert.DeserializeObject<SearhOrg>(data); serPre.KeyWord = Server.UrlDecode(data); ManagePara <SearhOrg> paraList = new ManagePara <SearhOrg>();//参数类初始化 paraList.Para = serPre; paraList.PageIndex = Convert.ToInt32(Request["currentPage"] ?? (1).ToString());//接收分页参数 paraList.PageSize = Convert.ToInt32(Request.Form.Get("pageSize") ?? (10).ToString()); ManageResponse <List <Org> > response = newsBll.GetOrgsList(paraList); response.TagValue = paraList.PageIndex.ToString(); JsonResult json = new JsonResult { Data = response, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(json); }
/// <summary> /// 获取机构列表 /// </summary> /// <param name="paraList"></param> /// <returns></returns> public ManageResponse <List <Org> > GetOrgsList(ManagePara <SearhOrg> paraList) { List <MySqlParameter> mySqlParams = new List <MySqlParameter>(); string whereClause = ConvertQuery(paraList.Para, mySqlParams); ManageResponse <List <Org> > result = new ManageResponse <List <Org> >(); string order = " o.UpdateTime DESC,o.OrgId desc"; string countSql = string.Format("SELECT count(1) FROM `ourtool`.`ParentsOrg` o where 1=1 {0} ;", whereClause); //string bandSql = string.Format("SELECT count(1) FROM `mfg_user` u WHERE 1=1 and UserRole in (2,3,4) and u.IsEffect=1 AND u.IsFrozen=1 {0} ;", whereClause);//禁用 string searchSql = string.Format("SELECT `OrgId`, `ImgUrl`, `Content`, `ReMark`, `LInkMan`, `LinkTel`, `ProvinceId`, `CityId`, `CountyId`, `CreateTime`, `UpdateTime`,OrgName,Address FROM `ourtool`.`ParentsOrg` o WHERE 1=1 {0} ORDER BY {3} LIMIT {1},{2};", whereClause, (paraList.PageIndex - 1) * paraList.PageSize, paraList.PageSize, order); result.PageSum = Convert.ToInt32(DBHelper.GetScalarFile(countSql, mySqlParams.ToArray()));//总数 //result.TagValue = DBHelper.GetScalarFile(bandSql, mySqlParams.ToArray()).ToString();//禁用人数 if (result.PageSum > 0) { result.Data = DBHelper.GetDataInfolList(searchSql, GetOrgListTran, mySqlParams.ToArray()); } return(result); }