示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (FamilyDataAccess.DeleteFamily(SelectedFamily) == false)
            {
                MessageBox.Show("Cannot delete, child nodes still exist", "Delete Fail", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            SelectedFamily = null;
            LoadData();
            try
            {
                dgFamilys.CurrentCell = dgFamilys.Rows[0].Cells[0];
                dgFamilys.Rows[0].Selected = true;
            }
            catch
            {
                btnGenus.Enabled = false;
                txtFamilyId.Text = "";
                txtFamilyName.Text = "";
            }
        }
示例#2
0
 /// <summary>
 /// Create a new Family object.
 /// </summary>
 /// <param name="familyId">Initial value of the FamilyId property.</param>
 public static Family CreateFamily(global::System.Int32 familyId)
 {
     Family family = new Family();
     family.FamilyId = familyId;
     return family;
 }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Families EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFamilies(Family family)
 {
     base.AddObject("Families", family);
 }
示例#4
0
 private void SelectFamily(int id)
 {
     try
     {
         SelectedFamily = FamilyDataAccess.GetFamilyById(id);
         txtFamilyName.Text = SelectedFamily.FamilyName;
         txtFamilyId.Text = SelectedFamily.FamilyId.ToString();
         if (SelectedFamily.Notes != null)
         {
             txtNotes.Text = SelectedFamily.Notes.ToString();
         }
         else
         {
             txtNotes.Text = "";
         }
         btnGenus.Enabled = true;
     }
     catch { }
 }