コード例 #1
0
        /// <summary>
        /// 新增更新列表
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="item"></param>
        public int saveUpdateToXml(channelItem item)
        {
            if (item == null)
            {
                return(-2);
            }
            XmlNode root = GetRootNode();

            XmlNode xFind = xmlDoc.SelectSingleNode("Root/Item[@index='" + item.index + "']");

            if (xFind == null)
            {
                //新增
                xFind = xmlDoc.SelectSingleNode("Root/Item[@cid='" + item.cid + "']");
                if (xFind != null)
                {
                    DialogResult dr = MessageBox.Show("已经存在标识为:" + item.cid + "的渠道信息", "确认是否覆盖", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        XmlElement element = (XmlElement)xFind;
                        item.index = Convert.ToInt32(element.GetAttribute("index"));
                        return(UpdateXmlNode(item));
                    }
                    else
                    {
                        return(-1000);
                    }
                }

                return(AddXmlNode(item));
            }
            else
            {
                return(UpdateXmlNode(item));
            }
        }
コード例 #2
0
 public checkItem(String Text, String Value, channelItem Tag)
 {
     m_Text  = Text;
     m_Value = Value;
     m_Tag   = Tag;
 }