Beispiel #1
0
    public static TMSTelephoneBillDetails Get(System.Int64 tbdBillId)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;
        TMSTelephoneBillDetails instance;


        instance = new TMSTelephoneBillDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Beispiel #2
0
    public static TMSTelephoneBillDetails[] Search(System.Int64?tbdBillId, System.Int64?tbdTelephoneId, System.String tbdMonth, System.String tbdYear, System.Double?tbdBillAmount, System.DateTime?tbdDate, System.Int64?tbdAddedById, System.String tbdAddedByRemark, System.String tbdPaidStatus, System.Int32?tbdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSTelephoneBillDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, tbdBillId, tbdTelephoneId, tbdMonth, tbdYear, tbdBillAmount, tbdDate, tbdAddedById, tbdAddedByRemark, tbdPaidStatus, tbdStatus);

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


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

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

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

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

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

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

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

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

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

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

        instance = new TMSTelephoneBillDetails();

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

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

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