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; } /// /// 窗体加载 /// /// /// private void ClearForm_Load(object sender, EventArgs e) { bck_Is_Log.Checked = Class1.Config.Is_Log; } /// /// 删除几天前所有的数据 /// /// /// 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); } } /// /// 删除所有的数据 /// /// /// 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; } } }