/// <summary> /// 镇级责任人 /// </summary> /// <param name="request"></param> /// <returns></returns> public List <DSTownPersonLiableViewModel> TownPersLiableList(TownPersLiableList request) { List <DSTownPersonLiableViewModel> _list = new List <DSTownPersonLiableViewModel>(); List <DataShareReturnModel> list = new List <DataShareReturnModel>(); using (var db = DbFactory.Open()) { if (string.IsNullOrEmpty(request.username.Trim()) || string.IsNullOrEmpty(request.password.Trim()) || string.IsNullOrEmpty(request.adcd.Trim())) { throw new Exception("账号,密码,adcd不能为空!"); } //var f_user = db.Single<UserInfo>(w => w.UserName == request.username.Trim() && w.PassWord == DESHelper.DESEncrypt(request.password.Trim()) && w.adcd == request.adcd.Trim() && w.isEnable == true); list = db.SqlList <DataShareReturnModel>("EXEC DataShareGetUser @username,@password", new { UserName = request.username, Password = request.password }); if (list != null) { var builder = db.From <TownPersonLiable>(); if (list[0].adcd.Contains("00000000000")) { //市 //builder.Where(w=> w.adcd.StartsWith(f_user.adcd.Substring(0, 4))); //builder.Select("adcd,Name,Post,Position,Mobile,Remark"); //_list = db.Select<TownPersonLiableViewModel>(builder); _list = db.SqlList <DSTownPersonLiableViewModel>("EXEC TownList @adcd", new { adcd = list[0].adcd.Substring(0, 4) }); } else if (list[0].adcd.Contains("000000000")) { //县 //builder.Where(w => w.adcd.StartsWith(f_user.adcd.Substring(0, 6))); //builder.Select("adcd,Name,Post,Position,Mobile,Remark"); //_list = db.Select<TownPersonLiableViewModel>(builder); _list = db.SqlList <DSTownPersonLiableViewModel>("EXEC TownList @adcd", new { adcd = list[0].adcd.Substring(0, 6) }); } else { } } return(_list); } }
//镇级责任人 public List <DSTownPersonLiableViewModel> POST(TownPersLiableList request) { return(DataShareManager.TownPersLiableList(request)); }