internal void FillDataBodyWithDataSet(WbapDataBody wbapDataBody) { foreach (DataTable table in DataSet.Tables) { BuildRequestDataBodyWithTable(wbapDataBody, table.TableName, table.Select()); } }
internal void FillDataBodyWithHashRows(WbapDataBody wbapDataBody, Dictionary <string, DataRow[]> hashRows) { foreach (KeyValuePair <string, DataRow[]> tableRows in hashRows) { FillDataBodyWithDataRows(wbapDataBody, tableRows.Value); } }
internal void BuildRequestDataBodyWithDataSet(WbapDataBody wbapElementBinds) { foreach (TableSource table in this.dataSource.Tables) { BuildRequestDataBodyWithTable(wbapElementBinds, table.TableName, null); } }
private void BuildRequestDataBodyWithForm(WbapDataBody wbapElementBinds, PageDataForm form, DataRow[] dataRows) { DataColumn[] keyCols = form.DataTable.PrimaryKey; for (int i = 0; i < keyCols.Length; i++) { string value = ""; if (dataRows != null && dataRows.Length > 0) { value = dataRows[dataRows.Length - 1][keyCols[i]].ToString(); } wbapElementBinds.Add(form.TableName + "_" + keyCols[i].ColumnName + WbdlConst._Key, value); } for (int i = 0; i < form.Fields.Count; i++) { PageDataField field = form.Fields[i]; string value = ""; if (dataRows != null && dataRows.Length > 0) { value = dataRows[dataRows.Length - 1][field.DataColumn].ToString(); } wbapElementBinds.Add(field.ElementId, value); } }
internal void SetRequestData(WbapDataBody wbapElementBinds) { PageForms forms = Page.PageForms; foreach (KeyValuePair <string, object> keyValue in wbapElementBinds) { var elementId = keyValue.Key; var Value = keyValue.Value; if (Value is WbapList) { SetWbapList(elementId, (WbapList)Value); } else if (Value is string) { PageDataForm form; FieldBindSchema schema = this.Schame.FieldBinds.FindItem(elementId); if (IsDataBindElement(schema)) { form = forms.FindForm(schema.TableId); if (form == null) { InitFieldBinds(); } form = forms.FindForm(schema.TableId); if (form == null) { throw new E_WbdlPageControllerException("not Initialize form " + schema.TableId); } form.CacheValue(schema.FieldId, (string)Value); } else { if (elementId.EndsWith(WbdlConst._Key.ToString())) { form = Page.PageForms.FindFormByKeyElement(elementId); if (form == null) { InitFieldBinds(); } form = Page.PageForms.FindFormByKeyElement(elementId); if (form != null) { form.PutKeyValue(elementId, (string)Value); } else { Page.StringElements.Add(elementId, (string)Value); } } } } } foreach (PageDataForm form in forms) { form.UpdateCache(); } }
private void ProcessMethodReturn(object methodReturnObj, WbapDataBody responseDataBody) { //需要考虑用事件的方式通知pageControl要送回前端的数据内容,或者统一用HashDataTable的方式返回; if (methodReturnObj == null) { return; } else if (methodReturnObj is DataRow[]) { pageController.FillDataBodyWithDataRows(responseDataBody, methodReturnObj as DataRow[]); } else if (methodReturnObj is Dictionary <string, DataRow[]> ) { pageController.FillDataBodyWithHashRows(responseDataBody, methodReturnObj as Dictionary <string, DataRow[]>); } }
internal void FillDataBodyWithDataRows(WbapDataBody wbapDataBody, DataRow[] dataRows) { List <DataTable> dataTables = new List <DataTable>(); foreach (DataRow row in dataRows) { if (!dataTables.Contains(row.Table)) { dataTables.Add(row.Table); } } foreach (DataTable table in dataTables) { BuildRequestDataBodyWithTable(wbapDataBody, table.TableName, dataRows); } }
internal void BuildRequestDataBodyWithTable(WbapDataBody wbapElementBinds, string tableName, DataRow[] dataRows) { PageDataForm form = Page.PageForms.FindForm(tableName); //if (form == null) InitFieldBinds(); //form = Page.PageForms.FindForm(fieldName); if (form != null) { BuildRequestDataBodyWithForm(wbapElementBinds, form, dataRows); } PageDataList list = Page.PageLists.FindListByTableName(tableName); if (list != null) { WbapList wbapList = CreatePageList(list.ListSchema); if (dataRows != null) { FillWbapList(wbapList, dataRows); } wbapElementBinds.Add(wbapList.Id + WbapList.TypeMarker, wbapList); } }