Пример #1
0
        private void butSave_Click(object sender, EventArgs e)
        {
            if (boxBookTypeName.Text == "")
            {
                MessageBox.Show("Book Type Name must be filled !");
            }
            else if (boxBookTypeName.Text.IndexOf(" ") == -1)
            {
                MessageBox.Show("Book Type Name must 2 words minimum !");
            }
            else
            {
                if (flag == 1)
                {
                    MsBookType booktype = new MsBookType();
                    booktype.BookTypeID   = boxBookTypeID.Text;
                    booktype.BookTypeName = boxBookTypeName.Text;
                    dtBS.MsBookTypes.InsertOnSubmit(booktype);
                    dtBS.SubmitChanges();
                    MessageBox.Show("Data succesfuly inserted !");

                    dataGridBookType.Enabled = true;
                    IUDEnabled();
                    IdentityDisabled();
                    clear();
                    refreshTable();
                }
                else if (flag == 2)
                {
                    var query = (from x in dtBS.MsBookTypes where x.BookTypeID == boxBookTypeID.Text select x).First();
                    query.BookTypeID   = boxBookTypeID.Text;
                    query.BookTypeName = boxBookTypeName.Text;

                    dtBS.MsBookTypes.InsertOnSubmit(query);
                    dtBS.SubmitChanges();
                    MessageBox.Show("Data succesfuly updated !");

                    dataGridBookType.Enabled = true;
                    IUDEnabled();
                    IdentityDisabled();
                    clear();
                    refreshTable();
                }
            }
        }
Пример #2
0
 partial void UpdateMsBookType(MsBookType instance);
Пример #3
0
 partial void DeleteMsBookType(MsBookType instance);
Пример #4
0
 partial void InsertMsBookType(MsBookType instance);