public static void mult(DataRow row, string col, object val1, object val2, object coif) { if (!(ToolCell.isNull(val1) || ToolCell.isNull(val2) || ToolCell.isNull(coif))) { ToolCell.set(row, col, (double)val1 * (double)val2 * (double)coif); } }
private void distribute(DataRow dataRow) { DateTime datetime = (DateTime)ToolCell.isNull(dataRow[columns[0]], DateTime.Now); for (int i = 1; i < columns.Length; ++i) { object part = dateTimePart(datetime, parts[i]); ToolCell.set(dataRow, columns[i], part); } }
public static object getColumnLastValue(DataTable table, string col, object def) { for (int i = table.Rows.Count - 1; i >= 0; --i) { if (table.Rows[i].RowState != DataRowState.Deleted) { return(ToolCell.isNull(table.Rows[i][col], def)); } } return(def); }
public static DataRow initTableNewRowIfNull(DataRow row, string[] cols) { DataTable table = row.Table; for (int i = 0; i < cols.Length; ++i) { if (ToolCell.isNull(row[table.Columns[i]])) { ToolCell.set(row, cols[i], ToolCell.getCellTypeDefaulValue(table.Columns[cols[i]].DataType)); } } return(row); }
public static DataRow initTableNewRowIfNull(DataRow row) { DataTable table = row.Table; for (int i = 0; i < table.Columns.Count; ++i) { if (ToolCell.isNull(row[table.Columns[i]])) { ToolCell.set(row, i, ToolCell.getCellTypeDefaulValue(table.Columns[i].DataType)); } } return(row); }
public long getCellTouch(DataRow row, string col) { long last = untouched; if (row != null && col != null) { if (accessList.ContainsKey(row)) { last = (long)ToolCell.isNull(accessList[row][col], (long)untouched); } } return(last); }
private void compile(DataRow dataRow) { DateTime datetime = (DateTime)ToolCell.isNull(dataRow[columns[0]], DateTime.Now); for (int i = 1; i < columns.Length; ++i) { if (!ToolCell.isNull(dataRow[columns[i]])) { datetime = setDateTimePatr(datetime, parts[i], dataRow[columns[i]]); } } ToolCell.set(dataRow, columns[0], datetime); }
public static void trimColumn(DataTable table, string col) { if ((table != null) && (table.Columns[col].DataType == typeof(string))) { for (int i = 0; i < table.Rows.Count; ++i) { if (!ToolRow.isDeleted(table.Rows[i])) { table.Rows[i][col] = ((string)ToolCell.isNull(table.Rows[i][col], string.Empty)).Trim(); } } } }
public static void div(DataRow row, string col, object val1, object val2, object coif) { if (!(ToolCell.isNull(val1) || ToolCell.isNull(val2) || ToolCell.isNull(coif))) { if (Math.Abs((double)val2 * (double)coif) > (double)Common.Const.ConstValues.minPositive) { ToolCell.set(row, col, (double)val1 / ((double)val2 * (double)coif)); } else { ToolCell.set(row, col, 0.0); } } }
public static double sumExp(DataRow[] rows, string exp) { double res = 0; if ((rows != null) && (rows.Length > 0)) { ImplRowEvaluator eval = new ImplRowEvaluator(rows[0].Table); eval.addExpression(exp, typeof(double)); for (int i = 0; i < rows.Length; ++i) { eval.setVar(rows[i]); res += (double)ToolCell.isNull(eval.getResult(), 0.0); } } return(res); }
public static double getSumDouble(DataTable table, string col) { double res = 0; if (table != null) { for (int i = 0; i < table.Rows.Count; ++i) { if (!ToolRow.isDeleted(table.Rows[i])) { res += (double)ToolCell.isNull(table.Rows[i][col], 0.0); } } } return(res); }
public static double getSumDouble(DataRow[] rows, string col) { double res = 0; if (rows != null) { for (int i = 0; i < rows.Length; ++i) { if (!ToolRow.isDeleted(rows[i])) { res += (double)ToolCell.isNull(rows[i][col], 0.0); } } } return(res); }