StableVersion4.3/HL_FristAidPlatform_Base/Form_HospitalPhoneBook.cs

122 lines
4.0 KiB
C#
Raw Normal View History

2024-03-11 09:47:34 +08:00
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<HospitalPhoneBook> lst = DBHelpClass.GetList<HospitalPhoneBook>(string.Format("api/base/T_Base_HospitalPhoneBook/GetHospitalGUID?hospitalGuid={0}", Information.Hospital.GUID));
gridControl1.DataSource = lst;
}
public class HospitalPhoneBook
{
/// <summary>
///
/// </summary>
public long ID { get; set; }
/// <summary>
///
/// </summary>
public string OfficeName { get; set; }
/// <summary>
///
/// </summary>
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<HospitalPhoneBookDTO> list = new List<HospitalPhoneBookDTO>();
dto.ID = id;
dto.HospitalGUID = Information.Hospital.GUID;
list.Add(dto);
string Url = string.Empty;
Url = "api/base/T_Base_HospitalPhoneBook/LogicalDelete";
//初始化两个工厂
ClientFactory<HospitalPhoneBookDTO> httpClient = new HttpClientFactory<HospitalPhoneBookDTO>();
Client<HospitalPhoneBookDTO> client = httpClient.VisitFactory();
//访问
ListEntity<HospitalPhoneBookDTO> 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;
}
}
}
}