using ryCommon; using ryCommonDb; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Security.Policy; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using 开发辅助工具.Manager; namespace SuperDesign.Tools { public partial class FrmHistoryUrls : Form { public FrmHistoryUrls() { InitializeComponent(); OlvPostData.AspectGetter = delegate (object x) { return ((HistoryUrl)x).PostData; }; OlvEditTime.AspectGetter = delegate (object x) { return ((HistoryUrl)x).EditTimeStr; }; OlvClickCount.AspectGetter = delegate (object x) { return ((HistoryUrl)x).ClickCount; }; OlvClickCount.AspectToStringConverter = delegate (object row, object x) { return ((HistoryUrl)row).ClickCount+"次"; }; } class HistoryUrl { public int Id { get; set; } = 0; public string PostData { get; set; } = ""; public string EditTimeStr { get; set; } = ""; public int ClickCount { get; set; } = 0; } public void LoadDb(string Url) { List<HistoryUrl> list = new List<HistoryUrl>(); IDbInterface db2 = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType); if (db2.ConnDb(Itrycn_Db.History_SQLConn) == 1) { RyQuickSQL mySQL =new RyQuickSQL("HistoryUrl"); mySQL.AddField("Url", Url); DataSet ds_his = db2.ReadData("select * from HistoryUrl where Url=@Url order by EditTime desc", mySQL); if (ds_his.HaveData()) { for (int i = 0; i < ds_his.RowCount(); i++) { var row = ds_his.Tables[0].Rows[i]; list.Add(new HistoryUrl() { Id = row["Id"].ToInt(), EditTimeStr = row["editTime"].ToInt64().ToDateTime().ToString(), PostData = row["Postdata"].ToString(), ClickCount = row["ClickCount"].ToInt(), }) ; } } ds_his?.Dispose(); } db2.Free(); objectListView2.AddObjects(list); } private void FrmHistoryUrls_Load(object sender, EventArgs e) { } public int SelectedId { get; set; } = 0; private void objectListView2_MouseDoubleClick(object sender, MouseEventArgs e) { var row = (HistoryUrl)objectListView2.SelectedObject; if (row == null) { return; } SelectedId = row.Id; DialogResult = DialogResult.OK; } } }