Esempio n. 1
0
 public void Absorb(Basin other)
 {
     if (other == null || other == this)
     {
         return;
     }
     for (int x = 0; x < 100; ++x)
     {
         for (int y = 0; y < 100; ++y)
         {
             BasinMap[x, y] |= other.BasinMap[x, y];
         }
     }
     Basins.Remove(other);
 }
Esempio n. 2
0
        /// <summary>
        /// Deleting the currently viewed rock sample
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Delete()
        {
            try
            {
                if (!DataValidation.CheckPrerequisites(CRUD.Delete, SelectedBasin, (int)SelectedBasin.basUserIdFk))
                {
                    return;
                }
            }
            catch
            {
                return;
            }

            // If existing window is visible, delete the customer and all their orders.
            // In a real application, you should add warnings and allow the user to cancel the operation.

            if (((ShellViewModel)IoC.Get <IShell>()).ShowQuestion("Are you sure to delete the record?") == MessageBoxViewResult.No)
            {
                return;
            }

            using (var db = new ApirsRepository <tblBasin>())
            {
                try
                {
                    db.DeleteModelById(SelectedBasin.basIdPk);

                    Basins.Remove(SelectedBasin);
                    allBasins.Remove(SelectedBasin);
                }
                catch (Exception ex)
                {
                    ((ShellViewModel)IoC.Get <IShell>()).ShowError("An unexpected error occurred.");
                }
                finally
                {
                }
            }
        }