views:

79

answers:

1

This is a c#/asp.net project. The full error message I get is:Error 0194: All artifacts loaded into the item collection must have the same version. Multiple versions were encountered.

This project was started as a 3.5 and upgraded to 4.0. When I try to test any of the methods I get the error that I posted in the subject line. I am going to include the actual lines that it throws the exception on. If there is anything in people need to see to try to help let me know and I post it as well. Any help will be appreciated, I am having no luck with this.

>

/// <summary>
/// Initializes a new SFBExternalPaymentsEntities object using the connection string found in the 'SFBExternalPaymentsEntities' section of the application configuration file.
/// </summary>    
public SFBExternalPaymentsEntities() : base("name=SFBExternalPaymentsEntities", "SFBExternalPaymentsEntities")     
{
    this.ContextOptions.LazyLoadingEnabled = false;     
    OnContextCreated();    
}

/// <summary>    
/// Initialize a new SFBExternalPaymentsEntities object.
/// </summary>
public SFBExternalPaymentsEntities(string connectionString) : base(connectionString, "SFBExternalPaymentsEntities")     
{
    this.ContextOptions.LazyLoadingEnabled = false;    
    OnContextCreated();    
}

/// <summary>
/// Initialize a new SFBExternalPaymentsEntities object.
/// </summary>
public SFBExternalPaymentsEntities(EntityConnection connection) : base(connection, "SFBExternalPaymentsEntities")     
{
    this.ContextOptions.LazyLoadingEnabled = false;     
    OnContextCreated();    
}
#endregion

Added a method calling the constructor. public static CreditCardResponse AuthCapture(CreditCard newCC) { ACHResponse validateResponse = CreditCard.Validate(newCC); if (validateResponse.Status == "Accepted") { Profile currentProfile = new Profile(); currentProfile = ProfilesGateWay.GetByID(newCC.ProfileID); CreditCardTransaction newCCTransaction = CreateCreditCardTransaction(newCC, currentProfile); ServiceClient client = new ServiceClient(); CreditCardTransactionResponse cctResponse = client.CreditCardAuthorizeAndCapture(newCCTransaction); client.Close(); CreditCardResponse ccResponse = CreateCCResponse(cctResponse);

            if (ccResponse.ResponseCode == 1)
            {
                int authAVS = ConvertAVStoInt(ccResponse.AVSResponse);
                int appAVS = ConvertAVStoInt(newCC.AVLevel);
                bool isAVSPass = CompareAVS(authAVS, appAVS);

                if (isAVSPass == false)
                {
                    ccResponse.ResponseCode = 0;
                    ccResponse.ResponseReasonCode = 99;
                    ccResponse.ResponseText = "Did not meet your AVS requirements";
                    return ccResponse;
                }
                    else
                    {

                     int newCCID =  CreateCreditCardRecord(newCC, currentProfile, cctResponse, "Captured", "Auth_Capture");
                    CreditCardRecord updateCC = CreditCardRecordsGateWay.GetByID(newCCID);
                    updateCC.CaptureOn = DateTime.Now;
                    CreditCardRecordsGateWay.Update(updateCC);
                    return ccResponse;
                    }
                }
            else
            {
                return ccResponse;
            }

         }
        CreditCardResponse newCCResponse = new CreditCardResponse();
        newCCResponse.ResponseCode = 0;
        newCCResponse.AchResponse = validateResponse;
       return newCCResponse;
    }
    public static CreditCardResponse PriorAuthCapture(CreditCard newCC)
    {
        CreditCardRecord ccRecord = CreditCardRecordsGateWay.GetByCCGateWayID(newCC.CreditCardTransactionID);
        ServiceClient client = new ServiceClient();
        CreditCardTransaction ccTransaction = client.CreditCardGetTransactionById(ccRecord.CCGatewayID);
        CreditCardTransactionResponse cctResponse = client.CreditCardPriorAuthorizationCapture(ccTransaction);
        if (cctResponse.ResponseCode == 1)
        {
            ccRecord.Status = "Captured";
            ccRecord.CaptureOn = DateTime.Now;
        }

        CreditCardResponse ccResponse = CreateCCResponse(cctResponse);
        return ccResponse;
    }
    protected static int CreateCreditCardRecord(CreditCard newCC, Profile currentProfile, CreditCardTransactionResponse cctResponse, string status, string transactionType)
    {
        CreditCardRecord newCCRecord = new CreditCardRecord();
        newCCRecord.Address = newCC.Address;
        newCCRecord.AddressVerificationLevel = newCC.AVLevel;
        newCCRecord.Amount = newCC.Amount;
        newCCRecord.CardCode = newCC.CardCode;
        newCCRecord.CardNumber = newCC.CardNumber;
        newCCRecord.CCGatewayID = cctResponse.CreditCardTransactionID;
        newCCRecord.City = newCC.City;
        newCCRecord.CompanyName = newCC.CompanyName;
        newCCRecord.CreateBy = currentProfile.ACHCompanyName;
        newCCRecord.CreateOn = DateTime.Now;
        newCCRecord.Description = newCC.Description;
        newCCRecord.Expiration = newCC.Expiration;
        newCCRecord.FirstName = newCC.FirstName;
        newCCRecord.LastName = newCC.LastName;
        newCCRecord.Profile.ProfileID = currentProfile.ProfileID;
        newCCRecord.State = newCC.State;
        newCCRecord.Status = status;
        newCCRecord.TransactionType = transactionType;
        newCCRecord.Zip = newCC.Zip;
        return CreditCardRecordsGateWay.Insert(newCCRecord);
    }
A: 

You have just posted the constructors to your SFBExternalPaymentsEntities class, but you seem to say that you get an exception when you call a method that returns a collection of entities, which makes send with the exception message you are getting. The chances are the problem lies within the method you are calling, or in the code calling it rather than in the constructor code you have posted. Can you post some more relevent code or explain how the code you have posted relates to the exception.

Ben Robinson
Ben, Thanks for the response. I have tried several methods and they all give the same error but I will post one of the methods in case I am on the wrong track.I am adding some code to the next comment. It is too long to include here.
Steve
>public static CreditCardResponse AuthCapture(CreditCard newCC) { ACHResponse validateResponse = CreditCard.Validate(newCC); if (validateResponse.Status == "Accepted") { Profile currentProfile = new Profile(); currentProfile = ProfilesGateWay.GetByID(newCC.ProfileID); CreditCardTransaction newCCTransaction = CreateCreditCardTransaction(newCC, currentProfile);The very last line is where it hits the constructor and dies.
Steve
Ben, I just added the method to the original posting. Sorry, first time posting here, not familiar with the interface. Thanks for looking.
Steve