public void Add(FilterField filterField) { }
public void AddGridToCollection(DBSNAPGridView sdg, DataGridNameCollection thispage_dgnc) { // is it already in the collection ? //if not, create a new datagridcouple and add it to the collection if (!IsDGNinDGNC(sdg.ID, thispage_dgnc)) { DataGridControl dc = new DataGridControl(); dc.GridName = sdg.ID; dc.ViewSource = sdg.ViewSource; dc.ActionTarget = sdg.ActionTarget; dc.SQLB.Distinct = sdg.Distinct; if (sdg.AllowPaging) { dc.SQLB.PageIndex = sdg.PageIndex; dc.SQLB.PageSize = sdg.PageSize; } else { dc.SQLB.PageSize = -1; } //setting the keyfields in the SQLB of the dc string[] keyfields = sdg.PrimaryKey.Split(','); foreach (string keyfield in keyfields) { string kf = keyfield.Trim(); DataField dfield = new DataField(); dfield.Name = kf; dfield.PKField = true; dc.SQLB.DataFields.Add(dfield); } dc.ParentControl = sdg.ParentControl; dc.ParentKeyExpression = sdg.ParentKeyExpression; //setting the parentkey fields as filters //getting the keys if (dc.ParentKeyExpression != null && dc.ParentKeyExpression != "") { string[] parentkeys = sdg.ParentKeyExpression.Split(','); foreach (string parentkey in parentkeys) { string[] keys = parentkey.Split('='); FilterField ffield = new FilterField(); ffield.Name = keys[1].Trim(); ffield.FilterType = snpFilterType.Equal; // ffield.Value = keys[0].Trim(); ffield.ParentKey = true; dc.SQLB.FilterFields.Add(ffield); } } //putting in the datagrid columns as datafields DataControlFieldCollection cols = sdg.Columns; foreach (DataControlField col in cols) { string dfieldname = string.Empty; try { Type t = col.GetType(); dfieldname = (string)t.InvokeMember("DataField", System.Reflection.BindingFlags.GetProperty, null, col, new object[] { }); } catch { } if (dfieldname != string.Empty || dfieldname.Trim() != string.Empty) { DataField dfield = new DataField(); dfield.Name = dfieldname.Trim(); dc.SQLB.DataFields.Add(dfield); } } //setting the sortfields in the SQLB of the dc string[] sortfields = sdg.OrderBy.Split(','); foreach (string sortfield in sortfields) { string sf = sortfield.Trim(); string[] sfe = sf.Split(' '); string sfe0 = sfe[0] == null || sfe[0] == "" ? "" : sfe[0].Trim(); if (sfe0 != "") { SortField sfield = new SortField(); sfield.Name = sfe0; string sfe1 = sfe[1] == null || sfe[1] == "" ? "" : sfe[1].Trim(); if (sfe1 != "") { sfe1 = sfe1.ToUpper(); if (sfe1 == "ASC") { sfield.Order = snpOrder.ASC; } else { sfield.Order = snpOrder.DESC; } } dc.SQLB.SortFields.Add(sfield); } } dc.GridPage = sdg.Page.ToString(); dc.OnPage = true; thispage_dgnc.Add(dc); //also adding the parentdatagrid //this is necessary for 2 reasons : //-sorting the grids //-also, when there are no controls on the page if (dc.ParentControl != null && dc.ParentControl != "") { AddParentControl(sdg.Page, dc, thispage_dgnc); } } }
public void GetFieldDataTypes(SQLBuilder sqlb) { XSDAdapter xsda = new XSDAdapter(_physappath); ArrayList al_fields = new ArrayList(); //getting datatypes for filterfields if (sqlb.FilterFields.Count > 0) { if (sqlb.DDLDataFilterField > 0) { DataField dfield = sqlb.DataFields.Item(sqlb.DDLDataFilterField - 1); al_fields.Add(dfield.Name); } else { foreach (FilterField ffield in sqlb.FilterFields) { al_fields.Add(ffield.Name); } } string[] fields = (string[])al_fields.ToArray(typeof(string)); string[] datatypes = xsda.GetDataTypes(_xsdn, fields); int u = datatypes.GetUpperBound(0); for (int i = 0; i <= u; i++) { FilterField ffield = sqlb.FilterFields.Item(i); ffield.DataType = datatypes[i]; } } //only get datafield types when not sql select or sql delete if (sqlb.SQLtype != snpSQLtype.sqlSelect && sqlb.SQLtype != snpSQLtype.sqlDelete) { al_fields = new ArrayList(); foreach (DataField dfield in sqlb.DataFields) { al_fields.Add(dfield.Name); } string[] fields = (string[])al_fields.ToArray(typeof(string)); string[] datatypes = xsda.GetDataTypes(_xsdn, fields); int u = datatypes.GetUpperBound(0); for (int i = 0; i <= u; i++) { DataField dfield = sqlb.DataFields.Item(i); dfield.DataType = datatypes[i]; } } }