Argos
Phil's CRM Blog | Custom Controls

Generics with CRM

by Phil Adams 11. January 2010 23:26

 

Generics is a very nice feature of the C# and VB.NET language, and can be used to simplify the CRM Web Service method calls. One of my responsibilities is to develop a framework for CRM development, and one of the main classes in this framework is called CrmSystem, it wraps the CrmService methods among other things. Using generics one can then type,

C#
account acc = CrmSystem.Retrieve<account>(myAccountId);

VB
Dim acc As account = CrmSystem.Retrieve(Of account)(myAccountId)

also we use a special NameValue class CrmConditions to one of our Execute overloads, here is how it can look

C#
List<account> acc = CrmSystem.Execute<account>(new CrmCondition("emailaddress1", me@someone.com));

VB
Dim acc As List(Of account) = CrmSystem.Execute(Of account)(New CrmCondition("emailaddress1", "me@someone.com"))

This would retrieve all accounts that got the email "me@someone.com"

Here is one of the overloads for the Retrive Method that uses Generics, it calls an other overload that does the actual call to CRM Web Service using the EntityName string that we get thru typeof(T).Name

C#
public T Retrieve<T>(Guid id, params string[] columnSet) where T : BusinessEntity {
     return (T)Retrieve(typeof(T).Name, id, new ColumnSet(columnSet));
}

VB
Public Function Retrieve(Of T As BusinessEntity)(ByVal id As Guid, ByVal ParamArray columnSet As String()) As T
    Return DirectCast(Retrieve(GetType(T).Name, id, New ColumnSet(columnSet)), T)
End Function

Hope this gives some inspiration for your own CrmApi wrappers :)

Generics with CRM

Tags:

CRM | Custom Controls | FetchXML | MSCRM | mscrm4

XPROG Programmer For Motorola CPU’s

by Phil Adams 5. August 2009 21:02

The XPROG supports programming of Motorola 68HC05xx, 68HC08xx, 68HC11xx microcontrollers internal EEPROM and serial EEPROM's - most used programmable device in car radios, automotive computers (dashboards, AIRBAG, immobilizers), and industrial products.

Motorola microcontrollers (on-board programming):
MC68HC11A8, MC68HC11E9, MC68HC711E9, MC68HC811E2, MC68HC11E20, MC68HC11G5, MC68HC711G5, MC68HC11N4, MC68HC11F1, MC68HC11PH8, MC68HC711PH8, MC68HC11PA8, MC68HC711PA8, MC68HC11K4, MC68HC711K4, MC68HC11KA4, MC68HC711KA4, MC68HC11L6, MC68HC711L6,MC68HC11P2, MC68HC11F1

MC68HC11PH8(0H30R Q=614kHz) , MC68HC11PH8(3D64J Q=614kHz) , MC68HC11P2(0G10V Q=614kHz) , MC68HC11P2(1E53M Q=614kHz) , MC68HC11P2(3E74J Q=614kHz) , MC68HC11EA9(2D47J) , MC68HC11EA9(1D47J) , MC68HC11EA9, MC68HC05B6/16/32, MC68HC705B16/16N/32, MC68HC05X16/32,C68HC05B32 (new type from Audi CHORUS),MC68HC05H12(0H57A) , MC68HC05E6(0G72G) , MC68HC05E6(0F82B) , MC68HC05X32(0D69J;1H52A) , MC68HC05X32(0D53J) , MC68HC08AZ32 , C68HC08AZ32(0J66D) , MC68HC08AS60 , MC68HC08AZ60 , MC68HC08AZ60A ,

Serial EEPROM:
AT93C46, AT93C46A, AT93C56, AT93C57, AT93C66, AT59C11, AT59C12, AT59C13, CAT24C01, CAT24WC01, CAT24C02, CAT24WC02, CAT24C04, CAT24WC04, CAT24C08, CAT24WC08, CAT24C16, CAT24WC16, CAT24C32, CAT24WC32, CAT24C64, CAT24WC64, CAT64LC10, CAT64LC20, CAT64LC30, CAT93C46, CAT93C46A, CAT93C56, CAT93C57, CAT93C66, CAT93C66A, CAT93C86, 24C01A, 24LC01B, 24C02A, 24LC02B, 24C04A, 24LC04B, 24C08A, 24LC08B, 24C16A, 24LC16B, 24C32A, 24LC32B, 85C72, 85C82, 85C92, 93C06, 93C46, 93LCS46, 93LC46B, 93C56, 93LC56, 93C66, 93LC66, 93C76, 93LC76, 93C86, 93LC86, M6M80011P, M6M80021P, M6M80041P, NM93C06, NM93C46, NM93C14, NM93C56, NM93CS56, NM93C66, NM93CS66, NM93C86A, SDE2506, SDE2526, X24C00, X24C01, X2402, X2404, X2408, X24164, X24165, X2444, X24C44.

Hardware Specifications :
Include high output current MPU.
External output for on-board device programming via universal XPROG connector..
Serial port interface (up to 115K baud) works on (COM1, COM 2, COM3 or COM4).

Function Specifications:
File Load / Save, Read, Write, Verify, Checksum, Security, Edit, Options Configuration.

Electrical Requirements:
Operating Voltage : +12-15V DC.
Power Consumption : 50 mA.

Processor:
INTEL Pentium 60MHz or faster (depends on operating system)

Memory (RAM)
32MB (depends on operating system)

Hard drive:
5MB free space

Communication:
One free physical COM-port

Operating system:
Microsoft Windows 95/98 (Windows NT/ME/2000/XP is not supported)

How to read/program supported devices via universal XPROG connector, download  the XPROG-m manual

NOTE: If XPROG software returns error:  "This program is not compatible with your hardware.
Please contact with you supplier" ,  check  that  the PIC EEPROM memory is programmed correctly.

Downloads :

Click link below for download Device Programmer Desktop Ver. 4.2

Click link below for download XPROG schematics  

Click link below for download XPROG PIC binfiles

Tags: ,

Car Radio | Custom Controls

Render Control into HTML String

by Phil Adams 6. July 2009 13:50

Occasionally there is a need to get string representation of ASP.NET control in other words - render it into string instead of letting it be rendered on the page. The following method renders a control into its HTML string.
Namespaces used:

using System.Text;
using System.IO;
using System.Web.UI;


public string RenderControl(Control ctrl) 
{
    StringBuilder sb = new StringBuilder();
    StringWriter tw = new StringWriter(sb);
    HtmlTextWriter hw = new HtmlTextWriter(tw);

    ctrl.RenderControl(hw);
    return sb.ToString();
}

Tags: ,

Custom Controls | ASP.Net

About Phil

Phil has been working with CRM since the BETA of CRM v1.0 and has seen a lot of the problems arising from installation, maintenance and Development.

Phil specializes in the ISV area of CRM; Creating Add-Ons and Plugins for various clients.

Phil currently works as a Microsoft Dynamics CRM Consultant and Developer for Cambridge Online Systems Ltd In the UK.

Phil also has several Microsoft Certifications in .NET and CRM