示例#1
0
        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);
            }
        }
示例#2
0
        private void InitFieldBinds()
        {
            Page.StringElements.Clear();

            foreach (FieldBindSchema fieldBindSchema in Schame.FieldBinds)
            {
                if (IsDataBindElement(fieldBindSchema))
                {
                    PageDataForm form = Page.PageForms.FindForm(fieldBindSchema.TableId);
                    if (form == null)
                    {
                        DataTable dataTable = DataSet.Tables[fieldBindSchema.TableId];
                        if (dataTable == null)
                        {
                            continue;
                        }
                        form           = new PageDataForm(fieldBindSchema.TableId);
                        form.DataTable = dataTable;
                        Page.PageForms.Add(form);
                    }
                    PageDataField field = new PageDataField(fieldBindSchema);
                    field.DataColumn = form.DataTable.Columns[fieldBindSchema.FieldId];
                    form.Fields.Add(field);
                }
                else
                {
                    Page.StringElements.Add(fieldBindSchema.Id, "");
                }
            }
        }
示例#3
0
        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);
            }
        }