Exemplo n.º 1
0
        public Boolean Save(Mercury.Server.Application application)
        {
            Boolean success = false;

            StringBuilder sqlStatement;

            try {
                application.EnvironmentDatabase.BeginTransaction();

                sqlStatement = new StringBuilder();

                sqlStatement.Append("EXEC dbo.MemberServiceDetailSet_InsertUpdate ");

                sqlStatement.Append(memberServiceId.ToString() + ", ");

                sqlStatement.Append(setDefinitionId.ToString() + ", ");

                sqlStatement.Append(detailMemberServiceId.ToString() + ", ");

                sqlStatement.Append(memberId.ToString() + ", ");

                sqlStatement.Append(parentServiceId.ToString() + ", ");

                sqlStatement.Append(serviceId.ToString() + ", ");

                sqlStatement.Append("'" + serviceName.Replace("'", "''") + "', ");

                sqlStatement.Append(((Int32)serviceType).ToString() + ", ");

                sqlStatement.Append("'" + eventDate.ToString("MM/dd/yyyy") + "'");


                success = application.EnvironmentDatabase.ExecuteSqlStatement(sqlStatement.ToString());

                if (!success)
                {
                    application.SetLastException(application.EnvironmentDatabase.LastException);

                    throw application.EnvironmentDatabase.LastException;
                }

                success = true;

                application.EnvironmentDatabase.CommitTransaction();
            }

            catch (Exception applicationException) {
                application.EnvironmentDatabase.RollbackTransaction();

                application.SetLastException(applicationException);
            }

            return(success);
        }
Exemplo n.º 2
0
        virtual public Boolean Delete(Mercury.Server.Application application)
        {
            Boolean success = false;

            try {
                success = application.EnvironmentDatabase.ExecuteSqlStatement("EXEC Condition_Delete " + id.ToString(), 0);
            }

            catch (Exception applicationException) {
                success = false;

                application.SetLastException(applicationException);
            }

            return(success);
        }
        virtual public Boolean Save(Mercury.Server.Application application)
        {
            Boolean success = false;


            try {
                application.EnvironmentDatabase.BeginTransaction();



                System.Data.IDbCommand sqlCommand = application.EnvironmentDatabase.CreateCommand("MemberAuthorizedServiceDetail_InsertUpdate");

                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@memberAuthorizedServiceId", memberAuthorizedServiceId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@authorizedServiceDefinitionId", authorizedServiceDefinitionId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@eventDate", eventDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@authorizationId", authorizationId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@authorizationNumber", authorizationNumber, Server.Data.DataTypeConstants.UniqueId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@externalAuthorizationId", externalAuthorizationId, Server.Data.DataTypeConstants.UniqueId);



                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@authorizationLine", authorizationLine);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@memberId", memberId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@referringProviderId", referringProviderId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@serviceProviderId", serviceProviderId);


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@category", authorizationCategory, Server.Data.DataTypeConstants.TypeName);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@subcategory", authorizationSubcategory, Server.Data.DataTypeConstants.TypeName);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@serviceType", authorizationServiceType, Server.Data.DataTypeConstants.TypeName);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@status", authorizationStatus, Server.Data.DataTypeConstants.TypeName);



                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@receivedDate", receivedDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@referralDate", referralDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@effectiveDate", effectiveDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@terminationDate", terminationDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@serviceDate", serviceDate);


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@principalDiagnosisCode", principalDiagnosisCode, Server.Data.DataTypeConstants.DiagnosisCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@principalDiagnosisVersion", principalDiagnosisVersion);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@diagnosisCode", diagnosisCode, Server.Data.DataTypeConstants.DiagnosisCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@diagnosisVersion", diagnosisVersion);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@revenueCode", revenueCode, Server.Data.DataTypeConstants.RevenueCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@procedureCode", procedureCode, Server.Data.DataTypeConstants.ProcedureCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@modifierCode", modifierCode, Server.Data.DataTypeConstants.ModifierCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@specialtyName", specialtyName, Server.Data.DataTypeConstants.Name);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@ndcCode", ndcCode, Server.Data.DataTypeConstants.NdcCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@description", description, Server.Data.DataTypeConstants.Name);


                // DO NOT EVALUATE THE NUMBER OF ROWS AFFECTED BECAUSE THE CHECK FOR DUPLICATES

                // IS HANDLED IN THE STORED PROCEDURE, AND THUS COULD RETURN 0 OR 1

                sqlCommand.ExecuteNonQuery();

                success = true;



                #region Old Method

                //sqlStatement = new StringBuilder ();

                //sqlStatement.Append ("EXEC dbo.MemberAuthorizedServiceDetail_InsertUpdate ");

                //sqlStatement.Append (memberAuthorizedServiceId.ToString () + ", ");

                //sqlStatement.Append (authorizedServiceDefinitionId.ToString () + ", ");

                //sqlStatement.Append ("'" + eventDate.ToString ("MM/dd/yyyy") + "', ");

                //sqlStatement.Append (authorizationId.ToString () + ", ");

                //sqlStatement.Append ("'" + authorizationNumber.Replace ("'", "''") + "', ");

                //sqlStatement.Append ("'" + externalAuthorizationId.Replace ("'", "''") + "', ");

                //sqlStatement.Append (authorizationLine.ToString () + ", ");

                //sqlStatement.Append (memberId.ToString () + ", ");

                //sqlStatement.Append (referringProviderId.ToString () + ", ");

                //sqlStatement.Append (serviceProviderId.ToString () + ", ");

                //sqlStatement.Append ("'" + authorizationCategory.Replace ("'", "''") + "', ");

                //sqlStatement.Append ("'" + authorizationSubcategory.Replace ("'", "''") + "', ");

                //sqlStatement.Append ("'" + authorizationServiceType.Replace ("'", "''") + "', ");

                //sqlStatement.Append ("'" + authorizationStatus + "', ");

                //if (receivedDate.HasValue) { sqlStatement.Append ("'" + receivedDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (referralDate.HasValue) { sqlStatement.Append ("'" + referralDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //sqlStatement.Append ("'" + effectiveDate.ToString ("MM/dd/yyyy") + "', ");

                //sqlStatement.Append ("'" + terminationDate.ToString ("MM/dd/yyyy") + "', ");

                //if (serviceDate.HasValue) { sqlStatement.Append ("'" + serviceDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }


                //sqlStatement.Append ("'" + principalDiagnosisCode + "', ");

                //sqlStatement.Append (principalDiagnosisVersion.ToString () + ", ");

                //sqlStatement.Append ("'" + diagnosisCode + "', ");

                //sqlStatement.Append (diagnosisVersion.ToString () + ", ");

                //sqlStatement.Append ("'" + revenueCode + "', ");

                //sqlStatement.Append ("'" + procedureCode + "', ");

                //sqlStatement.Append ("'" + modifierCode + "',");

                //sqlStatement.Append ("'" + specialtyName + "',");

                //sqlStatement.Append ("'" + ndcCode + "', ");

                //sqlStatement.Append ("'" + description.Replace ("'", "''").Trim () + "' ");

                //success = application.EnvironmentDatabase.ExecuteSqlStatement (sqlStatement.ToString ());

                #endregion



                if (!success)
                {
                    application.SetLastException(application.EnvironmentDatabase.LastException);

                    throw application.EnvironmentDatabase.LastException;
                }

                success = true;

                application.EnvironmentDatabase.CommitTransaction();
            }

            catch (Exception applicationException) {
                application.EnvironmentDatabase.RollbackTransaction();

                application.SetLastException(applicationException);
            }

            return(success);
        }
