示例#1
0
        private void customerBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            bool inputError = false;

            foreach (DbEntityValidationResult err in db.GetValidationErrors())
            {
                inputError = true;
                foreach (DbValidationError errMsg in err.ValidationErrors)
                {
                    MessageBox.Show(errMsg.ErrorMessage, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            if (inputError)
            {
                return;
            }
            customerBindingNavigatorSaveItem.Enabled = false;
            this.db.SaveChanges();
            customerDataGridView.Update();
            customerDataGridView.Refresh();
            orderDataGridView.Update();
            orderDataGridView.Refresh();
        }
示例#2
0
        private void zapiszToolStripButton_Click(object sender, EventArgs e)
        {
            bool inputError = false;

            foreach (DbEntityValidationResult err in db.GetValidationErrors())
            {
                inputError = true;
                foreach (DbValidationError errMsg in err.ValidationErrors)
                {
                    MessageBox.Show(errMsg.ErrorMessage, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            if (inputError)
            {
                return;
            }

            zapiszToolStripButton.Enabled = false;
            db.SaveChanges();
            categoryDataGridView.Update();
            categoryDataGridView.Refresh();
            productDataGridView.Update();
            productDataGridView.Refresh();
        }