/// <summary> /// Điều chỉnh dữ liệu khi được load vào grid /// </summary> /// <Modified> /// Author Date Comments /// Cuongdb 19/2/2008 Tạo mới /// </Modified> private void grdKetQuaTimKiem_LoadingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e) { int Position = e.Row.Position + 1; Janus.Windows.GridEX.GridEXCell cell = (Janus.Windows.GridEX.GridEXCell)e.Row.Cells[0]; cell.Text = Position.ToString(); }
private void _grilla_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e) { Janus.Windows.GridEX.GridEXRow row = e.Row; if (row.RowType == Janus.Windows.GridEX.RowType.Record) { foreach (ConfiguracionStyleGrilla.ConfiguracionGrillaEstilosCondicionalesDet conf in _configuracionDet) { string key = conf.Columna.Name; string cond = conf.Condicion; Janus.Windows.GridEX.GridEXCell cell1 = row.Cells[key]; Janus.Windows.GridEX.GridEXColumn col2 = (Janus.Windows.GridEX.GridEXColumn)conf.Valor; Janus.Windows.GridEX.GridEXCell cell2 = row.Cells[col2.Key]; object valorCol1 = cell1.Value; object valorCol2 = cell2.Value; bool satisfaceCondicion = false; string type = conf.Columna.Type; switch (cond) { case ">": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D > val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I > val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT > val2DT; break; } break; } case "<": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D < val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I < val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT < val2DT; break; } break; } case "=": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D == val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I == val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT == val2DT; break; case "STRING": string val1S = (string)valorCol1; string val2S = (string)valorCol2; satisfaceCondicion = val1S == val2S; break; case "BOOL": bool val1B = (bool)valorCol1; bool val2B = (bool)valorCol2; satisfaceCondicion = val1B == val2B; break; } break; } case ">=": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D >= val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I >= val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT >= val2DT; break; } break; } case "<=": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D <= val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I <= val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT <= val2DT; break; } break; } case "!=": { switch (type) { case "DECIMAL": decimal val1D = (decimal)valorCol1; decimal val2D = (decimal)valorCol2; satisfaceCondicion = val1D != val2D; break; case "INT": int val1I = (int)valorCol1; int val2I = (int)valorCol2; satisfaceCondicion = val1I != val2I; break; case "DATETIME": DateTime val1DT = (DateTime)valorCol1; DateTime val2DT = (DateTime)valorCol2; satisfaceCondicion = val1DT != val2DT; break; case "STRING": string val1S = (string)valorCol1; string val2S = (string)valorCol2; satisfaceCondicion = val1S != val2S; break; case "BOOL": bool val1B = (bool)valorCol1; bool val2B = (bool)valorCol2; satisfaceCondicion = val1B != val2B; break; } break; } case "like": { switch (type) { case "STRING": string val1D = (string)valorCol1; string val2D = (string)valorCol2; satisfaceCondicion = val1D.IndexOf(val2D) != -1; break; } break; } } if (satisfaceCondicion) { Janus.Windows.GridEX.GridEXFormatStyle fs = conf.Estilo.ToFormatStyle(); row.RowStyle = fs; } } } }