private void BtnSubmit_Click(object sender, EventArgs e) { if (TxtDescribe.Text == "") { MessageBox.Show("为获取到需要保存的数据!请重新输入!"); return; } BugInfo myBug = new BugInfo(); myBug.Describe = TxtDescribe.Text; myBug.BugLevel = CBBLevel.SelectedIndex; myBug.PresenterID = loginUser.UserID; myBug.PresenterName = loginUser.UserName; BizController myBiz = new BizController(); try { bool SaveFlag = myBiz.SaveBugInfo(myBug); if (SaveFlag) { MessageBox.Show("保存成功!"); FormDataList ParentForm = (FormDataList)this.Owner; ParentForm.Refresh_Window(); this.Close(); } else { MessageBox.Show("保存失败!"); } } catch (Exception ex) { MessageBox.Show("保存失败!原因是:" + ex.Message); } }
private void BtnLogin_Click(object sender, EventArgs e) { if (txtUserName.Text == "") { MessageBox.Show("请输入用户名!"); return; } if (txtUserName.Text == "recode" && txtPassword.Text == "") { this.BtnLink.Show(); return; } if (txtPassword.Text == "") { MessageBox.Show("请输入密码!"); return; } string UserName = txtUserName.Text; byte[] btPwd = Encoding.Default.GetBytes(this.txtPassword.Text.Trim()); MD5 md5 = new MD5CryptoServiceProvider(); byte[] outPutPwd = md5.ComputeHash(btPwd); string PwdResult = BitConverter.ToString(outPutPwd).Replace("-", ""); try { BizController myLogin = new BizController(); if (myLogin.Login(UserName, PwdResult)) { MessageBox.Show("登录成功!"); FormDataList ini = new FormDataList(); ini.StartPosition = FormStartPosition.CenterScreen; ini.Owner = this; ini.Show(); this.Hide(); } else { MessageBox.Show("登录失败!请重试!"); this.Refresh(); } } catch (Exception ex) { MessageBox.Show("登录错误,错误原因:" + ex.Message); this.Refresh(); } }