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


        instance = new TMSParentRepresentative();

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

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0)
        {
            throw new ApplicationException("Could not get TMSParentRepresentative ID:" + prId.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 TMSParentRepresentative[] Search(System.Int64?prId, System.Int64?prParentID, System.Int64?prStandard, System.Int64?prDivision, System.String prType, System.DateTime?prDate, System.Int32?prStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSParentRepresentative_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, prId, prParentID, prStandard, prDivision, prType, prDate, prStatus);

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


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

        // 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_ParentRepresentative] in DataSet.");
        }

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

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

        // Return collection.
        return(objects.ToArray());
    }
Example #4
0
 public static DataSet GetSearch(TMSParentRepresentative searchObject)
 {
     return(GetSearch(searchObject.PrId, searchObject.PRParentID, searchObject.PRStandard, searchObject.PRDivision, searchObject.PRType, searchObject.PRDate, searchObject.PRStatus));
 }
Example #5
0
 public static void Update(TMSParentRepresentative tMSParentRepresentative, DbTransaction transaction)
 {
     tMSParentRepresentative.Update(transaction);
 }
Example #6
0
 public static void Update(TMSParentRepresentative tMSParentRepresentative)
 {
     tMSParentRepresentative.Update();
 }
 public static DataSet GetSearch(TMSParentRepresentative searchObject)
 {
     return GetSearch(searchObject.PrId, searchObject.PRParentID, searchObject.PRStandard, searchObject.PRDivision, searchObject.PRType, searchObject.PRDate, searchObject.PRStatus);
 }
 public static void Update(TMSParentRepresentative tMSParentRepresentative, DbTransaction transaction)
 {
     tMSParentRepresentative.Update(transaction);
 }
 public static void Update(TMSParentRepresentative tMSParentRepresentative)
 {
     tMSParentRepresentative.Update();
 }
    public static TMSParentRepresentative[] MapFrom(DataSet ds)
    {
        List<TMSParentRepresentative> objects;

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

        // 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_ParentRepresentative] in DataSet.");

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

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

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

        instance = new TMSParentRepresentative();

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

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

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