using Newtonsoft.Json.Linq;
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 PTMedicalInsurance.Business.Core.Forms.DischargeAudit
{
    public partial class FeeDetail : Form
    {
        private Form mainForm;
        private PTMedicalInsurance.Business.Core.Forms.DischargeAudit.GridViewSetter grdSetter = new GridViewSetter();
        // 定义一个公共事件
        public event EventHandler GetFeeClicked;
        public event EventHandler UploadFeeClicked;

        public JArray jaFeeDetail
        {
            get { return _jaFeeDetail; }
            set {
                _jaFeeDetail = value;
                dgvFeeDetail.DataSource = _jaFeeDetail;
            }

        }

        private JArray _jaFeeDetail;
        public FeeDetail()
        {
            InitializeComponent();
        }

        public FeeDetail(Form frm)
        {
            InitializeComponent();
            InitForm(frm);
        }
        private void InitForm(Form frm)
        {

            mainForm = frm;
            CheckForIllegalCrossThreadCalls = false;
            // 禁用关闭按钮
            this.FormBorderStyle = FormBorderStyle.None;

            // 隐藏标题栏
            this.ControlBox = false;

            // 其他可能需要的配置
            if (mainForm != this)
            {
                this.TopLevel = false;
                this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
            }
            else
            {
                this.WindowState = FormWindowState.Maximized;
            }

            grdSetter.setFeeDetailFormHeader(dgvFeeDetail);
        }

        private void btGetFee_Click(object sender, EventArgs e)
        {
            GetFeeClicked?.Invoke(this, e);
        }

        private void btUploadFee_Click(object sender, EventArgs e)
        {
            UploadFeeClicked?.Invoke(this, e);
        }
    }
}
