private Control GetValueControlFromJType(JColumn column) { switch (column.Type) { case JType.Boolean: return(new CheckBox { Name = $"ckb{column.Name}" }); case JType.Byte: case JType.Double: case JType.Guid: case JType.Integer: case JType.Long: case JType.Decimal: case JType.Uri: case JType.String: case JType.Date: case JType.Time: case JType.DateTime: return(new TextBox { Name = $"txt{column.Name}" }); case JType.Choice: if (string.IsNullOrEmpty(column.FKTable) || string.IsNullOrEmpty(column.FKColumn)) { return new ComboBox { Name = $"cob{column.Name}", DropDownStyle = ComboBoxStyle.DropDownList, DataSource = column.Choices } } ; else { return new TextBox { Name = $"txt{column.Name}" } }; case JType.Object: case JType.Array: return(new Label { Name = $"txt{column.Name}" }); case JType.None: default: return(new Label { Name = $"txt{column.Name}", Text = $"({column.Type.ToString()})" }); } }
public InputControlSet(JTable sourceTable, JColumn sourceColumn) { JTable = sourceTable; JColumn = sourceColumn; }
/// <summary> /// fetch Data from DataServer and create list of Jtable objects /// </summary> /// <param name="sqlIn">input parameter</param> /// <returns>null if error , other wise list of JTable object </returns> public List <JTable> ExecuteJDataSet(SqlParamsIn sqlIn) { try { List <JTable> outO = new List <JTable>(); JTable obj = null; DataSet ds = null; string sql = sqlIn.sql; //string sql = sqlIn.sql; //if (!IsTableAccess(sql)) // return null; ds = ExecuteDataSet(sqlIn); if (ds == null || ds.Tables.Count < 1) { return(null); } // bool singleTable = ds.Tables.Count >= 0; //StringBuilder tables = new StringBuilder("["); // StringBuilder columns = new StringBuilder(!singleTable ? "[{" : "{"); int MAX_ROWS = 10001; for (int table = 0; table < ds.Tables.Count; table++) { obj = new JTable(); var dt = ds.Tables[table]; obj.name = dt.TableName; obj.records = ds.Tables[table].Rows.Count; obj.page = sqlIn.page; obj.total = 1; for (int column = 0; column < dt.Columns.Count; column++) { var cc = new JColumn(); cc.index = column; cc.name = dt.Columns[column].ColumnName.ToLower(); cc.type = dt.Columns[column].DataType.ToString().ToLower(); obj.columns.Add(cc); } int count = dt.Rows.Count; for (int row = 0; row < count; row++) { if (row > MAX_ROWS) { break; } JRow r = new JRow(); r.id = row; for (int column = 0; column < dt.Columns.Count; column++) { //var c = new Dictionary<string,object>(); //c[dt.Columns[column].ColumnName.ToLower()] = dt.Rows[row][column]; r.cells[dt.Columns[column].ColumnName.ToLower()] = dt.Rows[row][column]; //rows.Append(dt.Columns[column].ColumnName).Append(":").Append(dt.Rows[row][column]); } obj.rows.Add(r); } outO.Add(obj); } ds.Tables.Clear(); ds.Dispose(); return(outO); } catch { return(null); } }