94 lines
3.2 KiB
C#
94 lines
3.2 KiB
C#
|
using DevExpress.XtraEditors;
|
|||
|
using HL_FristAidPlatform_DTO;
|
|||
|
using HL_FristAidPlatform_Public;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace HL_FristAidPlatform_PreHospitalEmergency
|
|||
|
{
|
|||
|
public partial class Form_PersonnelAdd : XtraForm
|
|||
|
{
|
|||
|
private string guid;
|
|||
|
private string name;
|
|||
|
private int gender;
|
|||
|
private int state;
|
|||
|
private string positionName;
|
|||
|
public Form_PersonnelAdd(string _guid, string _name, int _gender, int _state, string _positionName)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
guid = _guid;
|
|||
|
name = _name;
|
|||
|
gender = _gender;
|
|||
|
state = _state;
|
|||
|
positionName = _positionName;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void btn_Save_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
string Url = string.Empty;
|
|||
|
List<T_Service_FistAid_PersonnelDTO> list = new List<T_Service_FistAid_PersonnelDTO>();
|
|||
|
T_Service_FistAid_PersonnelDTO model = new T_Service_FistAid_PersonnelDTO();
|
|||
|
|
|||
|
Url = "api/service/T_Service_FirstAid_Personnel/Update";
|
|||
|
model.GUID = guid;
|
|||
|
|
|||
|
model.CreationID = Information.User.ID;
|
|||
|
model.Name = textEdit_Name.Text.ToString().Trim();
|
|||
|
model.Gender = radioGroup_Gender.SelectedIndex;
|
|||
|
model.CurrentState = radioGroup_CurrentState.SelectedIndex;
|
|||
|
list.Add(model);
|
|||
|
|
|||
|
//初始化两个工厂
|
|||
|
ClientFactory<T_Service_FistAid_PersonnelDTO> httpClient = new HttpClientFactory<T_Service_FistAid_PersonnelDTO>();
|
|||
|
Client<T_Service_FistAid_PersonnelDTO> client = httpClient.VisitFactory();
|
|||
|
|
|||
|
//访问
|
|||
|
ListEntity<T_Service_FistAid_PersonnelDTO> t = client.Post(Url, list);
|
|||
|
if (t.Success)
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存用户信息成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
DialogResult = DialogResult.OK;
|
|||
|
Close();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
XtraMessageBox.Show("保存失败,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
PublicClass.WriteErrorLog(this.Text, "保存:\r\n" + ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void btn_Exit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
DialogResult = DialogResult.No;
|
|||
|
Close();
|
|||
|
}
|
|||
|
|
|||
|
private void Form_PersonnelAdd_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (gender != -1 && state != -1 && !string.IsNullOrEmpty(name))
|
|||
|
{
|
|||
|
textEdit_Name.Text = name;
|
|||
|
radioGroup_CurrentState.SelectedIndex = state;
|
|||
|
radioGroup_Gender.SelectedIndex = gender;
|
|||
|
lbl_PositionName.Text = positionName;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void Form_PersonnelAdd_FormClosed(object sender, FormClosedEventArgs e)
|
|||
|
{
|
|||
|
this.Dispose();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|