AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.12.2009, 23:05   #1  
Blog bot is offline
Blog bot
Участник
 
23,905 / 805 (74) +++++++
Регистрация: 28.10.2006
paruvella: Displaying the employee images on the EP pages of Dynamics Ax
Источник: http://paruvella.spaces.live.com/Blo...4DB0!378.entry
==============

In this example I am going to illustrate, displaying the employee images on EP pages.

Note: Assumed that all the images(photos) are mapped to their employee records by using Employee Details form in Ax client.

After the images are mapped to employee records, need to Publish the images in to sharepoint path by selecting the Publish images form, from Administartion à Setup àInternet àEnterprise Portal àPublish images  as shown in below figure and click on the Publish button of the form.




In this example, I am going to filter the records from Employee table, which employee is mapped to current user (logged in Ax user).

Development Steps

Step – I:

Prepare the Dataset for this example application by using the EmplTable and CompanyImage tables as shown in below figure.




Step – II:

Override the executeQuery method on the EmplTable of the above dataset.

This method for filtering the employee records from employee table, which employee is mapped to current user.

public void executeQuery()

{

    Query                   query = new Query();

    QueryBuildDataSource    qbs, qbs1;

    QueryBuildRange         qbr;

    QueryRun                qr;

    ;

 

    qbs = query.addDataSource(tablenum(EmplTable));

    qbs1 = qbs.addDataSource(tablenum(SysCompanyUserInfo));

 

    qbs1.addLink(fieldnum(EmplTable, EmplId), fieldnum(SysCompanyUserInfo, EmplId));

    qbr = qbs1.addRange(fieldnum(SysCompanyUserInfo, UserId));

    qbr.value(curuserId());

    qbr.status(RangeStatus::Hidden);

    qbs1.joinMode(joinmode::ExistsJoin);

    this.query(query);

    super();

}

 

Override the executeQuerymethod On the CompanyImage table of the above dataset.

The following method is used for filtering the Employee image(photo) from CompanyImage Table

public void executeQuery()

{

    Query                   q;

    QueryBuildDataSource    qB;

    QueryBuildRange         qbr;

 

    q = new Query();

    qB = q.addDataSource(tablenum(CompanyImage));

 

    qbr = qB.addRange(fieldnum(CompanyImage,RefCompanyId));

    qbr.value(queryValue(emplTable.company()));

    qbr.status(RangeStatus::Hidden);

 

    qbr = qB.addRange(fieldnum(CompanyImage,RefTableId));

    qbr.value(queryValue(emplTable.TableId));

    qbr.status(RangeStatus::Hidden);

 

    qbr = qB.addRange(fieldnum(CompanyImage,RefRecId));

    qbr.value(queryValue(emplTable.RecId));

    qbr.status(RangeStatus::Hidden);

 

    this.query(q);

 

    super();

}

 

Step – III:

Developing the required webpart for displaying the employee information and his image.

Markup Code for the UserEmployeeInfo webpart





   

               

                   

                       

                           

                               

                           

                       

                   

               

           







</span>

   

       

       

       

       

       

       

   









C# (Code behind)Code for the UserEmployeeInfo webpart

using System;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using Microsoft.Dynamics.Framework.Portal.UI.WebControls;

using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;

using Microsoft.Dynamics.Framework.Data.Ax;

using Microsoft.Dynamics.Framework.Metadata.Ax;

using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;

using ApplicationProxy = Microsoft.Dynamics.Portal.Application.Proxy;

using Microsoft.Dynamics.Framework.BusinessConnector.Session;

using Microsoft.Dynamics.Framework.BusinessConnector.Adapter;

 

public partial class UserEmploeeInfo : System.Web.UI.UserControl

{

    #region Properties...

    ///

    /// Returns the current webpart

    ///

    private AxBaseWebPart WebPart

    {

        get { return AxBaseWebPart.GetWebpart(this); }

    }

 

    ///

    /// Returns the current webpart session

    ///

    private ISession AxSession

    {

        get

        {

            AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);

            return webpart == null ? null : webpart.Session;

        }

    }

 

    //Enterprise portal images folder path

    string EPLayoutImagesPath

    {

        get { return "/_layouts/ep/images/"; }

    }

 

//reading the imagepath of the employee record from sharepoint

string GetImagePath(IAxaptaRecordAdapter record)

    {

        return this.EPLayoutImagesPath + ApplicationProxy.EPWebSiteParameters.companyImageFileName(AxSession.AxaptaAdapter, record);

    }

 

  

    #endregion

 

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!this.IsPostBack)

        {

            IAxaptaRecordAdapter row = UserEmployeeInfo.GetDataSourceView("CompanyImage").DataSetView.GetCurrent().GetRecord();

            imgCompany.ImageUrl = this.GetImagePath(row);

        }     

       

    }

}

 

Step – IV:

Add this newly developed user control to AOT and deploy this webpart on the sharepoint page. Open the newly created page url in the explorer and observe the result as follows. 




This is how employee images will be displayed on the EP pages of Dynamics Ax.  ......




Источник: http://paruvella.spaces.live.com/Blo...4DB0!378.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: The Dynamics AX Client sometimes terminates when displaying certain HTML pages in a Web browser control Blog bot DAX Blogs 0 15.10.2009 15:05
emeadaxsupport: List of fixes that improve performance of certain features in Dynamics AX 2009 Blog bot DAX Blogs 0 13.10.2009 19:06
gatesasbait: Dynamics AX 2009 SSRS and SSAS Integration Tips Blog bot DAX Blogs 3 09.07.2009 13:07
Developer for Microsoft Dynamics AX Certification Roadmap Blog bot DAX Blogs 1 13.05.2009 16:17
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:37.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.