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

            SelectedStatus = null;
            LoadData();
            try
            {
                dgStatus.CurrentCell = dgStatus.Rows[0].Cells[0];
                dgStatus.Rows[0].Selected = true;
            }
            catch
            {
                txtStatusId.Text = "";
                txtStatusName.Text = "";
            }
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SpeciesStatus EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSpeciesStatus(SpeciesStatu speciesStatu)
 {
     base.AddObject("SpeciesStatus", speciesStatu);
 }
Example #4
0
 /// <summary>
 /// Create a new SpeciesStatu object.
 /// </summary>
 /// <param name="statusId">Initial value of the StatusId property.</param>
 public static SpeciesStatu CreateSpeciesStatu(global::System.Int32 statusId)
 {
     SpeciesStatu speciesStatu = new SpeciesStatu();
     speciesStatu.StatusId = statusId;
     return speciesStatu;
 }
Example #5
0
 public static int SaveStatus(SpeciesStatu SpeciesStatus)
 {
     return DataAccessLayer.SaveChanges();
 }
Example #6
0
 private void SelectStatus(int id)
 {
     try
     {
         SelectedStatus = StatusDataAccess.GetStatusById(id);
         txtStatusName.Text = SelectedStatus.StatusText;
         txtStatusId.Text = SelectedStatus.StatusId.ToString();
     }
     catch { }
 }