using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using UI.Framework.Forms; using Api.Framework; using Api.Framework.Tools; using Api.Framework.Model; using SqlSugar; namespace FLSystem.Forms { public partial class tlj_form : BaseForm { private string cpsnick; private string cpsname; public tlj_form(string cpsnick, string cpsname) { InitializeComponent(); this.labelControl5.Text = this.cpsnick = cpsnick; this.labelControl7.Text = this.cpsname = cpsname; } private void tlj_form_Load(object sender, EventArgs e) { GetTlj(); if (tlj != null) { textEdit1.Text = tlj.appkey; textEdit2.Text = tlj.appsecret; textEdit3.Text = tlj.adzone_name; textEdit4.Text = tlj.adzone_pid; } } private fl_alimama_tlj_info tlj = null; private SqlSugarClient session = null; private void GetTlj() { session = ApiClient.GetSession(); var tljs = session.FindTljInfos(true); tlj = tljs.FirstOrDefault(f => f.username == cpsname); return; } private void simpleButton1_Click(object sender, EventArgs e) { try { if (tlj == null) tlj = new fl_alimama_tlj_info() { username = cpsname }; tlj.appkey = textEdit1.Text.Trim(); tlj.appsecret = textEdit2.Text.Trim(); tlj.adzone_name = textEdit3.Text.Trim(); tlj.adzone_pid = textEdit4.Text.Trim(); session.Saveable(tlj).ExecuteCommand(); ShowSuccessAutoClose($"操作成功"); this.Close(); } catch (Exception ex) { ShowErrorAutoClose($"操作失败:{ex.Message}"); } } private void simpleButton2_Click(object sender, EventArgs e) { this.Close(); } } }