Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            Select_zone Select_zone = new Select_zone("Book");

            Select_zone.Show();
        }
Exemplo n.º 2
0
 private void Back_Click(object sender, EventArgs e)
 {
     if (hasvalue == 1)
     {
         this.Visible = false;
         Select_zone Select_zone = new Select_zone("Change", course2, teacher2, student2, room2, capacity2, time2);
         Select_zone.Show();
     }
     else
     {
         this.Visible = false;
         Select_zone Select_zone = new Select_zone("Book");
         Select_zone.Show();
     }
 }
Exemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (course == "")
     {
         MessageBox.Show("You should choose a course first!");
     }
     else
     {
         DialogResult dialogResult = MessageBox.Show("You are canceling " + room + " for teacher " + teacher + " and course " + course + ". Are you sure?", "Warning", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             XmlDocument xmlDoc2 = new XmlDocument();
             xmlDoc2.Load("timetable.xml");
             XmlNodeList nodeList = xmlDoc2.SelectSingleNode("NewDataSet").ChildNodes;
             foreach (XmlNode xn in nodeList)
             {
                 XmlElement  xe         = (XmlElement)xn;
                 XmlNodeList nls        = xe.ChildNodes;
                 int         choose     = 0;
                 int         choosetime = 0;
                 foreach (XmlNode xn1 in nls)
                 {
                     XmlElement xe2 = (XmlElement)xn1;
                     if (xe2.Name == "F1")
                     {
                         if (xe2.InnerText == textBox1.Text)
                         {
                             label2.Text = "Course Name: " + textBox1.Text;
                             choose      = 1;
                         }
                     }
                     if (xe2.Name == "F6" && choose == 1)
                     {
                         if (xe2.InnerText == label8.Text.Substring(6))
                         {
                             choosetime = 1;
                         }
                     }
                     if (choose == 1 && choosetime == 1)
                     {
                         xe.RemoveAll();
                         StreamWriter sw = File.AppendText("Cancelmemo.txt");
                         sw.WriteLine("Cancel successful! \nRoom: " + room + " for teacher " + teacher + " and course " + course + " at " + timedomain + "\n");
                         sw.Flush();
                         sw.Close();
                         MessageBox.Show("Cancel successful!");
                         choose = 0;
                     }
                 }
             }
             xmlDoc2.Save("timetable.xml");
             if (choosenumber == 1)
             {
                 this.Visible = false;
                 Select_zone Select_zone = new Select_zone("Change", course, teacher, student, room, capacity, timedomain);
                 Select_zone.Show();
             }
             else if (choosenumber == 0)
             {
                 this.Visible = false;
                 Operation Operation = new Operation();
                 Operation.Show();
             }
         }
     }
 }