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


        instance = new TMSVendorItemDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
コード例 #2
0
    public static TMSVendorItemDetails[] Search(System.Int64?vidDetailsId, System.Int64?vidVendorId, System.String vidItemType, System.String vidSchoolType, System.String vidSchoolSubType, System.String vidBoys, System.String vidGirls, System.String vidItemName, System.String vidBookName, System.String vidItemColor, System.String vidItemBookAuthor, System.String vidItemBookPublication, System.String vidItemSize, System.String vidItemCost, System.String vidItemStatus, System.DateTime?vidDate, System.Int32?vidStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSVendorItemDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, vidDetailsId, vidVendorId, vidItemType, vidSchoolType, vidSchoolSubType, vidBoys, vidGirls, vidItemName, vidBookName, vidItemColor, vidItemBookAuthor, vidItemBookPublication, vidItemSize, vidItemCost, vidItemStatus, vidDate, vidStatus);

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


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

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

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

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

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

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

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

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

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

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

        instance = new TMSVendorItemDetails();

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

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

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