2013-08-08 4 views
3

저는보고 및 .net에 익숙하지 않습니다. SSRS을 사용하여 보고서를 작성했습니다. 그러나 이제 바코드를 보고서에 추가하고 싶습니다. 이미 저의 바코드 이미지를 생성하는 하나의 웹 서비스가 있지만 데이터 -matrix 형식은 지금은 나에게 내가 검색 한 바코드 이미지 나 문자열을 얻을 것이다 웹 서비스 방법을 쓰고 싶어하고Microsoft Dynamics AX 클래스를 사용하는 방법은 무엇입니까?

Microsoft.Dynamics.AX 

클래스를 통해 들어 왔지만 나는 또한하지 MSDN을 사용하는 방법을 몰라 어떤 도움을 주셨으면 내 질문은

1) Is it possible to use the Microsoft.Dynamics.AX classes in to the web service? 
2) If possible how to add references any links will be helpful ? 
3) If not then any other way for it ? any links will be helpful ? 

제 3 자 도구가 많이 있다는 것을 알고 있지만 자체 코딩으로 가능 여부는 궁금합니다. 사전에 도움을 주셔서 감사합니다.

답변

2

1) 예 2) AX 내에서 정보에 액세스하려면이 항목이 필요합니다.

using Microsoft.Dynamics.AX.Framework.Linq.Data; 
using U23 = Microsoft.Dynamics.AX.ManagedInterop; 
using U22 = Microsoft.Dynamics.AX.Framework.Linq.Data; 
using Microsoft.Dynamics.Portal.Application.Proxy; 

마지막으로 C#의 내 액세스 레이어에 대한 기본 레이아웃입니다.

public bool UpdateSomething(Something something) 
     { 
      U23.RuntimeContext.Current.TTSBegin(); 
      try 
      { 
       if (something.Count == 0) 
       { 
        something.Delete(); 
       } 
       something.Update(); 
       U23.RuntimeContext.Current.TTSCommit(); 
       return true; 
      } 
      catch 
      { 
       U23.RuntimeContext.Current.TTSAbort(); 
       return false; 
      } 
     } 

그러나 당신이있어 확인 : 당신이 뭔가를 업데이트 할 경우,

public Somethings GetSomethingsById(int id) 
    { 
     Somethings retVal = new Somethings(); 
     U22.QueryProvider provider = new U22.AXQueryProvider(null); 
     U22.QueryCollection<Somethings> somethings = new U22.QueryCollection<Somethings>(provider); 
     var somethings2 = somethings.Where(x => x.SomethingId == id); 
     retVal = somethings2.FirstOrDefault(); 
     return retVal; 
    } 

마지막 : 다음

private U23.Session _axSession = new U23.Session(); 
public U23.Session Connection 
{ 
    get 
    { 
     return this._axSession; 
    } 
} 
/// <summary> 
/// Checks to see if the AX session is connected. If it's null we return false. 
/// Then we check to see if it's logged in, then return true. Otherwise it's not logged in. 
/// </summary> 
public bool Connected 
{ 
    get 
    { 
     if (this._axSession == null) 
     { 
      return false; 
     } 
     else if (this._axSession.isLoggedOn()) 
     { 
      return true; 
     } 
     return false; 
    } 
} 

/// <summary> 
/// This connects to the AX session. If it's already connected then we don't need to connect 
/// again, so we return true. Otherwise we'll try to initiate the session. 
/// </summary> 
/// <returns> 
/// True: Connection openned successfully, or was already open. 
/// False: Connection failed. 
/// </returns> 
public bool OpenConnection() 
{ 
    if (this.Connected) 
    { 
     return true; 
    } 
    else 
    { 
     try 
     { 
      _axSession.Logon(null, null, null, null); 
      return true; 
     } 
     catch 
     { 
      return false; 
     } 
    } 
} 

/// <summary> 
/// If the session is logged on we will try to close it. 
/// </summary> 
/// <returns> 
/// True: Connection closed successfully 
/// False: Problem closing the connection 
/// </returns> 
public bool CloseConnection() 
{ 
    bool retVal = false; 
    if (this.Connection.isLoggedOn()) 
    { 
     try 
     { 
      _axSession.Logoff(); 
      retVal = true; 
     } 
     catch 
     { 
      retVal = false; 
     } 
    } 
    else 
    { 
     retVal = true; 
    } 
    this.Connection.Dispose(); 
    return retVal; 
} 

는 AX의 특정 기능에 액세스 할 수 당신은해야합니다 업데이트 할 계획 인 경우 .ForUpdate()를 사용하여 Something을 선택하십시오.

응용 프로그램 프록시 (예 : EPApplicationProxies)에 사용하려는 개체를 추가하고 프로젝트에서 해당 개체를 참조해야합니다.

+0

다이나믹을 위해 어떤 어셈블리 참조가 필요합니까? –

+0

괜찮습니다. 도와 주셔서 감사합니다 . –