using Newtonsoft.Json.Linq; using PTMedicalInsurance.Business; using PTMedicalInsurance.Forms.BasicDatas.services; using PTMedicalInsurance.Helper; 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 GuiYangBaseMI.Forms.BasicDatas { public partial class DataDownloadLocalExtension : Form { private Form mainForm; private DirectoryDownloadLocalExtService service = new DirectoryDownloadLocalExtService(); private DownloadType downloadType; private string errMsg; CenterBusiness cBus = new CenterBusiness(); HisMainBusiness hBus = new HisMainBusiness(); HisIrisServices hIS = new HisIrisServices(); MIIrisServices mIS = new MIIrisServices(); InvokeHelper invoker = new InvokeHelper(); public DataDownloadLocalExtension() { InitializeComponent(); } public DataDownloadLocalExtension(Form frm) { InitializeComponent(); InitForm(frm); } /// /// 初始化界面 /// /// private void InitForm(Form frm) { mainForm = frm; CheckForIllegalCrossThreadCalls = false; // 禁用关闭按钮 this.FormBorderStyle = FormBorderStyle.None; // 隐藏标题栏 this.ControlBox = false; // 其他可能需要的配置 this.TopLevel = false; this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性 //默认药品,手工输入 rbDirectory.Checked = rbSpecialVer.Checked = true; } /// /// 设置枚举值 /// /// /// private void DownloadTypeCheckedChanged(object sender, EventArgs e) { if (rbDirectory.Checked) downloadType = DownloadType.Directory; else if (rbLimitPrice.Checked) downloadType = DownloadType.LimitPrice; else if (rbSelfRaito.Checked) downloadType = DownloadType.SelfRatio; else downloadType = DownloadType.None; } /// /// 获取最大版本号 /// /// private string GetMaxVer() { JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(-1); string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString(); tbVersionNO.Text = ver; return ver; } /// /// 下载封装 /// /// private void Download(out string err) { err = ""; if (rbSpecialVer.Checked) { service.SignleDownload(tbVersionNO.Text, downloadType, this); } if (rbFromSpecialVer.Checked) { service.LoopDownload(tbVersionNO.Text, downloadType, this); } if (rbAutoQueryMaxVer.Checked) { service.LoopDownload(GetMaxVer(), downloadType, this); } } private void btExit_Click(object sender, EventArgs e) { mainForm.Close(); } private void btDownload_Click(object sender, EventArgs e) { Download(out errMsg); } } }