using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using Newtonsoft.Json; 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 HL_FristAidPlatform_Base { public partial class Form_TriageGoingInfo : XtraForm { public int id; public string name; public long systemId; public string guid; public Form_TriageGoingInfo(int _id,string _name,long _systemId, string _guid) { InitializeComponent(); id = _id; name = _name; systemId = _systemId; guid = _guid; } private void Form_InpatientDepartmentInfo_Load(object sender, EventArgs e) { DataTable ResultDT = DBHelpClass.Get("/api/admin/T_SYS_SystemModule/GetIsHaveTimeAxisList?isHaveTimeAxis=0"); PublicClass.SetLookUpList(ref lookUpEdit1, ResultDT, 0, 2, false); if (!string.IsNullOrEmpty(name)) textEdit1.Text = name; if (systemId > 0) lookUpEdit1.EditValue = systemId.ToString(); } private void btn_Cancel_Click(object sender, EventArgs e) { this.Close(); } private void btn_Save_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(textEdit1.Text)) { XtraMessageBox.Show("科室名称不能为空"); return; } if (lookUpEdit1.Text == "") { XtraMessageBox.Show("科室所属系统不能为空"); return; } string Url = ""; T_Base_TriageGoDTO dto = new T_Base_TriageGoDTO(); List list = new List(); dto.Name = textEdit1.Text.Trim(); dto.SystemModuleID = lookUpEdit1.EditValue.ToString() == "" ? 0 : long.Parse(lookUpEdit1.EditValue.ToString()); if (id == 0) { Url = "api/base/T_Base_DiagnosisAndTriageGo/SaveTriageGo"; } if (id > 0) { dto.ID = id; dto.GUID = guid; Url = "api/base/T_Base_DiagnosisAndTriageGo/UpdateTriageGo"; } list.Add(dto); //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); //访问 ListEntity t = client.Post(Url, list); if (t.Success) { if (!string.IsNullOrEmpty(t.DataString)) { if (t.DataString.Contains("Success")) { JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString); string msg = jo["Msg"].ToString(); if (!string.IsNullOrEmpty(msg)) { XtraMessageBox.Show(msg); } } else { string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", ""); XtraMessageBox.Show(msg1); } } else { XtraMessageBox.Show("保存失败"); } Form_TriageGoing department; department = (Form_TriageGoing)this.Owner; department.GetList(); this.Close(); } else { XtraMessageBox.Show("保存失败"); Form_TriageGoing department; department = (Form_TriageGoing)this.Owner; department.GetList(); this.Close(); } } catch (Exception) { throw; } } } }