예제 #1
0
 public static void EventAddToDataBase(EasyCalProj.EasyCalDB.Activity newEvent)
 {
     using (var EasyCal = new EasyCalEntities1())
     {
         EasyCal.Activities.Add(newEvent);
         EasyCal.SaveChanges();
     }
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var ClickedEvent = new EasyCalProj.EasyCalDB.Activity
            {
                ActivityName = textBox1.Text,
                Date         = dateTimePicker1.Value,
                StartTime    = comboBox1.Text,
                Endtime      = comboBox2.Text,
                Location     = textBox2.Text,
                Price        = textBox3.Text,
                Description  = textBox4.Text
            };

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