public string getSyncValues() { string s; s = "<SVS>"; // constructGrid.syncData(0, for (int a = 1; a < this.constructGrid.Columns.Count; a++) { dt.Rows[0].EndEdit(); //FGLFoundField i=activeFields[a]; if (isFieldForConstruct(a)) { s += "<SV FN=\"" + constructGrid.getFieldName(a - 1) + "\">" + System.Security.SecurityElement.Escape(FGLUtils.GetString(constructGrid.Rows[0].Cells[a].EditedFormattedValue)) + "</SV>"; } } s += "</SVS>"; return(s); }
public string getSyncValues() { string s; string subscript_string; int row; // Data.AcceptChanges(); // Originally - I used the DataTable - but that just doesn't sync properly // I'm only using that at all because otherwise the autoinsert new row // doesn't seem to work.. // // Basically - the DataGridView isn't being very helpful... // s = "\n<SYNCROWS>\n"; for (row = 0; row < inputArrayGrid.Rows.Count; row++) { string rowData; subscript_string = "" + (row + 1); if (row >= maxRows) { continue; } rowData = " <ROW SUBSCRIPT=\"" + subscript_string + "\">\n"; rowData += " <SVS>\n"; for (int col = 0; col < this.nCols; col++) { string rval = ""; DataGridViewCell c = inputArrayGrid.Rows[row].Cells[col + 1]; if (c.IsInEditMode) { // We're still in edit mode - so its probably a ON KEY - so set the fldbuf values.. if (c.EditedFormattedValue is DBNull) { rval = ""; } else { if (c.FormattedValueType == typeof(Boolean)) { DataGridViewCheckBoxCell ch; ch = (DataGridViewCheckBoxCell)c; if (ch.EditedFormattedValue == null) { s = null; } if (c.EditedFormattedValue is string) { rval = (string)c.EditedFormattedValue; } else { if ((Boolean)c.EditedFormattedValue) { rval = (string)ch.TrueValue; } else { rval = (string)ch.FalseValue; } } } else { rval = FGLUtils.GetString(inputArrayGrid.Rows[row].Cells[col + 1].EditedFormattedValue); // Data.Rows[row][col + 1]; } } } else { if (c.Value is DBNull) { rval = ""; } else { rval = FGLUtils.GetString(inputArrayGrid.Rows[row].Cells[col + 1].Value); // Data.Rows[row][col + 1]; } } // inputArrayGrid.getFieldName if (inputArrayGrid.getDataType(col + 1) == "DTYPE_DECIMAL" || inputArrayGrid.getDataType(col + 1) == "DTYPE_MONEY" || inputArrayGrid.getDataType(col + 1) == "DTYPE_FLOAT" || inputArrayGrid.getDataType(col + 1) == "DTYPE_SMFLOAT") { if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator != ".") { // The protocol should always use "." as the separator... string convert_value; try { convert_value = rval.Replace(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator, "."); rval = convert_value; } catch { } } } rowData += " <SV FN=\"" + inputArrayGrid.getFieldName(col) + "\">" + System.Security.SecurityElement.Escape(rval) + "</SV>\n"; } rowData += " </SVS>\n"; rowData += " </ROW>\n"; if (lastRowData[row] != rowData) // We might want to do this every time { // Is it different to last time ? lastRowData[row] = rowData; s += rowData; } } s += "</SYNCROWS>\n"; return(s); }