Beispiel #1
0
        public void UpdateReviewOfSystem_Failed()
        {
            // Arrange
            var url = baseRoute + "updateReviewOfSystem";

            var ros = new ReviewOfSystemsModel
            {
                RoSID            = -1,
                ContactID        = -1,
                AssessmentID     = 1,
                DateEntered      = DateTime.UtcNow,
                IsReviewChanged  = null,
                LastAssessmentOn = null,
                ResponseID       = 1,
                ReviewdBy        = 1,
                ReviewdByName    = "Arun Choudhary",
                ForceRollback    = true
            };

            // Act
            var response = communicationManager.Put <ReviewOfSystemsModel, Response <ReviewOfSystemsModel> >(ros, url);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.RowAffected == 0, "Update review of system expected to be failed.");
        }
Beispiel #2
0
        public void AddReviewOfSystem_Failed()
        {
            // Arrange
            var url = baseRoute + "addReviewOfSystem";

            var ros = new ReviewOfSystemsModel
            {
                ContactID        = -1,
                AssessmentID     = 1,
                DateEntered      = DateTime.UtcNow,
                IsReviewChanged  = null,
                LastAssessmentOn = null,
                ResponseID       = 1,
                ReviewdBy        = 4,
                ReviewdByName    = "Chad Roberts",
                ForceRollback    = true
            };

            // Act
            var response = communicationManager.Post <ReviewOfSystemsModel, Response <ReviewOfSystemsModel> >(ros, url);

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode != 0, "Add review of system expected to be failed.");
        }
Beispiel #3
0
        /// <summary>
        /// Updates the review of system.
        /// </summary>
        /// <param name="ros">The ros.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public Response <ReviewOfSystemsModel> UpdateReviewOfSystem(ReviewOfSystemsModel ros)
        {
            var rosParameters = BuildRosSpParams(ros, true);
            var rosRepository = unitOfWork.GetRepository <ReviewOfSystemsModel>(SchemaName.Clinical);

            return(unitOfWork.EnsureInTransaction(rosRepository.ExecuteNQStoredProc, "usp_UpdateReviewOfSystem", rosParameters,
                                                  forceRollback: ros.ForceRollback.GetValueOrDefault(false)));
        }
Beispiel #4
0
        /// <summary>
        /// Builds the ros sp parameters.
        /// </summary>
        /// <param name="ros">The ros.</param>
        /// <param name="isUpdate">if set to <c>true</c> [is update].</param>
        /// <returns></returns>
        private List <SqlParameter> BuildRosSpParams(ReviewOfSystemsModel ros, bool isUpdate)
        {
            var spParameters = new List <SqlParameter>();

            if (isUpdate)
            {
                spParameters.Add(new SqlParameter("RoSID", ros.RoSID));
            }

            spParameters.Add(new SqlParameter("ContactID", (object)ros.ContactID ?? DBNull.Value));
            spParameters.Add(new SqlParameter("DateEntered", (object)ros.DateEntered ?? DBNull.Value));
            spParameters.Add(new SqlParameter("ReviewdBy", (object)ros.ReviewdBy ?? DBNull.Value));
            spParameters.Add(new SqlParameter("AssessmentID", (object)ros.AssessmentID ?? DBNull.Value));
            spParameters.Add(new SqlParameter("ResponseID", (object)ros.ResponseID ?? DBNull.Value));
            spParameters.Add(new SqlParameter("IsReviewChanged", (object)ros.IsReviewChanged ?? DBNull.Value));
            spParameters.Add(new SqlParameter("ModifiedOn", ros.ModifiedOn ?? DateTime.Now));

            return(spParameters);
        }
Beispiel #5
0
        /// <summary>
        /// To the model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static ReviewOfSystemsModel ToModel(this ReviewOfSystemsViewModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var entity = new ReviewOfSystemsModel
            {
                RoSID            = model.RoSID,
                ContactID        = model.ContactID,
                DateEntered      = model.DateEntered,
                ReviewdBy        = model.ReviewdBy,
                ReviewdByName    = model.ReviewdByName,
                AssessmentID     = model.AssessmentID,
                ResponseID       = model.ResponseID,
                IsReviewChanged  = model.IsReviewChanged,
                LastAssessmentOn = model.LastAssessmentOn,
                ForceRollback    = model.ForceRollback,
                ModifiedOn       = model.ModifiedOn
            };

            return(entity);
        }
Beispiel #6
0
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static ReviewOfSystemsViewModel ToViewModel(this ReviewOfSystemsModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new ReviewOfSystemsViewModel
            {
                RoSID            = entity.RoSID,
                ContactID        = entity.ContactID,
                DateEntered      = entity.DateEntered,
                ReviewdBy        = entity.ReviewdBy,
                ReviewdByName    = entity.ReviewdByName,
                AssessmentID     = entity.AssessmentID,
                ResponseID       = entity.ResponseID,
                IsReviewChanged  = entity.IsReviewChanged,
                LastAssessmentOn = entity.LastAssessmentOn,
                ForceRollback    = entity.ForceRollback,
                ModifiedOn       = entity.ModifiedOn
            };

            return(model);
        }
 /// <summary>
 /// Updates the review of system.
 /// </summary>
 /// <param name="ros">The ros.</param>
 /// <returns></returns>
 public Response <ReviewOfSystemsModel> UpdateReviewOfSystem(ReviewOfSystemsModel ros)
 {
     return(rosService.UpdateReviewOfSystem(ros));
 }
 /// <summary>
 /// Adds the review of system.
 /// </summary>
 /// <param name="ros">The ros.</param>
 /// <returns></returns>
 public Response <ReviewOfSystemsModel> AddReviewOfSystem(ReviewOfSystemsModel ros)
 {
     return(rosService.AddReviewOfSystem(ros));
 }
Beispiel #9
0
        /// <summary>
        /// Updates the review of system.
        /// </summary>
        /// <param name="ros">The ros.</param>
        /// <returns></returns>
        public Response <ReviewOfSystemsModel> UpdateReviewOfSystem(ReviewOfSystemsModel ros)
        {
            const string apiUrl = BaseRoute + "UpdateReviewOfSystem";

            return(communicationManager.Put <ReviewOfSystemsModel, Response <ReviewOfSystemsModel> >(ros, apiUrl));
        }
Beispiel #10
0
 public IHttpActionResult AddReviewOfSystem(ReviewOfSystemsModel ros)
 {
     return(new HttpResult <Response <ReviewOfSystemsModel> >(rosRuleEngine.AddReviewOfSystem(ros), Request));
 }
Beispiel #11
0
 public IHttpActionResult AddReviewOfSystem(ReviewOfSystemsModel ros)
 {
     return(new HttpResult <Response <ReviewOfSystemsModel> >(rosDataProvider.AddReviewOfSystem(ros), Request));
 }