📄 frmoperatejop.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace HumanManage.HumanManage
{
public partial class FrmOperateJop : Form
{
private static XmlDocument Add = new XmlDocument();
public FrmOperateJop()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
int n = 0;
Add.Load("..\\..\\xmlJop.xml");
XmlNode Check = Add.SelectSingleNode("//职位");
for (int i = 0; i < Check.ChildNodes.Count; i++)
{
if (Check.ChildNodes[i].InnerText == txtAddJop.Text)
{
n = 1;
}
}
if (n == 1)
{
lblTip.Text = "该职位已经存在!";
}
else
{
XmlDocumentFragment Jops = Add.CreateDocumentFragment();
XmlElement Head = Add.CreateElement(txtAddJop.Text);
Head.InnerText = txtAddJop.Text;
Jops.AppendChild(Head);
XmlNode Node = Add.SelectSingleNode("//职位");
Node.AppendChild(Jops);
lblTip.Text = "添加成功";
Add.Save("..\\..\\xmlJop.xml");
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -