StableVersion4.3/HL_FristAidPlatform_Apoplexy/Form_PatientTimeAxisUpdate.cs

113 lines
3.8 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_Apoplexy
{
public partial class Form_PatientTimeAxisUpdate : XtraForm
{
string patientGUID = "";
string timeValue = "";
int timeNumber = 0;
public Form_PatientTimeAxisUpdate(string _patientGUID="",string _timeValue="", string _timeNumber="")
{
InitializeComponent();
patientGUID = _patientGUID;
timeValue = _timeValue;
timeNumber = int.Parse(_timeNumber);
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
UpdatePatientTimeAixs();
}
catch (Exception ex)
{
throw;
}
}
private void Form_PatientTimeAxisUpdate_Load(object sender, EventArgs e)
{
timeControl1.TimeValue = timeValue + "";
}
public void UpdatePatientTimeAixs()
{
try
{
UpdateApoplexyTimesDTO updateApoplexyTime = new UpdateApoplexyTimesDTO();
updateApoplexyTime.PatientGuid = patientGUID;
updateApoplexyTime.TimeValue = timeControl1.TimeValue + "";
updateApoplexyTime.TimeNumber = timeNumber;
List<UpdateApoplexyTimesDTO> updateApoplexyTimes = new List<UpdateApoplexyTimesDTO>();
string Url = string.Format("api/service/T_Service_Apoplexy_PatientsTimeAxis/UpdateApoplexyPatientTimeAixs");
ClientFactory<UpdateApoplexyTimesDTO> httpClient = new HttpClientFactory<UpdateApoplexyTimesDTO>();
Client<UpdateApoplexyTimesDTO> client = httpClient.VisitFactory();
updateApoplexyTimes.Add(updateApoplexyTime);
//访问
ListEntity<UpdateApoplexyTimesDTO> t = client.Post(Url, updateApoplexyTimes);
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);
Form_PatientTimeAxis patientTimeAxis;
patientTimeAxis = (Form_PatientTimeAxis)this.Owner;
patientTimeAxis.GetPatientTimeAxis();
this.Close();
}
}
else
{
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
XtraMessageBox.Show(msg1);
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
else
{
XtraMessageBox.Show("保存失败");
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存基本信息:\r\n" + ex);
}
}
}
}