Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog() { Title = "Сохранение данных", Filter = "файл мероприятия|*.event" };
            var result = sfd.ShowDialog(this);
            if (result != DialogResult.OK)
                return;

            var cd = new Event();

            cd.dateTimePicker1 = dateTimePicker1.Value;
            cd.Time = Time.Text;
            cd.textBox6 = textBox6.Text;
            cd.textBox5 = textBox5.Text;
            cd.textBox4 = textBox4.Text;
            cd.textBox3 = textBox3.Text;

            foreach (People ed in People.Items)
            {
                cd.Form2.Add(ed);
            }

            var xs = new XmlSerializer(typeof(Event));
            var file = File.Create(sfd.FileName);
            xs.Serialize(file, cd);
            file.Close();
        }
Beispiel #2
0
 private void InitPocupatel()
 {
     var spName = GetName();
     if (spName != null && System.IO.File.Exists(spName))
     {
         var file = System.IO.File.OpenRead(spName);
         var xs = new XmlSerializer(typeof(Event));
         sp = (Event)xs.Deserialize(file);
         file.Close();
     }
     else
     {
         sp = new Event();
     }
 }
Beispiel #3
0
        private Event GetEvent()
        {
            var cwd = new Event();
            cwd.dateTimePicker1 = dateTimePicker1.Value;
            cwd.Time = Time.Text;
            cwd.textBox6 = textBox6.Text;
            cwd.textBox5 = textBox5.Text;
            cwd.textBox4 = textBox4.Text;
            cwd.textBox3 = textBox3.Text;

            foreach (People ed in People.Items)
            {
                cwd.Form2.Add(ed);
            }
            return cwd;
        }