Friday, August 7, 2009

Function to create CrmPickList

public static Picklist GetCrmPicklist(int value) {
Picklist rslt = new Picklist();
if (value == 0)
rslt.IsNull = rslt.IsNullSpecified = true;
else
rslt.Value = value;
return rslt;
}
Enjoy,
Rami Heleg

Function to create CrmOwner

public static Owner GetCrmOwner(Guid ownerID) {
Owner rslt = new Owner();
if (ownerID == Guid.Empty)
rslt.IsNull = rslt.IsNullSpecified = true;
else {
rslt.Value = ownerID;
rslt.type = "systemuser";
}
return rslt;
}
Enjoy,
Rami Heleg

Function to create CrmStatus

public static Status GetCrmStatus(int value) {
Status rslt = new Status();
rslt.Value = value;
return rslt;
}

Enjoy,
Rami Heleg.

Function to create CrmMoney

public static CrmMoney GetCrmMoney(decimal value) {
CrmMoney rslt = new CrmMoney();
rslt.Value = value;
return rslt;
}
Enjoy,
Rami Heleg

Function to create CrmDecimal

public static CrmDecimal GetCrmDecimal(decimal value, bool isNull) {
CrmDecimal rslt = new CrmDecimal();
if (isNull)
rslt.IsNull = rslt.IsNullSpecified = true;
else
rslt.Value = value;
return rslt;
}

Enjoy,
Rami Heleg

Function to create CrmFloat

public static CrmFloat GetCrmFloat(float value, bool isNull) {
CrmFloat rslt = new CrmFloat();
if (isNull)
rslt.IsNull = rslt.IsNullSpecified = true;
else
rslt.Value = value;
return rslt;
}

Enjoy,
Rami Heleg

Function to create CrmBoolean

public static CrmBoolean GetCrmBoolean(bool value) {
CrmBoolean rslt = new CrmBoolean();
rslt.Value = value;
return rslt;
}
Enjoy,
Rami Heleg