单击按钮事件中有关新添加用户并存入XML文件代码:
private void button1_Click(object sender, EventArgs e)
{
XElement yhFile = XElement.Load(@"ftp://100.100.0.1/yhcd1/XMLYhsj.xml");
string lc_yhbm = textBox1.Text.Trim();
string lc_yhxm = textBox2.Text.Trim();
string lc_cdbms = string.Empty;
string lc_dwmc = textBox3.Text.Trim();
string lc_jsmc = textBox4.Text.Trim();
string lc_yhmm1 = textBox5.Text.Trim();
string lc_yhmm2 = textBox10.Text.Trim();
if (lc_yhmm1 != lc_yhmm2)
{
MessageBox.Show("两次输入的密码不相等,请重新输入 !", "系统提示",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
textBox5.Text = string.Empty;
textBox10.Text = string.Empty;
return;
}
string lc_scmm = oper.mmjmsc(lc_yhmm1); //调用密码加密输出方法
try
{
XElement menu = new XElement("yhbm",
new XAttribute("yhxm", lc_yhxm),
new XAttribute("dwbm", lc_dwbm),
new XAttribute("dwmc", lc_dwmc),
new XAttribute("jsbm", lc_jsbm),
new XAttribute("jsmc", lc_jsmc),
new XAttribute("yhmm", lc_scmm), lc_yhbm);
|