| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- 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);
- }
- /// <summary>
- /// 初始化界面
- /// </summary>
- /// <param name="frm"></param>
- 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;
- }
- /// <summary>
- /// 设置枚举值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- /// <summary>
- /// 获取最大版本号
- /// </summary>
- /// <returns></returns>
- private string GetMaxVer()
- {
- JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(-1);
- string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
- tbVersionNO.Text = ver;
- return ver;
- }
- /// <summary>
- /// 下载封装
- /// </summary>
- /// <param name="err"></param>
- 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);
- }
- }
-
- }
|