コード例 #1
0
    public static TMSContactDetails Get(System.Int64 cdDetailsId)
    {
        DataSet           ds;
        Database          db;
        string            sqlCommand;
        DbCommand         dbCommand;
        TMSContactDetails instance;


        instance = new TMSContactDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
コード例 #2
0
    public static TMSContactDetails[] Search(System.Int64?cdDetailsId, System.String cdTitle, System.String cdName, System.String cdMobile, System.String cdEmailId, System.String cdmsnId, System.String cdgTalkId, System.String cdSkype, System.String cdWebsite, System.String cdExtra1, System.String cdExtra2, System.DateTime?cdDate, System.Int32?cdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSContactDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, cdDetailsId, cdTitle, cdName, cdMobile, cdEmailId, cdmsnId, cdgTalkId, cdSkype, cdWebsite, cdExtra1, cdExtra2, cdDate, cdStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
コード例 #4
0
    public static TMSContactDetails[] MapFrom(DataSet ds)
    {
        List<TMSContactDetails> objects;

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

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

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

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

        // Return collection.
        return objects.ToArray();
    }
コード例 #5
0
    public static TMSContactDetails Get(System.Int64 cdDetailsId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSContactDetails instance;

        instance = new TMSContactDetails();

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

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

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