using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; namespace HL_FristAidPlatform_Base { public partial class Form_PhoneBook : XtraForm { public string name; public string telephone; public Form_PhoneBook(string _name, string _telephone) { InitializeComponent(); name = _name; telephone = _telephone; } private void Form_PhoneBook_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(name)) txt_OfficeName.Text = name; if (!string.IsNullOrEmpty(telephone)) txt_TelephoneNumber.Text = telephone; } private void simpleButton1_Click(object sender, EventArgs e) { try { HospitalPhoneBookDTO dto = new HospitalPhoneBookDTO(); List list = new List(); dto.CreatorID = Information.User.ID; dto.HospitalGUID = Information.Hospital.GUID; dto.OfficeName = txt_OfficeName.Text.Trim(); dto.TelephoneNumber = txt_TelephoneNumber.Text.Trim(); list.Add(dto); string Url = string.Empty; Url = "api/base/T_Base_HospitalPhoneBook/SavePhoneBook"; //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); //访问 ListEntity t = client.Post(Url, list); JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString); string msg = jo["Msg"].ToString(); if (!string.IsNullOrEmpty(msg)) { this.Close(); XtraMessageBox.Show(msg); Form_HospitalPhoneBook book; book = (Form_HospitalPhoneBook)Owner; book.BindDate(); } } catch (Exception ex) { PublicClass.WriteErrorLog(ex.Message); } } private void pictureBox1_Click(object sender, EventArgs e) { this.Close(); } } }