Example #1
0
    public static TMSBusRouteStopDetails Get(System.Int64 brsdStopId)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;
        TMSBusRouteStopDetails instance;


        instance = new TMSBusRouteStopDetails();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSBusRouteStopDetails_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, brsdStopId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0)
        {
            throw new ApplicationException("Could not get TMSBusRouteStopDetails ID:" + brsdStopId.ToString() + " from Database.");
        }
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Example #2
0
    public static TMSBusRouteStopDetails[] Search(System.Int64?brsdStopId, System.Int64?brsdBusId, System.Int64?brsdRouteId, System.String brsdStopName, System.String brsdArrivalTime, System.String brsdDepartureTime, System.String brsdHalt, System.String brsdKm, System.DateTime?brsdDate, System.Int32?brsdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSBusRouteStopDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, brsdStopId, brsdBusId, brsdRouteId, brsdStopName, brsdArrivalTime, brsdDepartureTime, brsdHalt, brsdKm, brsdDate, brsdStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSBusRouteStopDetails.MapFrom(ds));
    }
Example #3
0
    public static TMSBusRouteStopDetails[] MapFrom(DataSet ds)
    {
        List <TMSBusRouteStopDetails> objects;


        // Initialise Collection.
        objects = new List <TMSBusRouteStopDetails>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[TMS_BusRouteStopDetails] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_BusRouteStopDetails] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSBusRouteStopDetails instance = new TMSBusRouteStopDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
    public static TMSBusRouteStopDetails[] MapFrom(DataSet ds)
    {
        List<TMSBusRouteStopDetails> objects;

        // Initialise Collection.
        objects = new List<TMSBusRouteStopDetails>();

        // Validation.
        if (ds == null)
        throw new ApplicationException("Cannot map to dataset null.");
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        return objects.ToArray();

        if (ds.Tables[TABLE_NAME] == null)
        throw new ApplicationException("Cannot find table [dbo].[TMS_BusRouteStopDetails] in DataSet.");

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        throw new ApplicationException("Table [dbo].[TMS_BusRouteStopDetails] is empty.");

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSBusRouteStopDetails instance = new TMSBusRouteStopDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return objects.ToArray();
    }
    public static TMSBusRouteStopDetails Get(System.Int64 brsdStopId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSBusRouteStopDetails instance;

        instance = new TMSBusRouteStopDetails();

        db = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSBusRouteStopDetails_SELECT";
        dbCommand = db.GetStoredProcCommand(sqlCommand, brsdStopId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSBusRouteStopDetails ID:" + brsdStopId.ToString()+ " from Database.");
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }