Exemplo n.º 1
0
        public bool addChangedCell(DataGridCell cell)
        {
            CellConverter cellConverter = new CellConverter();

            if (cellConverter.verifyCellDataType(ref cell))
            {
                changedCellsDict.Add(changeNumber, cell);
                changeNumber++;
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        private string generateUpdateQuery(string dbName, DataGridCell cell)
        {
            int           columnIndex          = cell.getCellIndex(cellIndexTypes.columnIndex);
            CellConverter cellConverter        = new CellConverter();
            string        columnName           = queryData.getHeaders()[columnIndex];
            string        primaryKeyColumnName = queryData.getHeaders()[0]; //kluczem głównym MUSI być pierwsza kolumna
            object        primaryKey           = dg1Handler.getCellPrimaryKey(cell);
            string        newValue             = cellConverter.getConvertedValue(ref cell);

            if (newValue == null)
            {
                return("update " + dbName + " set " + columnName + "= null" + " where " + primaryKeyColumnName + "='" + primaryKey.ToString() + "'");
            }
            return("update " + dbName + " set " + columnName + "=" + cellConverter.getConvertedValue(ref cell) + " where " + primaryKeyColumnName + "='" + primaryKey.ToString() + "'");;
        }