Exemplo n.º 1
0
        //提交离宿
        private void btnDate_Click(object sender, EventArgs e)
        {
            System.DateTime dt  = dateTimePicker1.Value.Date;
            System.DateTime dt2 = dateTimePicker2.Value.Date;
            if (dt.CompareTo(dt2) > 0)
            {
                MessageBoxEx.Show("日期有误!");
                return;
            }
            XmlDocument doc = new XmlDocument();

            doc.Load("事物表.xml");
            XmlElement Users = doc.DocumentElement;

            if (Users.SelectSingleNode("/Users/student[sno='" + Sno + "']") != null)
            {
                MessageBoxEx.Show("您还有假期未消除!");
                return;
            }

            XmlElement student    = doc.CreateElement("student");
            XmlElement sno        = doc.CreateElement("sno");
            XmlElement leavetime  = doc.CreateElement("leavetime");
            XmlElement arrivetime = doc.CreateElement("arrivetime");
            XmlElement state      = doc.CreateElement("state");

            Users.AppendChild(student);
            student.AppendChild(sno);
            student.AppendChild(leavetime);
            student.AppendChild(arrivetime);
            student.AppendChild(state);

            sno.InnerText        = Sno.ToString();
            leavetime.InnerText  = dt.Date.ToString();
            arrivetime.InnerText = dt2.Date.ToString();
            state.InnerText      = "未消假";

            doc.Save("事物表.xml");
            MessageBoxEx.Show("申请成功!");
        }
Exemplo n.º 2
0
 public override string ToString()
 {
     return(Sno.ToString() + ":" + Cno.ToString() + ":" + Grade.ToString());
 }