Example #1
0
 public static bool DeletePhylum(Phylum SelectedPhylum)
 {
     try
     {
         DataAccessLayer.DeleteObject(SelectedPhylum);
         DataAccessLayer.SaveChanges(System.Data.Objects.SaveOptions.None);
     }
     catch (Exception ex)
     {
         string s = ex.ToString();
         DataAccessLayer.Refresh(System.Data.Objects.RefreshMode.StoreWins, SelectedPhylum);
         return false;
     }
     DataAccessLayer.Refresh(System.Data.Objects.RefreshMode.StoreWins, SelectedPhylum);
     return true;
 }
Example #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (PhylumDataAccess.DeletePhylum(SelectedPhylum) == false)
            {
                MessageBox.Show("Cannot delete, child nodes still exist", "Delete Fail", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            SelectedPhylum = null;
            LoadData();
            try
            {
                dgPhylums.CurrentCell = dgPhylums.Rows[0].Cells[0];
                dgPhylums.Rows[0].Selected = true;
            }
            catch
            {
                btnClasses.Enabled = false;
                txtPhylumId.Text = "";
                txtPhylumName.Text = "";
            }
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Phyla EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPhyla(Phylum phylum)
 {
     base.AddObject("Phyla", phylum);
 }
Example #4
0
 /// <summary>
 /// Create a new Phylum object.
 /// </summary>
 /// <param name="phylumId">Initial value of the PhylumId property.</param>
 public static Phylum CreatePhylum(global::System.Int32 phylumId)
 {
     Phylum phylum = new Phylum();
     phylum.PhylumId = phylumId;
     return phylum;
 }
Example #5
0
 public static int SavePhylum(Phylum SelectedPhylum)
 {
     return DataAccessLayer.SaveChanges();
 }
Example #6
0
        private void SelectPhylum(int id)
        {
            try
            {

                SelectedPhylum = PhylumDataAccess.GetPhylumById(id);
                txtPhylumName.Text = SelectedPhylum.PhylumName;
                txtPhylumId.Text = SelectedPhylum.PhylumId.ToString();
                btnClasses.Enabled = true;
            }
            catch { }
        }