frmoperatejop.cs
来自「人事管理系统的C#实现.比较完整.难得的代码」· CS 代码 · 共 56 行
CS
56 行
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 + =
减小字号Ctrl + -
显示快捷键?