예제 #1
0
 public SchedulePreview(int id)
 {
     InitializeComponent();
     ctx = new ScheduleContext();
     dataGridView1.AllowUserToAddRows = false;
     ctx.Schedules.Load();
     s = ctx.Schedules.Find(id);
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (var ctx = new ScheduleContext())
            {
                if (textBox2.Text == "")
                {
                    MessageBox.Show("Missing required input.", "Missing input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    var schedule = new Schedule
                    {
                        Name = textBox2.Text.ToString(),
                    };

                    ctx.Schedules.Add(schedule);
                    ctx.SaveChanges();

                    this.Close();
                }
            }
        }