public JsonResult Import(SampleSpecInfo sampleSpec) { CommonModelResult model = new CommonModelResult(); try { sampleSpec.UserInput = SessionUtils.LoginUserInfo.UserId; sampleSpec.DateInput = DateTime.Now; _tubeSampleService.ImportSample(sampleSpec); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = exception.Message; } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model)); }
public JsonResult Create(RemovalSampleRequest removalNote) { CommonModelResult model = new CommonModelResult(); try { this._tubeSampleService.RemovalSamples(new TubeSampleService.RemovalSampleParam() { RemovalDate = DateTime.Now, RemovalId = removalNote.RemovalId, RemovalUserId = SessionUtils.LoginUserInfo.UserId, RemovalReason = removalNote.RemovalReason, TubeRemovalIds = removalNote.TubeRemovalIds }); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = exception.Message; } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult Add(AddUserModel model) { CommonModelResult result = new CommonModelResult(); try { _userService.CreateNewUser(new LoginUserInfo() { UserId = model.UserId, FullName = model.FullName, Status = UserStatus.Enable, Rights = new List <UserRightCode>(CommonUtils.GetListDefaultUserRightCode()) }, CommonConstant.DefaultPassword); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); result.ErrorCode = exception.ErrorCode; result.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); result.ErrorCode = ErrorCode.InternalErrorException; result.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(result)); }
public JsonResult Update(UpdateUserModel model) { CommonModelResult result = new CommonModelResult(); try { _userService.UpdateUser(new LoginUserInfo() { UserId = model.UserId, FullName = model.NewName }); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); result.ErrorCode = exception.ErrorCode; result.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); result.ErrorCode = ErrorCode.InternalErrorException; result.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(result)); }
public JsonResult UpdateRight(UpdateRightModel updateRightModel) { CommonModelResult model = new CommonModelResult(); try { var updateParams = new UserService.UpdateRightParams() { UserId = updateRightModel.UserId, }; updateParams.UpdateRights.AddRange(updateRightModel.RightCodes); _userService.UpdateUserRights(updateParams); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model)); }
public JsonResult ResetPass(ResetPasswordModel model) { CommonModelResult result = new CommonModelResult(); try { _userService.ResetPassword(new UserService.ResetPassParams() { UserId = model.UserId, NewPass = model.NewPassword }); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); result.ErrorCode = exception.ErrorCode; result.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); result.ErrorCode = ErrorCode.InternalErrorException; result.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(result)); }
public JsonResult Update(TubeUpdateModel update) { CommonModelResult model = new CommonModelResult(); try { if (!SessionUtils.LoginUserInfo.Rights.Contains(UserRightCode.R00603)) { var tubeDetail = _tubeSampleService.GetTubeDetail(update.TubeId); if (tubeDetail != null) { if (tubeDetail.Status == TubeSampleStatus.Remove) { throw new BusinessException(ErrorCode.SampleAlreadyRemove); } if (update.Volume > tubeDetail.Volume) { throw new BusinessException(ErrorCode.NewVolumeExceedLastVolume); } } else { throw new BusinessException(ErrorCode.TubeIdNotExists); } } _tubeSampleService.UpdateTube(new TubeSampleService.UpdateTubeParams() { TubeId = update.TubeId, LocationNum = update.LocationNum, StorageId = update.StorageId, Volume = update.Volume, Status = update.Status, UserInput = SessionUtils.LoginUserInfo.UserId, DateInput = DateTime.Now }); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = exception.Message; } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model)); }
public JsonResult Create(ExportSampleRequest exportNote) { CommonModelResult model = new CommonModelResult(); try { var tubeCountList = _exportService.GetTubeExportCount( new ExportService.GetTubeExportCountParams() { TubeIds = exportNote.TubeExportIds }); this._tubeSampleService.ExportSamples(new TubeSampleService.ExportSampleParam() { ExportDate = DateTime.Now, ExportId = exportNote.ExportId, ExportForUserId = exportNote.ExportForUserId, ExportUserId = SessionUtils.LoginUserInfo.UserId, ExportReason = exportNote.ExportReason, TubeExportIds = exportNote.TubeExportIds }); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); model.ErrorCode = exception.ErrorCode; model.ErrorDescription = exception.Message; } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); model.ErrorCode = ErrorCode.InternalErrorException; model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveContent(ContentInfo contentInfo) { CommonModelResult result = new CommonModelResult(); try { _contentService.SaveContentInfo(contentInfo); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); result.ErrorCode = exception.ErrorCode; result.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); result.ErrorCode = ErrorCode.InternalErrorException; result.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(result)); }
public JsonResult Delete(ShortStorageInfo storageInfo) { CommonModelResult result = new CommonModelResult(); try { _storageService.DeleteStorageInfo(storageInfo.StorageId); } catch (BusinessException exception) { _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message); result.ErrorCode = exception.ErrorCode; result.ErrorDescription = CommonUtils.GetErrorMessage(exception); } catch (Exception exception) { _logger.Error(string.Format("Iternal error {0}", exception)); result.ErrorCode = ErrorCode.InternalErrorException; result.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException); } return(Json(result)); }