// ------------------------------------------------------------------ /// <summary> /// Load an object by a given ID. /// </summary> public static Ticket GetByID( int id ) { DataRow row = AdoNetSqlHelper.ExecuteRow( "GetTicketByID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@ID", id ) ) ); if ( row == null ) { return null; } else { Ticket o = new Ticket(); o.Load( row ); if ( o.IsEmpty ) { return null; } else { return o; } } }
/// <summary> /// Load all for the given parent. /// </summary> public static TicketEvent[] GetForTicket( Ticket parentObject ) { DataTable table = AdoNetSqlHelper.ExecuteTable( "GetTicketEventsByTicketID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { TicketEvent o = new TicketEvent(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (TicketEvent[])result.ToArray( typeof( TicketEvent ) ); } } }
private void newTicketToolStripMenuItem_Click( object sender, EventArgs e ) { DBObjects.Ticket ticket = new DBObjects.Ticket(); if ( customerCompanyTreeView.SelectedNode != null ) { ticket.CustomerCompanyID = (customerCompanyTreeView.SelectedNode.Tag as DBObjects.CustomerCompany).ID; } TicketEditForm form = new TicketEditForm( ticket ); form.Show( this ); }
public static Ticket[] SearchSimple( string searchText ) { DataTable table = table = AdoNetSqlHelper.ExecuteTable( "SearchSimpleForTickets", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@SearchText", searchText ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }
/// <summary> /// Queries for tickets with comlex information. /// </summary> /// <param name="getInfo"></param> /// <returns></returns> public static Ticket[] Get( TicketGetInformation getInfo ) { getInfo.Normalize(); DataTable table = table = AdoNetSqlHelper.ExecuteTable( "GetTicketsByInfo", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@CustomerCompanyID", getInfo.Company.ID ), AdoNetSqlParamCollection.CreateParameter( "@OwnerType", getInfo.TicketOwnerGetType.ToString() ), AdoNetSqlParamCollection.CreateParameter( "@StateType", getInfo.TicketStateGetType.ToString() ), AdoNetSqlParamCollection.CreateParameter( "@UserSamName", getInfo.UserSamName ), AdoNetSqlParamCollection.CreateParameter( "@FilterText", getInfo.IsFilterTextActive ? getInfo.FilterText : string.Empty ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }
public static Ticket[] GetAssignedToUser( User user, TicketEvent.TicketEventState state ) { if ( user == null ) { return null; } else { DataTable table = AdoNetSqlHelper.ExecuteTable( "GetTicketsAssignedToUserSamNameWithState", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@UserSamName", user.SamName ), AdoNetSqlParamCollection.CreateParameter( "@State", state.ToString() ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } } }
/// <summary> /// Load all. /// </summary> public static Ticket[] GetAll() { DataTable table = AdoNetSqlHelper.ExecuteTable( "GetAllTickets", new AdoNetSqlParamCollection( ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }
/// <summary> /// Load all for the given parent. /// </summary> public static Ticket[] GetForCustomerPerson( CustomerPerson parentObject ) { DataTable table = AdoNetSqlHelper.ExecuteTable( "SELECT * FROM [Tickets] WHERE [CustomerPersonID]=@ID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }
/// <summary> /// Load all for the given parent. /// </summary> public static Ticket[] GetForCustomerCompanyAssignedToUser( CustomerCompany parentObject, User user ) { DataTable table = AdoNetSqlHelper.ExecuteTable( "GetTicketsForCustomerCompanyAssignedToUser", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID ), AdoNetSqlParamCollection.CreateParameter( "@UserSamName", user.SamName ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }
/// <summary> /// Load all for the given parent. /// </summary> public static Ticket[] GetUnbilledBillableForCustomerCompany( CustomerCompany parentObject, DateTime forMonth ) { DateTime startDate = new DateTime( forMonth.Year, forMonth.Month, 1 ); DateTime endDate = startDate.AddMonths( 1 ); DataTable table = AdoNetSqlHelper.ExecuteTable( "GetUnbilledBillableTicketsByCustomerCompanyID", new AdoNetSqlParamCollection( AdoNetSqlParamCollection.CreateParameter( "@CustomerCompanyID", parentObject.ID ), AdoNetSqlParamCollection.CreateParameter( "@StartDate", startDate ), AdoNetSqlParamCollection.CreateParameter( "@EndDate", endDate ) ) ); if ( table == null ) { return null; } else { ArrayList result = new ArrayList(); foreach ( DataRow row in table.Rows ) { Ticket o = new Ticket(); o.Load( row ); if ( !o.IsEmpty ) { result.Add( o ); } } if ( result.Count <= 0 ) { return null; } else { return (Ticket[])result.ToArray( typeof( Ticket ) ); } } }