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_HospitalPhoneBook : XtraForm { public Form_HospitalPhoneBook() { InitializeComponent(); } private void Form_HospitalPhoneBook_Load(object sender, EventArgs e) { BindDate(); } public void BindDate() { List lst = DBHelpClass.GetList(string.Format("api/base/T_Base_HospitalPhoneBook/GetHospitalGUID?hospitalGuid={0}", Information.Hospital.GUID)); gridControl1.DataSource = lst; } public class HospitalPhoneBook { /// /// /// public long ID { get; set; } /// /// /// public string OfficeName { get; set; } /// /// /// public string TelephoneNumber { get; set; } } private void barLargeButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (tileView1.DataRowCount > 0) { int selectRow = tileView1.GetSelectedRows()[0]; string name = tileView1.GetRowCellValue(selectRow, "OfficeName").ToString(); string telephone = tileView1.GetRowCellValue(selectRow, "TelephoneNumber").ToString(); Form_PhoneBook book = new Form_PhoneBook(name, telephone); book.Owner = this; book.Show(); } } private void barLargeButtonItem7_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Form_PhoneBook book = new Form_PhoneBook("", ""); book.Owner = this; book.ShowDialog(); } private void barLargeButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (tileView1.DataRowCount > 0) { int selectRow = tileView1.GetSelectedRows()[0]; int id = int.Parse(tileView1.GetRowCellValue(selectRow, "ID").ToString()); if (id <= 0) { XtraMessageBox.Show("找不到该数据的唯一标识"); return; } HospitalPhoneBookDTO dto = new HospitalPhoneBookDTO(); List list = new List(); dto.ID = id; dto.HospitalGUID = Information.Hospital.GUID; list.Add(dto); string Url = string.Empty; Url = "api/base/T_Base_HospitalPhoneBook/LogicalDelete"; //初始化两个工厂 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)) { XtraMessageBox.Show(msg); BindDate(); } } } catch (Exception) { throw; } } } }