コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            StandardLookup _lookup = new StandardLookup();

            if (IsEdit == true)
            {
                _lookup = _db.GetLookupById(this.LookupId);
            }

            _lookup.code        = txtCode.Text;
            _lookup.description = txtDescription.Text;
            _lookup.lookupgroup = LookupGroup;
            _lookup.isActive    = true;
            if (IsEdit == true)
            {
                _db.SaveLookup(_lookup);
                _db.SaveChanges();
                MessageBox.Show("Lookup Saved", "Lookup has been updated ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                _db.AddToLookups(_lookup);
                _db.SaveChanges();
                MessageBox.Show("Lookup Saved", "Lookup has been Created ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            this.Close();
        }