Exemplo n.º 4
0
        protected void SetLastException(Exception exception)
        {
            application.SetLastException(exception);

            return;
        }
Exemplo n.º 5
0
        virtual public Boolean Save(Mercury.Server.Application application)
        {
            Boolean success = false;


            try {
                application.EnvironmentDatabase.BeginTransaction();


                System.Data.IDbCommand sqlCommand = application.EnvironmentDatabase.CreateCommand("MemberServiceDetailSingleton_InsertUpdate");

                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@memberServiceId", memberServiceId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@singletonDefinitionId", singletonDefinitionId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@eventDate", eventDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimId", claimId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@externalClaimId", externalClaimId, Server.Data.DataTypeConstants.UniqueId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimLine", claimLine);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@memberId", memberId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@providerId", providerId);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimType", ((Int32)claimType).ToString(), Server.Data.DataTypeConstants.TypeName);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimStatus", ((Int32)claimStatus).ToString(), Server.Data.DataTypeConstants.TypeName);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimDateFrom", claimDateFrom);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@claimDateThru", claimDateThru);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@serviceDateFrom", serviceDateFrom);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@serviceDateThru", serviceDateThru);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@admissionDate", admissionDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@dischargeDate", dischargeDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@receivedDate", receivedDate);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@paidDate", paidDate);


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@billType", billType, Server.Data.DataTypeConstants.BillType);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@principalDiagnosisCode", principalDiagnosisCode, Server.Data.DataTypeConstants.DiagnosisCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@principalDiagnosisVersion", principalDiagnosisVersion);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@diagnosisCode", diagnosisCode, Server.Data.DataTypeConstants.DiagnosisCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@diagnosisVersion", diagnosisVersion);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@icd9ProcedureCode", icd9ProcedureCode, Server.Data.DataTypeConstants.Icd9ProcedureCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@locationCode", locationCode, Server.Data.DataTypeConstants.LocationCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@revenueCode", revenueCode, Server.Data.DataTypeConstants.RevenueCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@procedureCode", procedureCode, Server.Data.DataTypeConstants.ProcedureCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@modifierCode", modifierCode, Server.Data.DataTypeConstants.ModifierCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@specialtyName", specialtyName, Server.Data.DataTypeConstants.Name);


                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@isPcpClaim", isPcpClaim);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@ndcCode", ndcCode, Server.Data.DataTypeConstants.NdcCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@units", units);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@deaClassification", deaClassification, Server.Data.DataTypeConstants.DeaClassification);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@therapeuticClassification", therapeuticClassification, Server.Data.DataTypeConstants.TherapeuticClassification);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@labLoincCode", labLoincCode, Server.Data.DataTypeConstants.LabLoincCode);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@labName", labName, Server.Data.DataTypeConstants.Name);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@labValue", labValue);

                application.EnvironmentDatabase.AppendCommandParameter(sqlCommand, "@description", description, Server.Data.DataTypeConstants.Name);


                // DO NOT EVALUATE THE NUMBER OF ROWS AFFECTED BECAUSE THE CHECK FOR DUPLICATES

                // IS HANDLED IN THE STORED PROCEDURE, AND THUS COULD RETURN 0 OR 1

                sqlCommand.ExecuteNonQuery();

                success = true;


                #region Old Method

                //sqlStatement = new StringBuilder ();

                //sqlStatement.Append ("EXEC dbo.MemberServiceDetailSingleton_InsertUpdate ");

                //sqlStatement.Append (memberServiceId.ToString () + ", ");

                //sqlStatement.Append (singletonDefinitionId.ToString () + ", ");

                //sqlStatement.Append ("'" + eventDate.ToString ("MM/dd/yyyy") + "', ");

                //sqlStatement.Append (claimId.ToString () + ", ");

                //sqlStatement.Append ("'" + externalClaimId.Replace ("'", "''") + "', ");

                //sqlStatement.Append (claimLine.ToString () + ", ");

                //sqlStatement.Append (memberId.ToString () + ", ");

                //sqlStatement.Append (providerId.ToString () + ", ");

                //sqlStatement.Append ("'" + claimType + "', ");

                //sqlStatement.Append ("'" + claimStatus + "', ");

                //if (claimDateFrom.HasValue) { sqlStatement.Append ("'" + claimDateFrom.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (claimDateThru.HasValue) { sqlStatement.Append ("'" + claimDateThru.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (serviceDateFrom.HasValue) { sqlStatement.Append ("'" + serviceDateFrom.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (serviceDateThru.HasValue) { sqlStatement.Append ("'" + serviceDateThru.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (admissionDate.HasValue) { sqlStatement.Append ("'" + admissionDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (dischargeDate.HasValue) { sqlStatement.Append ("'" + dischargeDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (receivedDate.HasValue) { sqlStatement.Append ("'" + receivedDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }

                //if (paidDate.HasValue) { sqlStatement.Append ("'" + paidDate.Value.ToString ("MM/dd/yyyy") + "', "); } else { sqlStatement.Append ("NULL, "); }


                //sqlStatement.Append ("'" + billType + "', ");

                //sqlStatement.Append ("'" + principalDiagnosisCode + "', ");

                //sqlStatement.Append ("'" + diagnosisCode + "', ");

                //sqlStatement.Append ("'" + icd9ProcedureCode + "', ");

                //sqlStatement.Append ("'" + locationCode + "', ");

                //sqlStatement.Append ("'" + revenueCode + "', ");

                //sqlStatement.Append ("'" + procedureCode + "', ");

                //sqlStatement.Append ("'" + modifierCode + "',");

                //sqlStatement.Append ("'" + specialtyName + "',");

                //sqlStatement.Append (Convert.ToInt32 (isPcpClaim).ToString () + ", ");

                //sqlStatement.Append ("'" + ndcCode + "', ");

                //sqlStatement.Append ("" + units.ToString () + ", ");

                //sqlStatement.Append ("'" + deaClassification + "', ");

                //sqlStatement.Append ("'" + therapeuticClassification + "', ");

                //sqlStatement.Append ("'" + labLoincCode + "', ");

                //sqlStatement.Append ("'" + labName + "', ");

                //sqlStatement.Append (labValue.ToString () + ", ");

                //sqlStatement.Append ("'" + description.Replace ("'", "''").Trim () + "' ");

                //success = application.EnvironmentDatabase.ExecuteSqlStatement (sqlStatement.ToString ());

                #endregion


                if (!success)
                {
                    application.SetLastException(application.EnvironmentDatabase.LastException);

                    throw application.EnvironmentDatabase.LastException;
                }

                success = true;

                application.EnvironmentDatabase.CommitTransaction();
            }

            catch (Exception applicationException) {
                application.EnvironmentDatabase.RollbackTransaction();

                application.SetLastException(applicationException);
            }

            return(success);
        }