using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace LQKJ.XiBU.ReportPlugIN
{
    [HotUpdate,Description("表单插件")]
  public  class BiaodanPlugIn: AbstractBillPlugIn
    {
        public override void BarItemClick(BarItemClickEventArgs e)
        {
            base.BarItemClick(e);
            if (e.BarItemKey.Equals("LQKJ_Relieve"))
            {
                this.View.ShowMessage("是否确认解绑微信？", MessageBoxOptions.OKCancel, new Action<MessageBoxResult>(result =>
                {
                    if (result == MessageBoxResult.OK)
                    {
                        var Id = this.View.Model.GetPKValue().ToString();
                        string uptSql = $"update T_PX_StudentsInfo set FOPENID='' where FSTUDENTID={Id}";
                        var results = DBServiceHelper.Execute(this.Context, uptSql);
                        if (results > 0)
                        {
                            this.View.ShowMessage("解绑成功！");
                            //this.View.UpdateView();
                            this.View.Refresh();
                        }
                    }
                }));
                                                                 
            }
        }
    }
}
