Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            int             gradesum = 0;
            XmlDataDocument xmlDoc   = new XmlDataDocument();

            xmlDoc.Load("rubric.xml");
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("UIC").ChildNodes;
            int         count    = 0;

            foreach (XmlNode xn in nodeList)
            {
                XmlElement xe = (XmlElement)xn;

                if (xe.GetAttribute("name") == name)
                {
                    XmlNodeList nls = xe.ChildNodes;
                    foreach (XmlNode xn1 in nls)
                    {
                        gradesum = gradesum + Convert.ToInt32(xn1.Attributes[2].Value);
                    }
                }
            }

            if (gradesum == 100)
            {
                Form1 f1 = new Form1();
                f1.Show();
                this.Hide();
            }
            else
            {
                countmodify = false;
                string      xmlpath = @"rubric.xml";
                XmlDocument xmlDoc1 = new XmlDocument();
                xmlDoc1.Load(xmlpath);
                XmlNode     root   = xmlDoc1.SelectSingleNode("UIC");
                XmlNodeList xnList = root.ChildNodes;
                foreach (XmlNode xn in xnList)
                {
                    if (xn.Attributes[1].Value.ToString() == name)
                    {
                        root.RemoveChild(xn);
                    }
                }
                xmlDoc1.Save(xmlpath);
                MessageBox.Show("Total percentage should be 100, please enter rubric again");
            }


            XElement student           = XElement.Load("rubric.xml");
            IEnumerable <XElement> stu = from st in student.Elements("courses")
                                         where (string)st.Attribute("name") == name
                                         select st;
            var query1 = from n in stu.Elements()
                         select new
            {
                row        = n.Attribute("row").Value,
                Item       = n.Attribute("Item").Value,
                Percentage = n.Attribute("Percentage").Value,
                A          = n.Attribute("A").Value,
                B          = n.Attribute("B").Value,
                C          = n.Attribute("C").Value,
                D          = n.Attribute("D").Value,
                F          = n.Attribute("F").Value
            };

            dataGridView1.DataSource = query1.ToList();
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     WindowsFormsApp3.Form1 showabout = new WindowsFormsApp3.Form1();
     showabout.Show();
 }