using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; 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 HL_FristAidPlatform_Trauma { public partial class Form_EpidemicNotification : XtraForm { private string _patientGuid; private int _flag; public Form_EpidemicNotification(string patientGuid, int flag) { InitializeComponent(); _patientGuid = patientGuid; _flag = flag; } private void Form_EpidemicNotification_Load(object sender, EventArgs e) { if (_flag == 1) { string Url = string.Format("api/service/T_Service_EpidemicNotification/Get?patientGuid={0}", _patientGuid); DataTable dt = DBHelpClass.GetDataRow(Url); if (dt != null) { if (dt.Rows.Count > 0) { radioGroup_Question_1.SelectedIndex = int.Parse(dt.Rows[0]["Question_1"].ToString()); radioGroup_Question_2.SelectedIndex = int.Parse(dt.Rows[0]["Question_2"].ToString()); radioGroup_Question_3.SelectedIndex = int.Parse(dt.Rows[0]["Question_3"].ToString()); radioGroup_Question_4.SelectedIndex = int.Parse(dt.Rows[0]["Question_4"].ToString()); radioGroup_Question_5.SelectedIndex = int.Parse(dt.Rows[0]["Question_5"].ToString()); radioGroup_Question_6.SelectedIndex = int.Parse(dt.Rows[0]["Question_6"].ToString()); textEdit_SignatureDoctor.Text = dt.Rows[0]["SignatureDoctor"].ToString(); textEdit_PatientSignature.Text = dt.Rows[0]["PatientSignature"].ToString(); comboBox_Relationship.Text = dt.Rows[0]["Relationship"].ToString(); timeControl_Date.TimeValue = dt.Rows[0]["SignatureDate"].ToString(); } } } else { simpleButton_Save.Visible = true; } } private void simpleButton_Save_Click(object sender, EventArgs e) { try { List listNotification = new List(); T_Service_EpidemicNotificationDTO notification = new T_Service_EpidemicNotificationDTO(); notification.PatientGUID = _patientGuid; notification.GUID = Guid.NewGuid().ToString(); notification.Question_1 = radioGroup_Question_1.SelectedIndex; notification.Question_2 = radioGroup_Question_2.SelectedIndex; notification.Question_3 = radioGroup_Question_3.SelectedIndex; notification.Question_4 = radioGroup_Question_4.SelectedIndex; notification.Question_5 = radioGroup_Question_5.SelectedIndex; notification.Question_6 = radioGroup_Question_6.SelectedIndex; notification.SignatureDoctor = textEdit_SignatureDoctor.EditValue.ToString(); notification.SignatureDate = timeControl_Date.TimeValue; notification.Relationship = comboBox_Relationship.EditValue.ToString(); notification.PatientSignature = textEdit_PatientSignature.EditValue.ToString(); listNotification.Add(notification); //初始化两个工厂 ClientFactory httpClientAmbulance = new HttpClientFactory(); Client clientAmbulance = httpClientAmbulance.VisitFactory(); //访问 if (clientAmbulance.Post("api/service/T_Service_EpidemicNotification/", listNotification).Success) { XtraMessageBox.Show("保存信息成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Form_PatientFristAidInfo info; info = (Form_PatientFristAidInfo)this.Owner; info.Notice(_patientGuid); this.Close(); } else { XtraMessageBox.Show("保存失败,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "保存信息:\r\n" + ex); } } } }