Beispiel #1
0
    protected override void HorizontalTableList(string _dir, List <CreateFileGroupLibrary> _dataList)
    {
        List <NodeAttribute> tempNodeList = new List <NodeAttribute>();

        for (int j = 0; j < _dataList.Count; j++)
        {
            // 获取单行数据
            List <CreateFileInfo> tempInfo = _dataList[j].FileInfoList;
            if (tempInfo.Count == 0)
            {
                continue;
            }

            List <ElementAttribute> tempElementList = new List <ElementAttribute>();
            for (int i = 0; i < tempInfo.Count; i++)
            {
                tempElementList.Add(new ElementAttribute(tempInfo[i].ParamName, tempInfo[i].ParamValue));
            }

            tempNodeList.Add(new NodeAttribute("NodeAttribute_" + j, tempElementList));
        }

        if (tempNodeList.Count == 0)
        {
            return;
        }

        WriteXmlFile tempXml = new WriteXmlFile(_dir + ".xml");

        for (int i = 0; i < tempNodeList.Count; i++)
        {
            tempXml.WriteXmlAttribute(tempNodeList[i]);
        }
        tempXml.Save();
    }
        private void Button2Create_Click(object sender, EventArgs e)
        {
            myDish.DishName         = textBox1CreateDishName.Text;
            myDish.DishDescripation = textBox4DishDescripton.Text;
            var priceDish = Convert.ToInt32(numericUpDown1CreDishPrice.Value);

            myDish.DishPrice = priceDish;
            myDish.DishSize  = Convert.ToInt32(numericUpDown2DishCreateSize.Value);
            myDish.dishType  = comboBox1DishType.SelectedItem.ToString();
            WriteXmlFile xmlDish = new WriteXmlFile(myDish);

            xmlDish.XmlDishWrite();
            MessageBox.Show($"Your {myDish.DishName} dish has been created.", "Dish created!");
            this.Close();
        }