예제 #1
0
 public static void EventAddToDataBase(EasyCalProj.EasyCalDB.Events1 newEvent)
 {
     using (var EasyCal = new EasyCalEntities1())
     {
         EasyCal.Events1.Add(newEvent);
         EasyCal.SaveChanges();
     }
 }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ClickedEvent = new EasyCalProj.EasyCalDB.Events1
            {
                EventName   = textBox1.Text,
                Date        = dateTimePicker1.Value,
                StartTime   = comboBox1.Text,
                EndTime     = comboBox2.Text,
                Description = textBox2.Text
            };

            EventAddToDataBase(ClickedEvent);
            MessageBox.Show("אירוע נוסף בהצלחה");
            this.Close();
        }