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 DataManager { public partial class Login : Form { public Login() { InitializeComponent(); } private void btnLogin_Click(object sender, EventArgs e) { string account = txtAccount.Text.Trim(); if (account != null && account.Length == 11) { DataTable dt = DataAccess.Get_cm_user_by_cellphone(account); if (dt != null && dt.Rows.Count > 0) { UIConstants.user.UserId = int.Parse(dt.Rows[0]["userid"].ToString()); UIConstants.user.UserName = dt.Rows[0]["username"].ToString(); UIConstants.user.OrgId = int.Parse(dt.Rows[0]["org_id"].ToString()); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("登录名不正确,请重新输入", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtAccount.Focus(); } } } } }