public static TMSUserType Get(System.Int32 utTypeId)
    {
        DataSet     ds;
        Database    db;
        string      sqlCommand;
        DbCommand   dbCommand;
        TMSUserType instance;


        instance = new TMSUserType();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSUserType[] Search(System.Int32?utTypeId, System.String utTypeName, System.DateTime?utDate, System.Int32?utStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSUserType_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, utTypeId, utTypeName, utDate, utStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
示例#4
0
 public static DataSet GetSearch(TMSUserType searchObject)
 {
     return(GetSearch(searchObject.UTTypeId, searchObject.UTTypeName, searchObject.UTDate, searchObject.UTStatus));
 }
 public static void Update(TMSUserType tMSUserType, DbTransaction transaction)
 {
     tMSUserType.Update(transaction);
 }
 public static void Update(TMSUserType tMSUserType)
 {
     tMSUserType.Update();
 }
 public static TMSUserType[] Search(TMSUserType searchObject)
 {
     return Search ( searchObject.UTTypeId, searchObject.UTTypeName, searchObject.UTDate, searchObject.UTStatus);
 }
    public static TMSUserType[] MapFrom(DataSet ds)
    {
        List<TMSUserType> objects;

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

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

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

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

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

        instance = new TMSUserType();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
示例#10
0
 public static DataSet GetSearch(TMSUserType searchObject)
 {
     return GetSearch(searchObject.UTTypeId, searchObject.UTTypeName, searchObject.UTDate, searchObject.UTStatus);
 }
 public static TMSUserType[] Search(TMSUserType searchObject)
 {
     return(Search(searchObject.UTTypeId, searchObject.UTTypeName, searchObject.UTDate, searchObject.UTStatus));
 }
 public static void Update(TMSUserType tMSUserType, DbTransaction transaction)
 {
     tMSUserType.Update(transaction);
 }
 public static void Update(TMSUserType tMSUserType)
 {
     tMSUserType.Update();
 }