public void Delete(FranchiseeUser franchiseeUser)
        {
            FranchiseeUsersRepository userRepository;
            TBL_FRANCHISEE_USERS franchiseeUserToDelete = null;
            aspnet_Users user;
            ContactsRepository contactRepository;
            try
            {
                contactRepository = new ContactsRepository();
                contactRepository.DeleteContactsOfUser(franchiseeUser.FranchiseeID, new Guid(franchiseeUser.UserID));

                franchiseeUserToDelete = new FranchiseeUsersRepository().GetAll().Where(record => record.FranchiseeID == franchiseeUser.FranchiseeID && record.UserID == new Guid(franchiseeUser.UserID)).SingleOrDefault();
                userRepository = new FranchiseeUsersRepository();
                userRepository.Delete(franchiseeUserToDelete);

                user = new UsersRepository().GetAll().Where(u => u.UserId == new Guid(franchiseeUser.UserID)).SingleOrDefault();
                UserEntitiesFactory.DeleteUserWithRoles(user.UserName, SandlerRoles.FranchiseeUser.ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private List<SandlerModels.Contact> GetContactsByUser(UserModel user)
 {
     ContactsRepository contactsSource = new ContactsRepository();
     List<SandlerModels.Contact> contactsList = null;
     try
     {
         contactsList = contactsSource.GetContactsByUser(user.UserId).ToList<SandlerModels.Contact>();
     }
     catch (Exception ex)
     {
         throw new Exception("exception in UserEntities.Getopportunities: " + ex.Message);
     }
     return contactsList;
 }
 protected virtual TBL_CONTACTS GetContact(long contactId)
 {
     ContactsRepository contactsSource = new ContactsRepository();
     return contactsSource.GetById(contactId);
 }
    private void Binddropdowns()
    {
        QuickStartRepository quickStartRepository = new QuickStartRepository();
        OpprtunityStatusRepository oppStatusRep = new OpprtunityStatusRepository();
        OpprtunitySourceRepository oppSourceRep = new OpprtunitySourceRepository();
        OpprtunityTypesRepository oppTypesRep = new OpprtunityTypesRepository();
        CompaniesRepository companiesRep = new CompaniesRepository();
        ContactsRepository contactsRep = new ContactsRepository();

        ddlBudgeIdentified.DataSource = quickStartRepository.GetYesNoOptions();
        ddlBudgeIdentified.DataBind();

        ddlMoveForward.DataSource = quickStartRepository.GetYesNoOptions();
        ddlMoveForward.DataBind();

        ddlOppStatus.DataSource = oppStatusRep.GetAll();
        ddlOppStatus.DataBind();
        ListItem selectItemddlOppStatus = new ListItem("--Select Opportunity Status--", "0");
        ddlOppStatus.Items.Insert(0, selectItemddlOppStatus);

        ddlOppSource.DataSource = oppSourceRep.GetAll();
        ddlOppSource.DataBind();
        ListItem selectItemddlOppSource = new ListItem("--Select Opportunity Source--", "0");
        ddlOppSource.Items.Insert(0, selectItemddlOppSource);

        ddlOppType.DataSource = oppTypesRep.GetAll();
        ddlOppType.DataBind();
        ListItem selectItemddlOppType = new ListItem("--Select Opportunity Type--", "0");
        ddlOppType.Items.Insert(0, selectItemddlOppType);

        ddlAccount.DataSource = companiesRep.GetNewItemOptions();
        ddlAccount.DataBind();

        ddlIsNewCompany.DataSource = companiesRep.GetNewItemOptions();
        ddlIsNewCompany.DataBind();

        ddlApptSource.DataSource = contactsRep.GetApptSourceOptions();
        ddlApptSource.DataBind();
        ListItem selectItem = new ListItem("--Select Appointment Source--", "0");
        ddlApptSource.Items.Insert(0, selectItem);

        ddlRegForTraining.DataSource = contactsRep.GetRegForTrainingOptions();
        ddlRegForTraining.DataBind();

        ddlCourse.DataSource = contactsRep.GetCourseInfo();
        ddlCourse.DataBind();
        ListItem selectItemddlCourse = new ListItem("--Select Course Type--", "0");
        ddlCourse.Items.Insert(0, selectItemddlCourse);

        ddlIndustry.DataSource = companiesRep.GetAllIndustries();
        ddlIndustry.DataBind();
        ListItem selectItemddlIndustry = new ListItem("--Select Industry--", "0");
        ddlIndustry.Items.Insert(0, selectItemddlIndustry);

        ddlProducts.DataSource = quickStartRepository.GetProductTypeByRole(CurrentUser);
        ddlProducts.DataBind();
        ListItem selectItemddlProducts = new ListItem("--Select Product--", "0");
        ddlProducts.Items.Insert(0, selectItemddlProducts);
    }