old_flsystem/FLSystem/Forms/add_authorization.cs

55 lines
1.8 KiB
C#
Raw Normal View History

2022-09-20 03:10:29 +00:00
using Api.Framework;
using Api.Framework.Model;
using Grant.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FLSystem.Forms
{
public partial class add_authorization : Form
{
private fl_robot_info fl_robot_info;
public add_authorization(fl_robot_info fl_robot_info)
{
InitializeComponent();
this.fl_robot_info = fl_robot_info;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
var webResult = GrantClient.Get().SendPack("addTime", new { cName = fl_robot_info.uin, cardid = this.textBox1.Text });
MessageBox.Show(webResult.message.ToString(), "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
var softId = (fl_robot_info.type == Api.Framework.SDK.ChatType.QQ) ? 1002 : 1001;
var custm = GrantClient.Get().Refresh(fl_robot_info.uin.ToString(), softId);
if (custm != null)
{
fl_robot_info.end_time = custm.endTime;
ApiClient.GetSession().SaveOrUpdate(fl_robot_info);
}
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void add_authorization_Load_1(object sender, EventArgs e)
{
this.label3.Text = fl_robot_info.name;
this.label5.Text = fl_robot_info.nick;
this.label6.Text = fl_robot_info.uin;
}
}
}