📄 frmadminfo.cs
字号:
}// end block menthod if
if (Find == -1)//不存在
{
MessageBox.Show("用户信息不存在", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtAdminFind.Text = "";
this.txtAdminFind.Focus();
}//end block if
}//end block
}//end block menthod 用户名查找信息
private void bntSureyan_Click(object sender, EventArgs e)
{
}
//管量员姓名,和密码确认
private void bntSureyan_Click_1(object sender, EventArgs e)
{
if (this.txtUserName.Text == "")
{
MessageBox.Show("用户名不能为空,请输入", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Focus();
}// end block menthod if
else if (this.txtUserPassw.Text == "")
{
MessageBox.Show("密码不能为空,请输入", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserPassw.Focus();
}// end block menthod
else //都不为空时验证
{
admInfo adm = new admInfo();
GetAdminInfo getAdmin = new GetAdminInfo();
adm.setadmName(this.txtUserName.Text.Trim());
adm.setadmPassword(this.txtUserPassw.Text.Trim());
GetLogin log = new GetLogin();//查检是否有权限修改信息
logstr = log.loginDen(adm);//返回字符串信息
if (logstr == "adminOK")// 有权利修改
{
MessageBox.Show("你有权修改自己的信息,请修改", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Enabled = false;
txtUserPassw.Enabled = false;
SqlDataReader dr = getAdmin.getAdminUpdateSelect(adm);//调用方法
while(dr.Read())//把信息显示出来
{
this.txtWorkupdate.Text = dr[3].ToString();
this.txtphoneudate.Text = dr[4].ToString();
}// end block while
dr.Close();
}else if (logstr == "adminNO")//没有权利修改
{
MessageBox.Show("你无权修改信息\n"+"请输入正确验证信息", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Text = "";
this.txtUserPassw.Text = "";
this.txtUserName.Focus();
}// end block menthod
}// end block
}//end block menthod //管量员姓名,和密码确认
// 修改信息
private void bntSureUpdate_Click(object sender, EventArgs e)
{
if (logstr == "adminOK")// 有权D:\张宏宇\财物凭证系统\property\property\control\GetAdminInfo.cs利修改
{
if (this.txtWorkupdate.Text == "")
{
MessageBox.Show("工作地址不能为空,请输入", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtWorkupdate.Focus();
}// end block menthod if
else if (this.txtphoneudate.Text == "")
{
MessageBox.Show("联系电话不能为空,请输入", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtphoneudate.Focus();
}// end block menthod
admInfo adm = new admInfo();
GetAdminInfo getAdmin = new GetAdminInfo();
adm.setadmName(this.txtUserName.Text.Trim());
adm.setadmWordk(txtWorkupdate.Text.Trim());
adm.setadmPhone(this.txtphoneudate.Text.Trim());
string Update = getAdmin.AdminUpdate(adm);
if (Update == "updateOk")
{
MessageBox.Show("修改成功", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Enabled = true;
this.txtUserPassw.Enabled = true;
this.txtUserName.Text = "";
this.txtUserPassw.Text = "";
txtWorkupdate.Text = "";
txtphoneudate.Text = "";
txtUserName.Focus();
}// end block if
else if (Update == "updateNO")
{ MessageBox.Show("修改失败请输入正确信息", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Enabled = true;
this.txtUserPassw.Enabled = true;
this.txtUserName.Text="";
this.txtUserPassw.Text="";
txtWorkupdate.Text = "";
txtphoneudate.Text = "";
txtUserName.Focus();
}// end block if
}// end block if
else
{
MessageBox.Show("请先验证身份,请验证", "修改信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtUserName.Focus();
}// end block else
}// end block menthod 修改
// 取消验证
private void bntEsceYang_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出验证?", "修改信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (Convert.ToString(a) == "Yes")
{
this.txtUserName.Enabled = true;
this.txtUserPassw.Enabled = true;
this.txtUserName.Text="";
this.txtUserPassw.Text="";
txtWorkupdate.Text = "";
txtphoneudate.Text = "";
txtUserName.Focus();
}
}
//取消验证
private void bntEsceupdate_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出修改信息?","退出",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (Convert.ToString(a) == "Yes")
{
this.pUpdate.Visible = false;
}// end block if
}// 取消验证
// 添加注册
private void tsbAdminAdd_Click(object sender, EventArgs e)
{
this.pandSelect.Visible = false;
this.pAdminAdd.Visible = true;
this.pUpdate.Visible = false;
}// end blokc menthod 添加注册
//修改
private void tsbAdminUpdate_Click(object sender, EventArgs e)
{
this.pandSelect.Visible = false;
this.pAdminAdd.Visible = false;
this.pUpdate.Visible = true;
}// end blokc menthod 修改
// 退出
private void tsbEsce_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Convert.ToString(a) == "Yes")
{
this.Close();
}// end block if
}
private void tsbAdminfind_Click(object sender, EventArgs e)
{
this.pandSelect.Visible = true;
this.pAdminAdd.Visible = false;
this.pUpdate.Visible = false;
}
private void txtPhone_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("电话只能输入数字");
e.Handled = true;
}
}
private void txtPhone_KeyPress_1(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("电话只能输入数字");
e.Handled = true;
}
}
private void pAdminAdd_Paint(object sender, PaintEventArgs e)
{
}
}//class AdmInfo : Form
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -