NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Thursday, October 21, 2010

NAVmobile HowTo: Consuming Business Objects

I had recently several requests on writing a little bit more about the NAVmobile customization approach from a dev point of view. So I decided to make a short how-to serie in order to illustrate some of the concepts. Most of it can be found in the documentation, but I hope that I will clarify some of the missing points.

NAVmobile provides the mobile developers with mobile object relational mapping API. It can be used by the developers to consume data stored on the device or data stored on remote storage.
The ORM implementation found in NAVmobile is very useful when dealing with standart CRUD operations over local and remote data in terms of business objects. It has certain limiations mainly because of the resource-related limitations found on the mobile devices these days.
It is not intended to provide complete replacement of the standart ADO .NET implementation found in .NET Compct Framework. However, it gives clean and quick way to deal with the CRUD operations and the various logical and tehcnical challenges related to the synchronization of the data. Each CURD operation through the NAVmobile ORM API performs certain behind-the-scene operations over the locally stored data, which allows later the synchronization engine to properly propagate the changes to the remote side ( the ERP ).
The developer can easily go down to the pure SQL level and deal directly with the mobile storage to perform even advanced data operations.

Local Business Objects
NAVmobile provides framework for bi-directrional data synchronization between the device and virtually any remote data storage ( ussually ERPs like Microsoft Dynamics NAV or Microsoft Dynamics AX ). The existnce of local mobile storage allows the application to be used in occatioanlly connected environments where the data is stored on the device and then synchronized when a connection exists. The developer only needs to declare the business objects and then the NAVmobile framework is taking care of the initial mobile storage provisioning, synchronization and other low level technical tasks.
The business objects must be declared in the NAVmobile business object descriptor file (described in the documentation ) and then a correpsonding .NET Compact Framework class must be created.
Let's pretend we have the following business object declaration:

public class Customer:BusinessObjectBase
{
public string No;
public string Title;
public double CreditBalance;
public double CreditLimit;
}
If we need to fetch all customers with positive credit blance , we can use the following code:
IList customers = BusinessObjectBase.FetchAll("CreditBalance>0");
foreach(Customer customer in customers)
{
...
}
Creating new customer object is easy as:

Customer customer = new Customer();
customer.No="567";
customer.Title="My first customer";
customer.Add();
and then fetching only one customer by primary key can be done like this:
Customer customer = BusinessObjectBase.Fetch("567");
MessageBox.Show(customer.Title);
Updating a customer:
customer.Title="This is not my first customer";
customer.Update();

...and then deleting it:
customer.Delete();

Using this approach the developer can quicky perform CRUD operations over the business objects stored on the mobile device.

Each CRUD operation over the business objects is propagated later through the sync engine to the remote storage ( the ERP ) during the device synchronization session.

Remote Business Objects
Remote business objects can be consumed by using the NAVmobile LiveLinkEngine, which serves as an on-line connection media between the mobile device and the remote storge ( ERP, Microsoft SQL Server , etc. ). This functionality requires the existance of TCP/IP connection between the device and the NAVmobile Services.

Assuming we need to use the same Customer business object from a remote storage , we can use the following code in order to fetch all ther customers:
IList customers = LiveDataLinkService.FetchAll("CreditBalance>0");
foreach(Customer customer in customers)
{
....
}
The FetchAll method will causes the NAVmobile framework to perform invocation of the NAVmobile Services LiveDataLink Web Service in order to fetch the data from the remote sotrage. The data will be dehydrated into the Customer business object collection and ready for local processing.

Addin a new remote customer is easy too:

Customer customer = new Customer();
customer.No="567";
customer.Title="My first customer";
LiveDataLinkService.Add(customer);
The Add method will send the customer business object to the server where it will be stored.
We can use similiar approach to fetch one customer:

Customer customer = LiveDataLinkService.Fetch("567");
MessageBox.Show(customer.Title);

and then to change and update it:
customer.Title="here somes a new name";
LiveDataLinkDataService.Update(customer);

Deleting the customer is also easy:

LiveDataLinkDataService.Delete(customer);


The ORM module can be used also in the NAVmobile templating engine to quickly build mobile reports diplsayed and printed on the device. Local and remote data can be mixed together in a single report. More on this subject later.


Links:

NAVmobile/AXmobile web site

Tuesday, October 19, 2010

Windows Embedded Handheld

Windows Phone 7 turned out to be a pain for the companies, which already invested a lot in mobile solutions based on Windows Mobile especially those positioned in the B2B market. Windows Phone 7 provides appealing UI and great potential for the end user. However it turned out that it is not suitable to target some very important scenarios required when dealing with B2B solutions.


I just found that Microsoft announced new mobile operating system called Windows Embedded Handheld , which is intended to fill the gap between the personal operating system and the requirements found in some of the specific industrial

