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


            DrivingLicense drivingLicense = new DrivingLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["DrivingLicenseId"]))
            {
                drivingLicense = _drivingLicenseService.GetById(new Guid(RQuery["DrivingLicenseId"]));
            }
            try
            {
                UpdateModel <DrivingLicense>(drivingLicense);
            }
            catch (System.Exception ex)
            {
                //
            }
            if (string.IsNullOrWhiteSpace(RQuery["DrivingLicenseId"]))
            {
                //branch.Status = 1;
                try
                {
                    drivingLicense.CreateDate = DateTime.Now;
                    _drivingLicenseService.Insert(drivingLicense);
                    base.AddLog(string.Format("添加驾驶证[{0}]成功", drivingLicense.Name), AdminLoggerModuleEnum.DrivingLicense);
                }
                catch (System.Exception ex)
                {
                    //
                }
                return(JsonMessage(true, "添加驾驶证成功"));
            }
            else
            {
                _drivingLicenseService.Update(drivingLicense);
                base.AddLog(string.Format("修改驾驶证[{0}]成功", drivingLicense.Name), AdminLoggerModuleEnum.DrivingLicense);
                return(JsonMessage(true, "修改驾驶证成功"));
            }
        }
예제 #2
0
        public ActionResult DrivingLicenseApplyProvide(string isEdit)
        {
            DrivingLicense drivingLicense = new DrivingLicense();

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

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