Exemple #1
0
        public ActionResult MyUnderListProvide(MyUnderDTO myUnderDTO)
        {
            if (!base.HasPermission("MyUnder", PermissionOperate.manager))
            {
                return(null);
            }

            int isAll = 1;

            if (!base.HasPermission("MyUnderAll", PermissionOperate.manager))
            {
                myUnderDTO.MpUserId = base.LoginAdmin.MpUserId;
                isAll = 0;
            }
            PagedList <MpUser> list = _userService.GetUnderUsers(PageIndex, PageSize, myUnderDTO, 0);

            return(JsonList <MpUser>(list, list.TotalItemCount));
        }
Exemple #2
0
        public ActionResult MyUnderListProvide(MyUnderDTO myUnderDTO)
        {
            MpUser mpUser = _mpUserService.GetById(MpUserID);

            if (mpUser == null || mpUser.IsAuth != 1)
            {
                return(Json(new { message = "您没有权限,请先申请成为业务员!" }));
            }
            myUnderDTO.MpUserId = MpUserID;
            //IList<VehicleLicense> vehicleList = _vehicleLicenseService.GetList("from VehicleLicense where MpUserId = '" + mpUser.Id + "'");
            PagedList <MpUser> myUnderList = _mpUserService.GetUnderUsers(PageIndex, PageSize, myUnderDTO, 0);

            //ViewBag.VehicleList = new JavaScriptSerializer().Serialize(Json(vehicleList).Data); //Json(vehicleList, JsonRequestBehavior.AllowGet);
            //return View(vehicleList);
            if (myUnderList != null)
            {
                return(JsonList <MpUser>(myUnderList, myUnderList.TotalItemCount));
            }
            else
            {
                return(Content("{\"rows\":[],\"total\":0}", "text/javascript"));
            }
        }
Exemple #3
0
        public PagedList <MpUser> GetUnderUsers(int pageIndex, int pageSize, MyUnderDTO mpUnderDto, int isAll)
        {
            string sql = "select * from MpUser ";

            string condition = "where ParentPhone = (select MobilePhone from MpUser where Id = '" + mpUnderDto.MpUserId + "')";
            Dictionary <string, object> parms = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(mpUnderDto.Name))
            {
                parms.Add("Name", mpUnderDto.Name);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "Name like '%'+@Name+'%'";
            }
            if (!string.IsNullOrEmpty(mpUnderDto.Phone))
            {
                parms.Add("MobilePhone", mpUnderDto.Phone);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "MobilePhone like '%'+@MobilePhone+'%'";
            }

            if ((mpUnderDto.IsAuth.HasValue))
            {
                parms.Add("IsAuth", mpUnderDto.IsAuth);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "IsAuth = @IsAuth";
            }
            if (isAll == 0)
            {
                parms.Add("MpUserId", mpUnderDto.MpUserId);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "ParentPhone = (select MobilePhone from MpUser where Id = @MpUserId)";
            }
            else
            {
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "ParentPhone != ''";
            }

            sql += condition;
            return(this.GetPageList <MpUser>(sql, parms, pageIndex, pageSize));
        }