.... The first such investment will be a new operating system called Windows Embedded Handheld, which will be targeted specifically at the enterprise handheld device market. This new operating system is based on Windows Mobile 6.5 and will use same the familiar development tools (Visual Studio 2008) and SDK as Windows Mobile 6.5 to provide compatibility with the hardware, software and applications used in the enterprise. By building on the Windows Mobile 6.5 platform, Windows Embedded Handheld devices will provide compatibility with existing and future line-of-business (LOB) applications written for Windows Mobile 6.x.

Windows Embedded Handheld will also meet enterprise requirements around integrating with existing IT infrastructure like Microsoft Exchange and SharePoint as well as incorporate the device management and security functionality necessary for enterprise devices. Support for multiple ARM processor types, a wide range of input methods, and several screen sizes and resolutions will make Windows Embedded Handheld a flexible solution to power the wide range of enterprise handheld devices used today.

New features in Windows Embedded Handheld will include Office Mobile 2010 and a support lifecycle to meet the needs of enterprise customers. OEMs will have access to the Windows Embedded Handheld bits by the end of 2010 to start building new solutions.

Links
http://www.microsoft.com/windowsembedded/en-us/products/handheld/overview.mspx

Tuesday, March 16, 2010

Developing for Windows Phone 7 Series

image

If you want to take a look at the new development approach behind Windows Phone 7 Series go to developer.windowsphone.com web site and download the Microsoft Visual Studio 2010  Express for Windows Phone. This is a free development environment for the latest mobile platform from Microsoft. It is till in CTP status.

The environment allows you to develop applications targeted to Windows Phone 7 Series only. It provides the following :

        • Tools to develop mobile applications based on Silverlight For Windows Phone (out-of-web-browser)
          • XAML based UI
          • Expression Blend  may be used to design UI
          • Support for mutli-touch input, microphone,accelerometer is available through API
          • Location services on the phone and in the cloud through Windows Azure
          • Isolated data storage on the device
          • Media support: discovery, enumeration and playback
          • Cloud services integration: Notifications,Location,Identity, Feeds Social and Maps,Azure through REST and SOAP
          • Debug in the emulator and in physical device
          • Apps publishing through Marketplace in the form of .xap files
        • Tools to develop mobile applications based on XNA Game Studio 4.0
          • Development of loop-based games (2D and 3D) supporting Windows Phone 7 Series and Xbox 360

 

The environment contains Windows Phone 7 Series Emulator ,which allows you to start playing with the bit right now. We are waiting for real devices later this year.
Compatibility for legacy ( .NET Compact framework 3.5) apps is not supported – at least on a binary level.
The MIX 2010 is still in progress, so wait for more details around the developer story.

The post is short, but I’ve just started playing with the CTP bits so stay tuned for more info.

Tuesday, March 09, 2010

System.Web.Mvc.HtmlHelper<object> does not contain a definition for ActionLink

 

I spent some time playing with ASP.NET MVC 2 RC . Everything was smooth and nice until I tried to upload my simple app on a “production” server.

The app its self was a basic test app without any valuable functionality , but I wanted to test the deployment process of such an app.

So I copied the  files on the machine and made some configuration changes on the web server. I opened my web browser, hit the app and KA-BOOOOM …… I got the yellow screen of pain:

image

 

NOTES: my server has .NET 3.5 SP1 installed and System.Web.MVC.dll 2.0 registered in GAC.

All my trials to find a solution from someone else failed. I’ve checked if  I have all the needed namespaces in the <pages>/<namespaces> tag. I’ve checked if my app is configured to work

I’ve checked if I have the right assemblies deployed on the machine. Still no success!

 

Fortunately, I had a luck and found the problem my self by exploring the Web.config file. I found that I had by mistake replaced a symbol in the CompilerVersion string

image

 

So I replaced the “?” symbol with “p” and the yellow screen disappeared.

Thursday, February 18, 2010

Motorola Mobility Event in Sofia

I was at the Motorola Mobility Event in Sofia. The event was supported by Microsoft and Zebra. The goal of the event was to present the Motorola mobility solutions in front of the local image Microsoft Partners.
Motorola presented their mobility portfolio targeted to business users. Zebra also presented their products. There were other companies presenting their products and services related to the mobility like RRC.

The content of the event was interesting and the Motorola and Zebra presenters were well prepared. The event sessions were mostly in English. There was only one in Bulgarian and that was mine. I presented a success story regarding a mobility solution were I was involved based on Motorola hardware and NAVmobile

There were not many people at the event, but the food and drinks were plenty.

This event was the best one regarding the mobility in our region. Motorola presented their business vision about the local mobility market and shared great ideas about the ways to target new business niches. There were good options for business networking with the guys around.

Links:

Motorola Mobility Web Site
NAVmobile web site
Zebra web site