using HKLib.Dto; using HKLib.Interfaces; using HKLib.Logic; 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 HKCardManager { public partial class PersonnelEntry : Form { List OrgList = new List(); public PersonnelEntry() { InitializeComponent(); comboBox1.SelectedIndex = 0; ServiceHandler.GetOrgList()?.ForEach(item => { OrgList.Add(item.Name); }); comboBox2.DataSource = OrgList; } private void button1_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text.Trim())) { label5.Text = "请输入姓名"; return; } if (!textBox2.Text.Trim().IsMobile()) { label5.Text = "手机号格式不正确"; return; } UserDto userDto = new UserDto() { Name = textBox1.Text.Trim(), //Org = comboBox2.SelectedText, Phone = textBox2.Text.Trim(), }; Task.Factory.StartNew(() => { HKLibHelper.AddUser(userDto); }); } private void textBox2_TextChanged(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void label1_Click(object sender, EventArgs e) { } } }