public ActionResult DrivingLicenseListProvide(DrivingLicenseDTO drivingLicenseDTO)
        {
            if (!base.HasPermission("DrivingLicense", PermissionOperate.manager))
            {
                return(null);
            }

            int isAll = 1;

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

            OceanDynamicList <object> list = _drivingLicenseService.GetPageDynamicList(PageIndex, PageSize, drivingLicenseDTO, isAll);

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

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

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

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

            if (isAll == 0)
            {
                parms.Add("MpUserId", drivingLicenseDTO.MpUserId);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "MpUserId = @MpUserId";
            }
            return(this.GetDynamicList("SELECT f.Id,f.MpUserId MpUserId,f.CertNo,f.Name,f.Sex,f.Nationality,f.Address,f.Birthday,f.IssueDate,f.Class,f.ValidFrom,f.ValidFor,m.Name BussinesName,f.CreateDate CreateDate FROM DrivingLicense f left join MpUser m on  f.MpUserId = m.ID " + condition + " order by f.CreateDate desc", pageIndex, pageSize, parms));
        }