예제 #1
0
        public ActionResult VehicleLicenseProvide()
        {
            if (string.IsNullOrWhiteSpace(RQuery["VehicleLicenseId"]))
            {
                if (!base.HasPermission("VehicleLicense", PermissionOperate.add))
                {
                    return(JsonMessage(false, "你没有添加驾驶证的权限"));
                }
            }
            else
            {
                if (!base.HasPermission("VehicleLicense", PermissionOperate.edit))
                {
                    return(JsonMessage(false, "你没有编辑驾驶证的权限"));
                }
            }


            VehicleLicense vehicleLicense = new VehicleLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["VehicleLicenseId"]))
            {
                vehicleLicense = _vehicleLicenseService.GetById(new Guid(RQuery["VehicleLicenseId"]));
            }

            UpdateModel <VehicleLicense>(vehicleLicense);
            if (string.IsNullOrWhiteSpace(RQuery["VehicleLicenseId"]))
            {
                //branch.Status = 1;
                try
                {
                    vehicleLicense.CreateDate = DateTime.Now;
                    _vehicleLicenseService.Insert(vehicleLicense);
                }
                catch (System.Exception ex)
                {
                    //
                }
                base.AddLog(string.Format("添加驾驶证[{0}]成功", vehicleLicense.Owner), AdminLoggerModuleEnum.VehicleLicense);
                return(JsonMessage(true, "添加驾驶证成功"));
            }
            else
            {
                _vehicleLicenseService.Update(vehicleLicense);
                base.AddLog(string.Format("修改驾驶证[{0}]成功", vehicleLicense.Owner), AdminLoggerModuleEnum.VehicleLicense);
                return(JsonMessage(true, "修改驾驶证成功"));
            }
        }
예제 #2
0
        public ActionResult VehicleLicenseApplyProvide(string isEdit)
        {
            VehicleLicense vehicleLicense = new VehicleLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["Id"]))
            {
                vehicleLicense = _vehicleLicenseService.GetById(new Guid(RQuery["Id"]));
            }

            UpdateModel <VehicleLicense>(vehicleLicense);
            if (string.IsNullOrWhiteSpace(RQuery["Id"]))
            {
                vehicleLicense.CreateDate = DateTime.Now;
                _vehicleLicenseService.Insert(vehicleLicense);
                return(JsonMessage(true, "添加驾驶证成功"));
            }
            else
            {
                _vehicleLicenseService.Update(vehicleLicense);
                return(JsonMessage(true, "修改驾驶证成功"));
            }
        }