ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
 
namespace HotelPms.Share.Xml
{
    public class XmlOperation
    {
        /// ****************************** Description *******************************
        /// žƒVƒXƒeƒ€–¼Ì
        /// @”Ä—pƒNƒ‰ƒX
        /// žŠT—v
        /// @XML‚Ì‘€ìF’ljÁAC³AíœAŒŸõ‚È‚Ç
        /// <>Žg—p•û–@
        /// ž—š—ð
        /// @2007/11/10  ¬–؁@Ÿ—´    V‹Kì¬
        /// ****************************** Declarations ******************************
        #region  ššššš@Declartions@ššššš
 
        private string fileName;
        private XmlDocument? xd;
 
        #endregion
 
        #region  ššššš@Property@ššššš
 
        public string FileName
        {
            get { return fileName; }
            set { fileName = value; }
        }
            
        #endregion
 
        #region  ššššš@Class Event@ššššš
 
        public XmlOperation()
            : this("")
        {
        }
 
        public XmlOperation(string fileName)
        {
            if (!fileName.Equals(""))
            {
                this.fileName = fileName;
            }
            xd = new XmlDocument();
            xd.Load(this.fileName);
        }
 
        #endregion
 
        #region  ššššš@Private Function@ššššš
        #endregion
 
        #region  ššššš@Public  Function@ššššš
 
        public XmlElement? AddNode(string parentXPath, string key, string value)
        {
            try
            {
                XmlElement ownerNode = (XmlElement)xd.SelectSingleNode(parentXPath);
                XmlElement newNode = xd.CreateElement(key);
                newNode.InnerText = value;
                ownerNode.AppendChild(newNode);
                return newNode;
            }
            catch
            {
                return null;
            }
        }
 
        /// <summary>
        /// Node‚ÌText‚̏C³
        /// </summary>
        /// <param name="xPath"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool SetNodeText(string xPath,string value)
        {
            try
            {
                xd.SelectSingleNode(xPath).InnerText = value;
                return true;
            }
            catch
            {
                return false;
            }
        }
 
        /// <summary>
        /// Node‚ÌText‚ðŽæ“¾‚·‚é
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        public string GetNodeText(string xPath)
        {
            return xd.SelectSingleNode(xPath).InnerText;
        }
 
 
        /// <summary>
        /// NodeŒŸõ
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        public XmlNode? SelectSingleNode(string xPath)
        {
            return xd.SelectSingleNode(xPath);
        }
        
        /// <summary>
        /// •Û‘¶‚·‚é
        /// </summary>
        /// <returns></returns>
        public bool Save()
        {
            try
            {
                xd.Save(fileName);
                return true;
            }
            catch
            {
                return false;
            }
        }
 
        #endregion
    }
}