// ------------------------------------------------------------------ /// <summary> /// Load all. /// </summary> public static CustomerCompany[] GetCustomersWithUnbilledBillableTickets( DateTime forMonth ) { DateTime startDate = new DateTime( forMonth.Year, forMonth.Month, 1 ); DateTime endDate = startDate.AddMonths( 1 ); DataTable table = AdoNetSqlHelper.ExecuteTable( "GetAllCustomerCompaniesWithUnbilledBillableTickets", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@StartDate", startDate ), AdoNetSqlParamCollection.CreateParameter( "@EndDate", endDate ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (CustomerCompany[])result.ToArray( typeof( CustomerCompany ) ); } } }
public static CustomerCompany GetByCrmReplicationUniqueID( Guid crmReplicationUniqueID ) { DataRow row = AdoNetSqlHelper.ExecuteRow( "GetCustomerCompanyByCrmReplicationUniqueID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@CrmReplicationUniqueID", crmReplicationUniqueID ) ) ); if ( row == null ) { return null; } else { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( o.IsEmpty ) { return null; } else { return o; } } }
public static CustomerCompany GetForCrmAddress( Crm.CrmAddress crmAddress ) { DataRow row = AdoNetSqlHelper.ExecuteRow( "GetCustomerCompanyFromCrmAddress", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@AddressID", crmAddress.ID ) ) ); if ( row == null ) { return null; } else { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( o.IsEmpty ) { return null; } else { return o; } } }
/// <summary> /// Load all that have a ticket associated. /// </summary> /// <param name="getInfo"></param> public static CustomerCompany[] Get( CustomerCompanyGetInformation getInfo ) { DataTable table = null; if ( getInfo.CustomerGetType == CustomerCompanyGetType.CustomersWithTickets ) { table = AdoNetSqlHelper.ExecuteTable( "GetAllCustomerCompaniesWithTickets", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@FilterText", getInfo.IsFilterTextActive?getInfo.FilterText:string.Empty ) ) ); } else if ( getInfo.CustomerGetType == CustomerCompanyGetType.CustomersWithTicketsForOwn ) { table = AdoNetSqlHelper.ExecuteTable( "GetAllCustomerCompaniesWithTickets", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@FilterText", getInfo.IsFilterTextActive ? getInfo.FilterText : string.Empty ), AdoNetSqlParamCollection.CreateParameter( "@UserSamName", getInfo.UserSamName ) ) ); } else if ( getInfo.CustomerGetType == CustomerCompanyGetType.AllCustomers ) { table = AdoNetSqlHelper.ExecuteTable( "GetAllCustomerCompanies", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@FilterText", getInfo.IsFilterTextActive ? getInfo.FilterText : string.Empty ) ) ); } else { Debug.Assert( false ); } if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (CustomerCompany[])result.ToArray( typeof( CustomerCompany ) ); } } }
/// <summary> /// Load all that have a ticket associated. /// </summary> public static CustomerCompany[] GetAllWithTickets() { DataTable table = AdoNetSqlHelper.ExecuteTable( "GetAllCustomerCompaniesWithTickets", new AdoNetSqlParamCollection( ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (CustomerCompany[])result.ToArray( typeof( CustomerCompany ) ); } } }
/// <summary> /// Load an object by a given ID. /// </summary> public static CustomerCompany GetByID( int id ) { DataRow row = AdoNetSqlHelper.ExecuteRow( "GetCustomerCompanyByID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@ID", id ) ) ); if ( row == null ) { return null; } else { CustomerCompany o = new CustomerCompany(); o.Load( row ); if ( o.IsEmpty ) { return null; } else { return o; } } }