using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using UI.Framework.Forms; using static Grant.Framework.AuthorizationManage; namespace Grant.Framework { public partial class CreateCardForm : BaseForm { List<_SoftWare> software_list = null; public int type = 0; public string number = string.Empty; public int sid = 0; public string remark = string.Empty; public string username = string.Empty; public CreateCardForm(string username, List<_SoftWare> _software_list) { InitializeComponent(); this.software_list = _software_list; textEdit1.Text = username; } private void button2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.No; } private void button1_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(textEdit1.Text)) throw new Exception("请填写的用户账号"); username = textEdit1.Text.Trim(); number = numericUpDown1.Value.ToString(); sid = (this.comboBox2.SelectedItem as _SoftWare).id; type = comboBox1.SelectedIndex + 1; remark = memoEdit1.Text; this.DialogResult = DialogResult.OK; } catch (Exception ex) { ShowError(ex); } } private void CreateCardForm_Load(object sender, EventArgs e) { comboBox2.DataSource = software_list; comboBox2.DisplayMember = "softwarename"; comboBox2.ValueMember = "id"; comboBox1.SelectedIndex = 0; } } }