SuperDesign/Source/开发辅助工具/Tools/FrmHistoryUrls.cs
zilinsoft 993f1ca1a9 ### 2024-12-20 星期五更新
------
#### SuperDesign    V3.0.2412.2001
- *.[新增]新增程序更新日志设置和自动发布功能。
- *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
2024-12-20 08:15:19 +08:00

78 lines
2.8 KiB
C#

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;
}
}
}