61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
|
using Api.Framework;
|
|||
|
using System;
|
|||
|
using UI.Framework.Forms;
|
|||
|
using Weixin.CircleTools.Entitys;
|
|||
|
using static CircleFriendsTools.Enums;
|
|||
|
|
|||
|
namespace Weixin.CircleTools
|
|||
|
{
|
|||
|
public partial class AddAutoSendForm : BaseForm
|
|||
|
{
|
|||
|
|
|||
|
fl_plugin_circletools_taskinfos taskinfo;
|
|||
|
|
|||
|
public AddAutoSendForm(fl_plugin_circletools_taskinfos taskinfo)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.taskinfo = taskinfo;
|
|||
|
}
|
|||
|
|
|||
|
private void AddAutoSendForm_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
foreach (WorkingDayType item in Enum.GetValues(typeof(WorkingDayType)))
|
|||
|
{
|
|||
|
checkedComboBoxEdit1.Properties.Items.Add(item.ToString());
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (string.IsNullOrWhiteSpace(textEdit1.Text)) throw new Exception("请填写任务名称!");
|
|||
|
else if (string.IsNullOrWhiteSpace(checkedComboBoxEdit1.Text)) throw new Exception("请勾选工作日!");
|
|||
|
else if (string.IsNullOrWhiteSpace(dateTimePicker1.Text)) throw new Exception("请设置发送时间点!");
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
if (taskinfo != null)
|
|||
|
{
|
|||
|
taskinfo.task_name = textEdit1.Text.Trim();
|
|||
|
taskinfo.task_working_day = checkedComboBoxEdit1.Text.Trim();
|
|||
|
taskinfo.task_time = dateTimePicker1.Value.ToString("HH:mm");
|
|||
|
taskinfo.is_circulate = checkEdit1.Checked ? ChooseType.是 : ChooseType.否;
|
|||
|
|
|||
|
session.Saveable(taskinfo).ExecuteCommand();
|
|||
|
ShowSuccess("添加成功!");
|
|||
|
}
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError("添加失败:错误" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|