The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Collection and dataset

Last post 04-21-2008, 10:42 PM by dewacorp.alliances. 2 replies.
Sort Posts: Previous Next
  •  04-21-2008, 4:36 PM 8961

    Collection and dataset

    Hi there

    I am calling through a stored procedre and it returns as collection. If I want do data messaging this returned collection (filtering some data then sum-up etc), how do I do this? Is there any sample to do this?

    Code:
    TndFileConsumptionDetailCollection fileConsumptionDistributor = new TndFileConsumptionDetailCollection();
    fileConsumptionDistributor.GetScheduleConsumption(Convert.ToInt32(ViewState["FileConsumptionID"].ToString()), 1);
  •  04-21-2008, 6:11 PM 8963 in reply to 8961

    Re: Collection and dataset

    1. You can do LINQ queries against our collections
    2. You can use the Filter method on the collection


    But I'm not 100% sure I understand what you want to to. You can of course use the Aggregate functions in our DynamicQuery API to sum up totals in the database.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  04-21-2008, 10:42 PM 8965 in reply to 8963

    Re: Collection and dataset

    The reason I am asking this is due to I have a complex query and that needs to be in stored procedure that returns as a collection nicely using es.

    Now ... I want to reuse/extend this collection by doing manipulation within that returned collection (sum of one of the column or filtering it).

    How do I do that? Is there any example for this? How do iterate each record of this collection? How do I get the returned namefield of the result? Any example?

    My custom class:

    Code:
    Code:
    public partial class TndFileConsumptionDetailCollection : esTndFileConsumptionDetailCollection
    	{
            public bool GetScheduleConsumption(int FileConsumptionID, int ScheduleGroupID)
            {
                esParameters oParameters = new esParameters();
                oParameters.Add("FileConsumptionID", FileConsumptionID);
                oParameters.Add("ScheduleGroupID", ScheduleGroupID);
                return this.Load(esQueryType.StoredProcedure, "tnd_GetScheduleConsumption", oParameters);
            }
    
            public bool GetScheduleConsumptionSummary (int FileConsumptionID, int ScheduleGroupID)
            {
                esParameters oParameters = new esParameters();
                oParameters.Add("FileConsumptionID", FileConsumptionID);
                oParameters.Add("ScheduleGroupID", ScheduleGroupID);
                return this.Load(esQueryType.StoredProcedure, "tnd_GetScheduleConsumptionSummary", oParameters);
            }
    	}
    Note:
    The returned result from the stored procedure are completely different fieldname from the one define within the class TndFileConsumptionDetail 
     
    Code:

     

    TndFileConsumptionDetailCollection fileConsumptionDistributor = new TndFileConsumptionDetailCollection();
    fileConsumptionDistributor.GetScheduleConsumption(Convert.ToInt32(ViewState["FileConsumptionID"].ToString()), 1);
    foreach( ??? in fileConsumptionDistributor)
    {		
       XXX
    }
     
    ???: what class entity should I use?
     

    Thanks 

     

     

View as RSS news feed in XML