Exemplo n.º 1
0
        /// <summary>
        /// Adds the specified review.
        /// </summary>
        /// <param name="review">The review.</param>
        /// <returns>
        /// id of the new review
        /// </returns>
        public int Add(Review review)
        {
            var reviewId = review.ReviewId;

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

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

                        var paramId = new SqlParameter("@ReviewId", SqlDbType.Int)
                        {
                            Direction = ParameterDirection.InputOutput,
                            Value     = 0
                        };
                        sqlParams.Add(paramId);

                        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.JobSeekerGivenName, "@JobSeekerGivenName", sqlParams);
                        SqlHelper.AddVarcharPara(review.JobSeekerSurname, "@JobSeekerSurname", 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.AddVarcharPara(review.ContractType, "@ContractType", sqlParams);
                        SqlHelper.AddVarcharPara(review.ClaimType, "@ClaimType", sqlParams);
                        SqlHelper.AddVarcharPara(review.Comments, "@Comments", sqlParams);
                        SqlHelper.AddVarcharPara(review.AssessmentCode, "@AssessmentCode", sqlParams);
                        SqlHelper.AddVarcharPara(review.RecoveryReason, "@RecoveryReason", sqlParams);
                        SqlHelper.AddVarcharPara(review.AssessmentAction, "@AssessmentAction", sqlParams);
                        SqlHelper.AddVarcharPara(review.OutcomeCode, "@OutcomeCode", 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.AddNullableDateParameter(review.ClaimCreationDate, "@ClaimCreationDate", sqlParams);
                        SqlHelper.AddMoneyPara(review.ClaimAmount, "@ClaimAmount", sqlParams);
                        SqlHelper.AddMoneyPara(review.ClaimRecoveryAmount, "@ClaimRecoveryAmount", sqlParams);
                        SqlHelper.AddVarcharPara(review.CreatedBy, "@CreatedBy", sqlParams);

                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddRange(sqlParams.ToArray());
                        connection.Open();
                        command.ExecuteNonQuery();
                        if (((Int32)command.Parameters["@return_value"].Value) == 0)
                        {
                            reviewId = (int)paramId.Value;
                        }
                    }
                }
            }
            return(reviewId);
        }
Exemplo n.º 2
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();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public void Add(Sample entity)
        {
            var sample = entity;

            Debug.Assert(sample != null, "sample != null");
            using (var connection = new SqlConnection(DbConnection))
            {
                using (var command = new SqlCommand("PaSampleInsert", connection))
                {
                    var sqlParams = new List <SqlParameter>();
                    SqlHelper.AddReturnPara("@return_value", sqlParams);

                    SqlHelper.AddVarcharPara(sample.SessionKey, "@SessionKey", sqlParams);

                    SqlHelper.AddVarcharPara(sample.ClaimTypeDescription, "@ClaimTypeDescription", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ContractTypeDescription, "@ContractTypeDescription", sqlParams);
                    SqlHelper.AddVarcharPara(sample.SiteDescription, "@SiteDescription", sqlParams);
                    SqlHelper.AddVarcharPara(sample.EsaDescription, "@EsaDescription", sqlParams);
                    SqlHelper.AddVarcharPara(sample.OrgDescription, "@OrgDescription", sqlParams);

                    SqlHelper.AddBigIntPara(sample.ClaimId, "@ClaimId", sqlParams);
                    SqlHelper.AddIntPara(sample.ClaimSequenceNumber, "@ClaimSequenceNumber", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ClaimType, "@ClaimType", sqlParams);
                    SqlHelper.AddMoneyPara(sample.ClaimAmount, "@ClaimMoney", sqlParams);

                    SqlHelper.AddVarcharPara(sample.SiteCode, "@SiteCode", sqlParams);
                    SqlHelper.AddVarcharPara(sample.SupervisingSiteCode, "@SupervisingSiteCode", sqlParams);
                    SqlHelper.AddVarcharPara(sample.OrgCode, "@OrgCode", sqlParams);

                    SqlHelper.AddBigIntPara(sample.ActivityId, "@ActivityId", sqlParams);
                    SqlHelper.AddDatePara(sample.ClaimCreationDate, "@ClaimCreationDate", sqlParams);

                    SqlHelper.AddVarcharPara(sample.StatusCode, "@ClaimStatusCode", sqlParams);
                    SqlHelper.AddVarcharPara(sample.StatusCodeDescription, "@ClaimStatusDescription", sqlParams);

                    SqlHelper.AddVarcharPara(sample.StateCode, "@StateCode", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ManagedBy, "@ManagedBy", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ContractId, "@ContractId", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ContractType, "@ContractType", sqlParams);
                    SqlHelper.AddVarcharPara(sample.ContractTitle, "@ContractTitle", sqlParams);

                    SqlHelper.AddVarcharPara(sample.EsaCode, "@EsaCode", sqlParams);
                    SqlHelper.AddBigIntPara(sample.JobseekerId, "@JobseekerId", sqlParams);
                    SqlHelper.AddVarcharPara(sample.GivenName, "@GivenName", sqlParams);
                    SqlHelper.AddVarcharPara(sample.Surname, "@LastName", sqlParams);

                    SqlHelper.AddCharPara(sample.AutoSpecialClaimFlag, "@AutoSpecialClaimFlag", sqlParams);
                    SqlHelper.AddCharPara(sample.ManSpecialClaimFlag, "@ManualSpecialClaimFlag", sqlParams);

                    SqlHelper.AddVarcharPara(sample.CreatedBy, "@CreatedBy", sqlParams);

                    //  Output parameters
                    var paramId = new SqlParameter("@Id", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.InputOutput,
                        Value     = 0
                    };
                    sqlParams.Add(paramId);

                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(sqlParams.ToArray());

                    connection.Open();

                    command.ExecuteNonQuery();

                    if (((Int32)command.Parameters["@return_value"].Value) != 0)
                    {
                        return;
                    }

                    sample.Id = (int)paramId.Value;
                }
            }
        }