72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using AutoAnswer.Properties;
|
|||
|
using System;
|
|||
|
using System.Windows.Forms;
|
|||
|
using UI.Framework.Forms;
|
|||
|
|
|||
|
namespace AutoAnswer
|
|||
|
{
|
|||
|
public partial class ClearForm : BaseForm
|
|||
|
{
|
|||
|
public ClearForm()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.Text = Resources.ClearLogFormTile;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 窗体加载
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void ClearForm_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
bck_Is_Log.Checked = Class1.Config.Is_Log;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除几天前所有的数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void linkLabel_clear_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.ExcuteSQL("DELETE FROM 'fl_plugin_autoanswer__log' where datetime <= '" + DateTime.Parse(DateTime.Now.AddDays(-double.Parse(numericUpDown_Day1.Value.ToString())).ToString("yyyy-MM-dd HH:mm:ss")) + "';");
|
|||
|
ShowSuccess("删除成功");
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除所有的数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void linkLabel_allclear_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.ExcuteSQL("DELETE FROM 'fl_plugin_autoanswer__log';DELETE FROM sqlite_sequence WHERE name = 'fl_plugin_autoanswer__log';");
|
|||
|
ShowSuccess("删除成功");
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ClearForm_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
{
|
|||
|
Class1.Config.Is_Log = bck_Is_Log.Checked;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|