예제 #1
0
 public static void EventAddToDataBase(EasyCalProj.EasyCalDB.Marathone newEvent)
 {
     using (var EasyCal = new EasyCalEntities1())
     {
         EasyCal.Marathones.Add(newEvent);
         EasyCal.SaveChanges();
     }
 }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ClickedEvent = new EasyCalProj.EasyCalDB.Marathone
            {
                Name         = textBox5.Text,
                LecturerName = textBox6.Text,
                StartTime    = comboBox3.Text,
                EndTime      = comboBox4.Text,
                StartDate    = DateTime.Parse(dateTimePicker2.Text),
                EndDate      = DateTime.Parse(dateTimePicker3.Text),
                Location     = textBox7.Text,
                Price        = textBox8.Text,
            };

            EventAddToDataBase(ClickedEvent);
            MessageBox.Show("פעילות נוספה בהצלחה");
        }