Ejemplo n.º 1
0
        public static bool Delete(int instructorId)
        {
            // Retrieve personId from so we can delete person record
            Instructor toDelete = InstructorManager.GetItem(instructorId);

            if (toDelete != null)
            {
                if (toDelete.PersonId > 0 && toDelete.InstructorId > 0)
                {
                    EmailAddressCollection emailItem = EmailAddressManager.GetCollection(instructorId);
                    if (emailItem != null)
                    {
                        //DElete Email record first

                        if (EmailAddressDAL.DeleteCollection(instructorId))
                        {
                            // delete instructor first
                            if (InstructorDAL.Delete(toDelete.InstructorId))
                            {
                                return(PersonDAL.Delete(toDelete.PersonId));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static bool Delete(int instructorId)
        {
            Instructor toDelete = InstructorManager.GetItem(instructorId);

            if (toDelete != null)
            {
                if (toDelete.PersonId > 0 && toDelete.InstructorId > 0)
                {
                    EmailAddressCollection emailToDelete = EmailAddressManager.GetCollection(instructorId);
                    if (emailToDelete != null)
                    {
                        if (EmailAddressDAL.DeleteCollection(instructorId))
                        {
                            if (InstructorDAL.Delete(toDelete.InstructorId))
                            {
                                return(PersonDAL.Delete(toDelete.PersonId));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }