/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (CheckData()) { UsersBLL ubll = new UsersBLL(); Users userInfo = new Users(); EncryptBLL ebll = new EncryptBLL(); try { userInfo.Key = txtKey.Text; userInfo.UName = txtName.Text; userInfo.Pw = ebll.GetEncryptStr(txtPw.Text); userInfo.Type = ebll.GetName(); if (txtID.Text == "") { ubll.Add(userInfo); } else { userInfo.ID = Convert.ToInt32(txtID.Text); ubll.Update(userInfo); } } catch (Exception ex) { MessageBox.Show(ex.Message); } ClearInput(); Search(); } }
public string GetPw(string pw) { EncryptBLL ebll = new EncryptBLL(); return ebll.GetDecryptStr(pw); }