예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #3
0
 public static int SaveEmail(int instructorId, EmailAddress emailToSave)
 {
     return(EmailAddressManager.Save(instructorId, emailToSave));
 }