Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomField _newCustomField = new CustomField();
                if (IsEdit == true)
                {
                    _newCustomField = _db.GetCustomFieldById(this.CustomFieldId);
                }

                _newCustomField.FieldName = txtName.Text;

                _newCustomField.FieldValue = txtFieldValue.Text;
                _newCustomField.TableName  = rdTableName.Text;
                _newCustomField.CustomerId = CustomerId;
                _newCustomField.databaseID = DatabaseId;

                if (IsEdit == true)
                {
                    _db.SaveCustomFields(_newCustomField);
                    _db.SaveChanges();
                    MessageBox.Show("Custom Fields has been Update", "Custom Fields Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    _db.AddToCustomFields(_newCustomField);
                    _db.SaveChanges();
                    MessageBox.Show("Custom Fields has been Created", "Custom Fields Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }catch (Exception ex)
            {
            }
        }