コード例 #1
0
        public void AddSocialRelationHistory_Success()
        {
            //Arrange
            const string url     = baseRoute + "AddSocialRelationHistory";
            var          param   = new NameValueCollection();
            var          srModel = new SocialRelationshipHistoryModel
            {
                SocialRelationshipDetailID = 1,
                SocialRelationshipID       = 10003,
                FamilyRelationshipID       = 1,
                ChildhoodHistory           = "First Children",
                RelationShipHistory        = "First RelationShip",
                FamilyHistory = "Enjoying with Family.",
                //IsDeceased = false,
                //IsInvolved = true,
                //FirstName = "Peter",
                //LastName = "Parker",
                //RelationshipTypeID = 1,
                ReviewedNoChanges = false,
                ContactID         = 1,
                EncounterID       = null,
                TakenBy           = 1,
                TakenTime         = DateTime.Now,
                ForceRollback     = true
            };

            //Act
            var response = _communicationManager.Post <SocialRelationshipHistoryModel, Response <SocialRelationshipHistoryModel> >(srModel, url);

            // Assert
            Assert.IsNotNull(response, "Response can not be null");
            Assert.IsTrue(response.RowAffected > 2, "Social Relationship could not be created.");
        }
        /// <summary>
        /// To the model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static SocialRelationshipHistoryModel ToModel(this SocialRelationshipHistoryViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new SocialRelationshipHistoryModel
            {
                ContactID   = model.ContactID,
                EncounterID = model.EncounterID,
                TakenBy     = model.TakenBy,
                TakenTime   = model.TakenTime,
                SocialRelationshipDetailID = model.SocialRelationshipDetailID,
                SocialRelationshipID       = model.SocialRelationshipID,
                FamilyRelationshipID       = model.FamilyRelationshipID,
                ChildhoodHistory           = model.ChildhoodHistory,
                RelationShipHistory        = model.RelationShipHistory,
                FamilyHistory             = model.FamilyHistory,
                IsDetailsDirty            = model.IsDetailsDirty,
                IsSocialRelationshipDirty = model.IsSocialRelationshipDirty,
                ReviewedNoChanges         = model.ReviewedNoChanges,
                IsFamilyRelationshipDirty = model.IsFamilyRelationshipDirty,
                ModifiedOn = model.ModifiedOn
            };

            return(entity);
        }
コード例 #3
0
 public IHttpActionResult UpdateSocialRelationHistory(SocialRelationshipHistoryModel model)
 {
     if (ModelState.IsValid)
     {
         return(new HttpResult <Response <SocialRelationshipHistoryModel> >(_socialRelationshipHistory.UpdateSocialRelationHistory(model), Request));
     }
     else
     {
         var errorMessage       = ModelState.ParseError();
         var validationResponse = new Response <SocialRelationshipHistoryModel>()
         {
             DataItems = new List <SocialRelationshipHistoryModel>(), ResultCode = -1, ResultMessage = errorMessage
         };
         return(new HttpResult <Response <SocialRelationshipHistoryModel> >(validationResponse, Request));
     }
 }
コード例 #4
0
        /// <summary>
        /// Update social relationship history
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Response <SocialRelationshipHistoryModel> UpdateSocialRelationHistory(SocialRelationshipHistoryModel model)
        {
            var socialRelationshipRepository = _unitOfWork.GetRepository <SocialRelationshipHistoryModel>(SchemaName.Clinical);
            List <SqlParameter> procParams   = new List <SqlParameter>();

            procParams.AddRange(new List <SqlParameter>()
            {
                new SqlParameter("SocialRelationshipID", model.SocialRelationshipID),
                new SqlParameter("ContactID", model.ContactID),
                new SqlParameter("EncounterID", (object)model.EncounterID ?? DBNull.Value),
                new SqlParameter("ReviewedNoChanges", model.ReviewedNoChanges),
                new SqlParameter("TakenBy", model.TakenBy),
                new SqlParameter("TakenTime", model.TakenTime),
                new SqlParameter("ChildhoodHistory", (object)model.ChildhoodHistory ?? DBNull.Value),
                new SqlParameter("RelationshipHistory", (object)model.RelationShipHistory ?? DBNull.Value),
                new SqlParameter("FamilyHistory", (object)model.FamilyHistory ?? DBNull.Value),
                new SqlParameter("ModifiedOn", model.ModifiedOn ?? DateTime.Now)
            }
                                );
            var socialRelationshipResults = socialRelationshipRepository.ExecuteNQStoredProc("usp_UpdateSocialRelationship", procParams);

            return(socialRelationshipResults);
        }
コード例 #5
0
 public IHttpActionResult UpdateSocialRelationHistory(SocialRelationshipHistoryModel model)
 {
     return(new HttpResult <Response <SocialRelationshipHistoryModel> >(_socialRelationshipHistoryDataProvider.UpdateSocialRelationHistory(model), Request));
 }
 /// <summary>
 /// Update social relationship history
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public Response <SocialRelationshipHistoryModel> UpdateSocialRelationHistory(SocialRelationshipHistoryModel model)
 {
     return(_socialRelationshipHistoryService.UpdateSocialRelationHistory(model));
 }
コード例 #7
0
        /// <summary>
        /// Update social relationship history
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Response <SocialRelationshipHistoryModel> UpdateSocialRelationHistory(SocialRelationshipHistoryModel model)
        {
            const string apiUrl = BaseRoute + "UpdateSocialRelationHistory";

            return(_communicationManager.Put <SocialRelationshipHistoryModel, Response <SocialRelationshipHistoryModel> >(model, apiUrl));
        }