public ActionResult VehicleLicenseListProvide(VehicleLicenseDTO vehicleLicenseDTO)
        {
            if (!base.HasPermission("VehicleLicense", PermissionOperate.manager))
            {
                return(null);
            }

            int isAll = 1;

            if (!base.HasPermission("VehicleLicenseAll", PermissionOperate.manager))
            {
                vehicleLicenseDTO.MpUserId = base.LoginAdmin.MpUserId;
                isAll = 0;
            }

            OceanDynamicList <object> list = _vehicleLicenseService.GetPageDynamicList(PageIndex, PageSize, vehicleLicenseDTO, isAll);

            if (list != null)
            {
                return(Content(list.ToJson(), "text/javascript"));
            }
            else
            {
                return(Content("{\"rows\":[],\"total\":0}", "text/javascript"));
            }
        }
        public ActionResult VehicleLicenseListProvide(VehicleLicenseDTO vehicleLicenseDTO)
        {
            MpUserID = new Guid("E8325C13-9C76-4B70-911E-57395A2F4D69");
            MpUser mpUser = _mpUserService.GetById(MpUserID);

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

            //ViewBag.VehicleList = new JavaScriptSerializer().Serialize(Json(vehicleList).Data); //Json(vehicleList, JsonRequestBehavior.AllowGet);
            //return View(vehicleList);
            if (vehicleList != null)
            {
                return(Content(vehicleList.ToJson(), "text/javascript"));
            }
            else
            {
                return(Content("{\"rows\":[],\"total\":0}", "text/javascript"));
            }
        }
        public OceanDynamicList <object> GetPageDynamicList(int pageIndex, int pageSize, VehicleLicenseDTO vehicleLicenseDTO, int isAll)
        {
            string condition = "";
            Dictionary <string, object> parms = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(vehicleLicenseDTO.Owner))
            {
                parms.Add("Owner", vehicleLicenseDTO.Owner);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "Owner=@Owner";
            }
            if (!string.IsNullOrEmpty(vehicleLicenseDTO.PlateNo))
            {
                parms.Add("PlateNo", vehicleLicenseDTO.PlateNo);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "PlateNo like '%'+@PlateNo+'%'";
            }
            if (vehicleLicenseDTO.StartDate.HasValue)
            {
                parms.Add("StartDate", vehicleLicenseDTO.StartDate);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "f.IssueDate >= @StartDate";
            }
            if (vehicleLicenseDTO.EndDate.HasValue)
            {
                parms.Add("EndDate", vehicleLicenseDTO.EndDate);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "f.IssueDate <= @EndDate";
            }
            if (!string.IsNullOrEmpty(vehicleLicenseDTO.MpUser))
            {
                parms.Add("Name", vehicleLicenseDTO.MpUser);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "Name like '%'+@Name+'%'";
            }

            if (isAll == 0)
            {
                parms.Add("MpUserId", vehicleLicenseDTO.MpUserId);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "MpUserId = @MpUserId";
            }
            return(this.GetDynamicList("SELECT f.Id,f.MpUserId MpUserId,f.PlateNo,f.VehicleType,f.Owner,f.Address,f.UseCharacter,f.CarModel,f.VIN,f.EngineNo,f.RegisterDate,f.IssueDate,m.Name,f.CreateDate CreateDate FROM VehicleLicense f left join MpUser m on  f.MpUserId = m.ID " + condition + " order by f.CreateDate desc", pageIndex, pageSize, parms));
        }