using Api.Framework; using Api.Framework.Enums; using Api.Framework.Model; using Api.Framework.Tools; using DevExpress.XtraEditors; using SqlSugar; using System; using System.Linq; using System.Threading; using System.Windows.Forms; using UI.Framework.Forms; namespace FLSystem.Forms { public partial class change_point_form : BaseForm { private long uid; private fl_member_info member = null; private SqlSugarClient session = null; public change_point_form(long uid) { InitializeComponent(); session = ApiClient.GetSession(); this.uid = uid; hyperlinkLabelControl1_Click(null, null); } private void button1_Click(object sender, EventArgs e) { try { if (member != null) { if (numericUpDown1.Value == 0m) throw new Exception("积分值不能为0"); member = session.ChangePoint(PointType.人为修改, (double)numericUpDown1.Value, member.id, string.IsNullOrWhiteSpace(textBox1.Text) ? $"手动修改积分:{numericUpDown1.Value} 积分" : textBox1.Text.Trim()); #region 通知用户积分变动 if (!string.IsNullOrWhiteSpace(memoEdit1.Text)) { var robot = session.FindRobots().FirstOrDefault(f => f.type == member.robot_type && f.name == member.robot_name); if (robot != null) ApiClient.SendMessage(robot, member.username, new VariateReplace().CommonReplace(memoEdit1.Text.Replace("[修改金额]", numericUpDown1.Value.ToString("0.00")), member)); } #endregion ShowSuccess("修改成功"); label1.Text = member.cur_point.ToString(); } } catch (Exception ex) { ShowError(ex); } } private void button2_Click(object sender, EventArgs e) { this.Close(); } /// /// 刷新 /// /// /// private void hyperlinkLabelControl1_Click(object sender, EventArgs e) { try { hyperlinkLabelControl1.Enabled = false; if (uid != 0) { member = session.FindMemberInfoById(uid); if (member != null) { label1.Text = member.cur_point.ToString(); Thread.Sleep(1000); } } } catch (Exception ex) { ShowError(ex); } finally { hyperlinkLabelControl1.Enabled = true; } } private void hyperlinkLabelControl_Click(object sender, EventArgs e) { if (sender is HyperlinkLabelControl) { var label = sender as HyperlinkLabelControl; memoEdit1.Text += label.Text; } } } }