|
- using BPA.Helper;
- 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 InstitutionalEntry : Form
- {
- public InstitutionalEntry()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- string name = textBox1.Text.Trim();
- if (string.IsNullOrEmpty(name))
- {
- label2.Text = "机构名不能为空";
- return;
- }
- Task.Factory.StartNew(() =>
- {
- if (ServiceHandler.GetOrgList().FirstOrDefault(p => p.Name == name) != null)
- {
- this.Invoke(() => { label2.Text = "机构已存在"; });
- return;
- }
- if (ServiceHandler.AddOrg(textBox1.Text.Trim()))
- {
- this.Invoke(() => { this.Close(); });
- }
- else
- {
- this.Invoke(() => { label2.Text = "添加失败,请重试,请检查机构是否存在"; });
- }
- });
-
- }
- }
- }
|