yhFile.Add(menu);
yhFile.Save(@"C:\XMLYhsj.xml");
string lc_xml = @"C:\XMLYhsj.xml";
Network network = new Network();
network.UploadFile(lc_xml, @"ftp://100.100.0.1/yhcd1/XMLYhsj.xml",
"administrator", "1234567", false, 500);
MessageBox.Show("用户添加成功 !", "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
textBox9.Text = string.Empty;
}
catch (Exception el)
{
MessageBox.Show("用户添加失败 !" + el.Message, "系统提示",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
//以下代码是自动产生新用户编码
XElement root = XElement.Load(@"ftp://100.100.0.1/yhcd1/XMLYhsj.xml");
IEnumerable<string> prices =
from el in root.Elements("yhbm")
select (string)el;
if (prices.Count().ToString() == "0")
{
textBox1.Text = "0001";
}
else
{
string lc_max = prices.Max().ToString();
int ln_max = int.Parse(lc_max) + 1;
string lc_mx = ln_max.ToString().Trim();
lc_yhbm = lc_mx.PadLeft(4, '0');
|