예제 #1
0
		public static CrmAddress GetByCrmReplicationUniqueID(
			Guid crmReplicationUniqueID )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetCrmAddressByCrmReplicationUniqueID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@CrmReplicationUniqueID", crmReplicationUniqueID )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				CrmAddress o = new CrmAddress();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
예제 #2
0
		/// <summary>
		/// Load all for the given parent.
		/// </summary>
		public static CrmPerson[] GetForAddress(
			CrmAddress parentObject )
		{
			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetCrmPersonByCrmAddressID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID )
				) );

			if ( table == null )
			{
				return null;
			}
			else
			{
				ArrayList result = new ArrayList();

				foreach ( DataRow row in table.Rows )
				{
					CrmPerson o = new CrmPerson();
					o.Load( row );

					if ( !o.IsEmpty )
					{
						result.Add( o );
					}
				}

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (CrmPerson[])result.ToArray(
						typeof( CrmPerson ) );
				}
			}
		}
예제 #3
0
		/// <summary>
		/// Load an object by a given ID.
		/// </summary>
		public static CrmAddress GetByID(
			int id )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetCrmAddressByID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", id )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				CrmAddress o = new CrmAddress();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
예제 #4
0
		/// <summary>
		/// Load all.
		/// </summary>
		public static CrmAddress[] GetAll()
		{
			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetAllCrmAddresses",
				new AdoNetSqlParamCollection(
				) );

			if ( table == null )
			{
				return null;
			}
			else
			{
				ArrayList result = new ArrayList();

				foreach ( DataRow row in table.Rows )
				{
					CrmAddress o = new CrmAddress();
					o.Load( row );

					if ( !o.IsEmpty )
					{
						result.Add( o );
					}
				}

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (CrmAddress[])result.ToArray(
						typeof( CrmAddress ) );
				}
			}
		}