예제 #1
0
 /// <summary>
 /// 新增登记
 /// </summary>
 /// <param name="registerModel"></param>
 /// <returns></returns>
 public bool Register(RegisterModel registerModel, out string errorMsg)
 {
     if (InputVerification(registerModel, out errorMsg))
     {
         registerModel.PatientID   = Guid.NewGuid().ToString("N");
         registerModel.IDCard      = AesUnit.AESEncrypt(registerModel.IDCard, AppConfSetting.AesKey);//AppConfSetting.AesKey
         registerModel.ImageStatus = "图像未到达";
         var registerEntity = registerModel.MapTo <RegisterModel, tb_Register>();
         var projectEntitys = registerModel.Projects.MapListTo <ApplyItem, tb_ApplyProjects>();
         projectEntitys.ForEach(x =>
         {
             x.RegisterID = registerEntity.PatientID;
         });
         bool IsSuccess = false;
         try
         {
             if (_registerService.RequestIDIsExist(registerEntity.RequestID))
             {
                 errorMsg = "申请单ID已存在.";
                 return(false);
             }
             _registerService.db.Ado.BeginTran();
             int num  = _registerService.Insert(registerEntity);
             int num2 = _registerService.InsertProjects(projectEntitys);
             _registerService.db.Ado.CommitTran();
             IsSuccess = true;
         }
         catch (Exception ex)
         {
             _registerService.db.Ado.RollbackTran();
             throw ex;
         }
         errorMsg = IsSuccess ? "添加成功." : "添加失败.";
         NLogger.LogInfo(IsSuccess ? $"登记成功,影像号:{registerModel.ImageNumber},操作员{UserName}" : $"登记失败,影像号:{registerModel.ImageNumber},操作员{UserName}", UserName);
         return(IsSuccess);
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
        public bool UpdateRegister(RegisterModel updateModel, out string errorMsg)
        {
            errorMsg = "修改成功.";
            var exists = _registerService.GetModel(x => x.PatientID != updateModel.PatientID && x.ImageNumber == updateModel.ImageNumber);

            if (exists != null)
            {
                errorMsg = "影像号已存在,修改失败.";
                return(false);
            }
            var beforeEntity = _registerService.GetModel(x => x.PatientID == updateModel.PatientID);

            if (beforeEntity == null)
            {
                errorMsg = "要修改的患者不存在,修改失败.";
            }
            var updateEntity = updateModel.MapTo <RegisterModel, tb_Register>(beforeEntity);

            updateEntity.IDCard = AesUnit.AESEncrypt(updateEntity.IDCard, AppConfSetting.AesKey);
            var result = _registerService.Update(updateEntity);

            errorMsg = result ? "修改成功." : "修改失败.";
            return(result);
        }
예제 #3
0
        public ActionResult Register(RegisterModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var user = model.MapTo<User>();
            user.SetPassword(model.Password);
            user.Enabled = true;

            RavenSession.Store(user);

            FormsAuthentication.SetAuthCookie(model.Email, createPersistentCookie: false);
            return RedirectToAction("Index", "Home");
        }