12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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<DBOperation.Model.T_xxxw_csvdata> data;
- private List<StaticLogClass> slclist = new List<StaticLogClass>();
- public LoggingForm(string path)
- {
- InitializeComponent();
- this.path = path;
- }
- public LoggingForm(string path,bool isxxxw, List<DBOperation.Model.T_xxxw_csvdata> 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<StaticLogClass> 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);
- }
- }
- }
|