views:

47

answers:

0

I wont to write a xml configuration file that containg query to the same db, only query to view. The "query node" must have the filters parameter.

How i can write this xml file and the C# Parser , and QueryBuilder classes.

I wont some thinl like this:

<Query Name="Application Approval by Month" src="APPLICATION_APPROVAL_COUNT_BY_MONTH">
    <Filters>         
        <Filter Type="DropDownList" ID="ddlYears"  DataType="DateTime">
            <Fill Mode="AutoIncrement" Src="AppMonth" Step="1" Min="2005" Max="2010"> 
            </Fill>
            <Operator Type="Between">   
            </Operator>
        </Filter>
    </Filters>
</Query>

C# code :

public class QueryBuilder{

public QueryBuilder(string viewName) {

_query = "select * from " + viewName;

}

public void AddFilter(string operator, string name, string val){

_query = String.Format("{0} {1}{2}'{3}' ", _query, name, operator,val) ;

}

public DataTable ExcecuteQuery() {

DataTable dt; // ado.net action

return dt;

} }

This is for dinamycly reports include chart. I use the filters for build filter toolbox. These is for a berter development, when i have to add a new report or chart ( in the xml i have and the part that build the report or chart ) I have to add the view edit only the xml from adimin. Lets explain the xml: Tag query attribute src is the name of view.

Tag filter have too function : 1 get the control to add in the toolbox, 2 get the data source for these control if exist in these case the src.

Tag operator is the sql filter operator.

Any ideas or excample?