Beispiel #1
0
        private void btn_Accept_Click(object sender, EventArgs e)
        {
            if (!Check_Syntax())
            {
                MessageBox.Show("Enter valid data!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                TimetableDataContext context = new TimetableDataContext();

                int Id = 1;
                if (context.ClassRooms.Count() != 0)
                {
                    Id = context.ClassRooms.Max(p => p.ID) + 1;
                }

                ClassRoom cls = new ClassRoom();
                cls.ID          = Id;
                cls.Name        = tbox_Name.Text;
                cls.Description = tbox_Description.Text;

                context.ClassRooms.InsertOnSubmit(cls);
                context.SubmitChanges();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
 partial void DeleteClassRoom(ClassRoom instance);
Beispiel #3
0
 partial void UpdateClassRoom(ClassRoom instance);
Beispiel #4
0
 partial void InsertClassRoom(ClassRoom instance);