Example #1
0
        protected virtual FlowDataRow CreateNewRow(FlowDataTable table, int tableIndex, int rowIndex)
        {
            FlowDataRow row = new FlowDataRow();

            for (int i = 0; i < table.Columns.Count; i++)
            {
                FlowDataColumn column = table.Columns[i];
                row[column.ColumnName] = GetDemoValue(column, tableIndex, rowIndex, i);
            }

            return(row);
        }
Example #2
0
        protected virtual JArray GenFieldItems(Model model, FlowDataTable srcTable, FlowDataRow srcRow, FlowDataTable settingTable)
        {
            JArray rv = new JArray();

            foreach (FlowDataColumn settingColumn in settingTable.Columns)
            {
                FlowDataColumn srcColumn = srcTable.Columns.TryGetColumn(settingColumn.ColumnName);
                if (srcColumn == null || !settingColumn.AllowRead)
                {
                    continue;
                }

                JObject fieldItem = this.GenFieldItem(model, srcTable, srcRow, srcColumn, settingColumn);
                rv.Add(fieldItem);
            }

            return(rv);
        }
Example #3
0
    private string GetMapValue(MyColumnInfoCollection columns, FlowDataRow row)
    {
        string mapvalue = String.Empty;

        foreach (MyColumnInfo column in columns)
        {
            if (!column.Map)
            {
                continue;
            }

            string item = column.ColumnName + "=" + FormatSetValue(row[column.ColumnName]);
            if (String.IsNullOrEmpty(mapvalue))
            {
                mapvalue = item;
            }
            else
            {
                mapvalue += ";" + item;
            }
        }

        return(mapvalue);
    }
Example #4
0
    private HyperLink CreateSetValueLink(string value, MyColumnInfoCollection columns, FlowDataRow row, int index)
    {
        HyperLink link = new HyperLink();

        link.Text = value;

        link.ID          = "row" + index.ToString();
        link.NavigateUrl = String.Format("javascript:SetOwnerBtnValue({0},document.getElementById('{1}').data);",
                                         Request.QueryString["idx"],
                                         link.ID);

        link.Attributes.Add("data",
                            GetMapValue(columns, row));

        return(link);
    }
Example #5
0
        protected virtual JObject GenFieldItem(Model model, FlowDataTable table, FlowDataRow row, FlowDataColumn column, FlowDataColumn setting)
        {
            object  value = row[column.ColumnName];
            JObject field = new JObject();
            string  valuePropertyName;
            string  xclass = setting.MapTo;

            switch (xclass)
            {
            case "Ext.field.Field":
                valuePropertyName = "html";
                break;

            case "YZSoft.src.field.Users":
                valuePropertyName = "stringValue";
                break;

            default:
                valuePropertyName = "value";
                break;
            }

            value = this.DoRender(setting.SParam1, xclass, value);

            if (valuePropertyName == "html" && value is string)
            {
                value = YZUtility.HtmlEncodeBR((string)value);
            }

            field["xclass"]          = xclass;
            field["label"]           = setting.DisplayName;
            field[valuePropertyName] = new JValue(value);

            if (!table.IsRepeatableTable)
            {
                if (setting.AllowWrite || model == Model.Post)
                {
                    field["xdatabind"] = column.FullName;
                }
                else
                {
                    field["readOnly"] = true;
                }
            }
            else
            {
                field["readOnly"] = true;
            }

            JObject config = setting.FilterValue as JObject;

            if (config != null)
            {
                foreach (KeyValuePair <string, JToken> kv in config)
                {
                    field[kv.Key] = kv.Value;
                }
            }

            return(field);
        }