Esempio n. 1
0
        /// <summary>
        /// Updates the specified review.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public void Update(Review entity)
        {
            var review = entity;

            Debug.Assert(review != null, "review != null");

            using (var connection = new SqlConnection(DbConnection))
            {
                using (var command = new SqlCommand("PaReviewUpdate", connection))
                {
                    var sqlParams = new List <SqlParameter>();

                    var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.ReturnValue
                    };
                    sqlParams.Add(paramReturnValue);

                    SqlHelper.AddIntPara(review.ReviewId, "@ReviewId", sqlParams);
                    SqlHelper.AddIntPara(review.ProjectId, "@ProjectId", sqlParams);
                    SqlHelper.AddIntPara(review.UploadId, "@UploadId", sqlParams);
                    SqlHelper.AddIntPara(review.ClaimSequenceNumber, "@ClaimSequenceNumber", sqlParams);

                    SqlHelper.AddNullableBigIntPara(review.JobseekerId, "@JobseekerId", sqlParams);
                    SqlHelper.AddNullableBigIntPara(review.ClaimId, "@ClaimId", sqlParams);
                    SqlHelper.AddNullableBigIntPara(review.ActivityId, "@ActivityId", sqlParams);

                    SqlHelper.AddVarcharPara(review.SiteCode, "@SiteCode", sqlParams);
                    SqlHelper.AddVarcharPara(review.SiteName, "@SiteName", sqlParams);
                    SqlHelper.AddVarcharPara(review.OrgName, "@OrgName", sqlParams);
                    SqlHelper.AddVarcharPara(review.OrgCode, "@OrgCode", sqlParams);
                    SqlHelper.AddVarcharPara(review.ESACode, "@ESACode", sqlParams);
                    SqlHelper.AddVarcharPara(review.StateCode, "@StateCode", sqlParams);
                    SqlHelper.AddVarcharPara(review.ManagedBy, "@ManagedBy", sqlParams);

                    SqlHelper.AddNullableVarcharPara(review.OutcomeCode, "@OutcomeCode", sqlParams);
                    SqlHelper.AddNullableVarcharPara(review.AssessmentCode, "@AssessmentCode", sqlParams);
                    SqlHelper.AddNullableVarcharPara(review.RecoveryReason, "@RecoveryReason", sqlParams);
                    SqlHelper.AddNullableVarcharPara(review.AssessmentAction, "@AssessmentAction", sqlParams);

                    SqlHelper.AddVarcharPara(review.JobSeekerGivenName, "@JobSeekerGivenName", sqlParams);
                    SqlHelper.AddVarcharPara(review.JobSeekerSurname, "@JobSeekerSurname", sqlParams);
                    SqlHelper.AddVarcharPara(review.ClaimType, "@ClaimType", sqlParams);
                    SqlHelper.AddVarcharPara(review.Comments, "@Comments", sqlParams);

                    SqlHelper.AddBitPara(review.IsAdditionalReview, "@IsAdditionalReview", sqlParams);
                    SqlHelper.AddBitPara(review.IsOutOfScope, "@IsOutOfScope", sqlParams);
                    SqlHelper.AddBitPara(review.AutoSpecialClaim, "@AutoSpecialClaim", sqlParams);
                    SqlHelper.AddBitPara(review.ManualSpecialClaim, "@ManualSpecialClaim", sqlParams);

                    SqlHelper.AddMoneyPara(review.ClaimAmount, "@ClaimAmount", sqlParams);
                    SqlHelper.AddMoneyPara(review.ClaimRecoveryAmount, "@ClaimRecoveryAmount", sqlParams);


                    SqlHelper.AddNullableDateParameter(review.AssessmentDate, "@AssessmentDate", sqlParams);
                    SqlHelper.AddNullableDateParameter(review.AssessmentActionDate, "@AssessmentActionDate", sqlParams);
                    SqlHelper.AddNullableDateParameter(review.RecoveryReasonDate, "@RecoveryReasonDate", sqlParams);
                    SqlHelper.AddNullableDateParameter(review.FinalOutcomeDate, "@FinalOutcomeDate", sqlParams);
                    SqlHelper.AddNullableDateParameter(review.ClaimCreationDate, "@ClaimCreationDate", sqlParams);

                    SqlHelper.AddVarcharPara(review.UpdatedBy, "@UpdatedBy", sqlParams);

                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(sqlParams.ToArray());
                    connection.Open();
                    command.ExecuteNonQuery();
                }
            }
        }