using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.BandedGrid; using System.IO; namespace Uninpho.Tools.components { public partial class LoggingForm : DevExpress.XtraEditors.XtraForm { private string path; private bool isxxxw = false; //private BandedGridView BV; private List data; private List slclist = new List(); public LoggingForm(string path) { InitializeComponent(); this.path = path; } public LoggingForm(string path,bool isxxxw, List data) { InitializeComponent(); this.path = path; this.isxxxw = true; this.data = data; } private void LoggingForm_Load(object sender, EventArgs e) { if (File.Exists(path)) { StreamReader sr = new StreamReader(path); while (!sr.EndOfStream) { StaticLogClass slc = new StaticLogClass(); string[] ss = sr.ReadLine().Split('\t'); string[] rowclo = ss[2].Split('_'); slc.Date = ss[0]; slc.Username = ss[1]; slc.Oldvalue = ss[3]; slc.Newvalue = ss[4]; if (isxxxw) { for (int i = 0; i < data.Count; i++) { if (data[i].Id == rowclo[0]) { slc.Row = (i + 1).ToString(); break; } } slc.Column = rowclo[1]; } else { slc.Row = (int.Parse(rowclo[0]) + 1).ToString(); slc.Column = GetColumnChar(int.Parse(rowclo[1].Trim())); } slclist.Add(slc); } List datascource = slclist.OrderByDescending(o => Convert.ToDateTime(o.Date)).ToList(); gridControl1.DataSource = datascource; } } private static string GetColumnChar(int col) { var a = col / 26; var b = col % 26; if (a > 0) return GetColumnChar(a - 1) + (char)(b + 65); return ((char)(b + 65)).ToString(); } private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) { DataAnalysis.DACommon.addXuHao(e); } } }