private static FG_DataGrid GetDataGridGlobal(EbDataGrid DG, SingleTable Table, SingleRow RowModel) { List <FG_Row> Rows = new List <FG_Row>(); Dictionary <string, object> Metas = null; foreach (SingleRow Row in Table) { if (Row.IsDelete) { continue; } FG_Row fG_Row = new FG_Row() { id = Convert.ToInt32(Row[FormConstants.id]) }; foreach (EbControl _control in DG.Controls) { if (_control is EbDGPowerSelectColumn) { Metas = new Dictionary <string, object>() { { FG_Constants.Columns, Row.GetColumn(_control.Name).R } } } ; else { Metas = null; } fG_Row.Controls.Add(new FG_Control(_control.Name, _control.ObjType, Row[_control.Name], Metas)); } Rows.Add(fG_Row); } FG_Row fG_RowModel = new FG_Row(); foreach (EbControl _control in DG.Controls) { if (_control is EbDGPowerSelectColumn) { Metas = new Dictionary <string, object>() { { FG_Constants.Columns, RowModel.GetColumn(_control.Name).R } } } ; else { Metas = null; } fG_RowModel.Controls.Add(new FG_Control(_control.Name, _control.ObjType, RowModel[_control.Name], Metas)); } return(new FG_DataGrid(DG.Name, Rows, fG_RowModel)); }
private void CheckDGUniqe(SingleRow Row, ColumnSchema _column, TableSchema _table, List <string> Vals, EbWebForm WebForm) { if (Row.IsDelete) { return; } SingleColumn cField = Row.GetColumn(_column.ColumnName); if (cField == null || cField.Value == null || (Double.TryParse(Convert.ToString(cField.Value), out double __val) && __val == 0)) { return; } if (Vals.Contains(Convert.ToString(cField.Value))) { string msg2 = $" {(WebForm == MasterForm ? "" : "(DataPusher)")} {(cField.Control.Hidden ? "[Hidden]" : "")}"; string msg1 = $"Value in the '{(cField.Control as EbDGColumn).Title ?? cField.Control.Name}' column ({_table.Title ?? _table.ContainerName} Grid) must be unique" + msg2; msg2 = $"DG column is not unique. Control name: {_table.ContainerName}.{cField.Control.Name}" + msg2; throw new FormException(msg1, (int)HttpStatusCode.BadRequest, msg2, "EbWebFormCollection -> ExecUniqueCheck"); } Vals.Add(Convert.ToString(cField.Value)); }