private void button1_Click(object sender, EventArgs e) { try { string ls_pass = textBox2.Text; string userName = txtUserName.Text; ls_pass = Security.MD5Encrypt(ls_pass).ToLower(); if (string.IsNullOrWhiteSpace(userName)) { MessageBox.Show("请输入帐号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(ls_pass)) { MessageBox.Show("请输入密码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (UserService.GetUserInfo(userName, ls_pass)) { UnionFm fm = new UnionFm(); fm.Show(); fm.WindowState = FormWindowState.Maximized; this.Hide(); } else { MessageBox.Show("用户名和密码不符,请重输", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox2.Text = ""; textBox2.Focus(); return; } } catch (Exception ex) { MessageBox.Show("错误" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public w_main() { InitializeComponent(); toolStripStatusLabel1.Text = "长株潭物流分拣中心"; toolStripStatusLabel2.Text = "当前用户:"; toolStripStatusLabel3.Text = "登录时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); toolStripStatusLabel4.Text = ""; UnionFm w_SortingControlMain = new UnionFm(); if (CheckExist(w_SortingControlMain) == true) { w_SortingControlMain.Dispose(); w_SortingControlMain = null; return; } w_SortingControlMain.MdiParent = this; //w_SortingControlMain.WindowState = FormWindowState.Maximized; w_SortingControlMain.FormBorderStyle = FormBorderStyle.None; w_SortingControlMain.Width = 1920; w_SortingControlMain.Height = 700; w_SortingControlMain.Show(); }