private void loadListViewControl()
    {
        if (this.UserState.CurrentUser != null)
        {
            List <Person> userlist = PersonFacade.SelectAll();

            if (ExcludeInactive.Value.Equals("true"))
            {
                userlist = (from users in userlist
                            where users.PersonStatus != Status.Inactive
                            select users).ToList <Person>();
            }

            lvUsers.DataSource = userlist;
            lvUsers.DataBind();
            NonAdminLevelAccessProfile1.Visible  = false;
            OnlyAdminLevelAccessProfile1.Visible = false;
        }
        else
        {
            NonAdminLevelAccessProfile1.Visible  = false;
            OnlyAdminLevelAccessProfile1.Visible = false;
            UserProfilesPanel.Visible            = false;
        }
    }
    private void UpdateUserProfile()
    {
        Person toupdate      = PersonFacade.Select(new Guid(OnlyAdminLevelAccessProfile1.UserID));
        bool   statusChanged = toupdate.PersonStatus.Equals(Status.Pending) &&
                               ((Status)OnlyAdminLevelAccessProfile1.Status).Equals(Status.Active);

        toupdate.OpenId         = NonAdminLevelAccessProfile1.OpenID;
        toupdate.FirstName      = NonAdminLevelAccessProfile1.FirstName;
        toupdate.LastName       = NonAdminLevelAccessProfile1.LastName;
        toupdate.EmailAddress   = NonAdminLevelAccessProfile1.EmailAddress;
        toupdate.PhoneNumber    = NonAdminLevelAccessProfile1.PhoneNumber;
        toupdate.Address1       = NonAdminLevelAccessProfile1.Address1;
        toupdate.Address2       = NonAdminLevelAccessProfile1.Address2;
        toupdate.City           = NonAdminLevelAccessProfile1.City;
        toupdate.State          = NonAdminLevelAccessProfile1.State;
        toupdate.ZipCode        = NonAdminLevelAccessProfile1.ZipCode;
        toupdate.Country        = "USA";
        toupdate.PersonStatus   = (Status)OnlyAdminLevelAccessProfile1.Status;
        toupdate.PersonRole     = (Role)OnlyAdminLevelAccessProfile1.PersonRole;
        toupdate.HasBeenTrained = OnlyAdminLevelAccessProfile1.HasUserBeenTrained;
        toupdate.HasClipboard   = OnlyAdminLevelAccessProfile1.HasUserClipboard;

        PersonFacade.Update(toupdate);
        if (statusChanged)
        {
            toupdate.SendActivationConfirmation(Utility.SendCompleted);
        }

        this.Master.SetSuccessMessage("<p>User profile has been updated.</p>");
    }
 public MovieController(MovieFacade facade, RateFacade _rateFacade, GenreFacade _genreFacade, PersonFacade _personFacade)
 {
     movieFacade  = facade;
     rateFacade   = _rateFacade;
     genreFacade  = _genreFacade;
     personFacade = _personFacade;
 }
Beispiel #4
0
 public ProjectController(ProjectFacade prFac, IssueFacade iFac, CommentFacade cFac, PersonFacade pFac)
 {
     projectFacade = prFac;
     issueFacade   = iFac;
     commentFacade = cFac;
     personFacade  = pFac;
 }
        public void SetUp()
        {
            _persons = new List <Person>();
            _persons.Add(new Person()
            {
                Id = 1, Name = "FirstUser"
            });
            _persons.Add(new Person()
            {
                Id = 2, Name = "AnotherUser"
            });
            _persons.Add(new Person()
            {
                Id = 3, Name = "ThirdUser"
            });

            var repository = new Mock <IPersonRepository>();

            repository.Setup(x => x.GetAll()).Returns(_persons.AsEnumerable());
            var builder = new Mock <IPersonDtoBuilder>();

            builder.Setup(x => x.BuildDto(It.IsAny <Person>())).Returns((Person p) => new PersonDto()
            {
                Name = p.Name
            });
            _facade = new PersonFacade(repository.Object, builder.Object);
        }
Beispiel #6
0
 public IssueController(IssueFacade issueFacade, ProjectFacade projectFacade, CommentFacade commentFacade, PersonFacade personFacade, NotificationFacade notificationFacade)
 {
     this.issueFacade        = issueFacade;
     this.projectFacade      = projectFacade;
     this.commentFacade      = commentFacade;
     this.personFacade       = personFacade;
     this.notificationFacade = notificationFacade;
 }
Beispiel #7
0
            public Person(string name, string surname, int age, bool isMale)
            {
                Name    = name;
                Surname = surname;
                Age     = age;
                IsMale  = isMale;

                _facade = new PersonFacade(this);
            }
    protected void lvUsers_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        this.ItemDataPager.PreRender -= new EventHandler(ItemDataPager_PreRender);
        //Disable this event handler so that it will not be called during the call of this event handler.
        IbaMasterPage.ExceptionHandler(this.Master, () =>
        {
            try
            {
                ImageButton ibEditUpdate   = e.Item.FindControl("btnEdit") as ImageButton;
                ImageButton ibDeleteCancel = e.Item.FindControl("btnDelete") as ImageButton;
                HiddenField IdLabel        = e.Item.FindControl("PersonId") as HiddenField;
                Guid personId           = new Guid(IdLabel.Value);
                HiddenField statusLabel = e.Item.FindControl("StatusLabel") as HiddenField;
                string status           = statusLabel.Value;

                if (e.CommandName.Equals("EditOrUpdateCommand"))
                {
                    if (!personId.Equals(Guid.Empty))
                    {
                        EditProfile.Visible = true;
                        loadDetailUserProfile(PersonFacade.Select(personId));
                    }
                }
                else if (e.CommandName.Equals("DeleteOrCancelCommand"))
                {
                    if (!personId.Equals(Guid.Empty))
                    {
                        // Real deletes are only allowed for pending users; others are just inactived
                        if (status.Equals("Pending"))
                        {
                            PersonFacade.Delete(new Person()
                            {
                                Id = personId
                            });
                        }
                        else
                        {
                            Person toupdate       = PersonFacade.Select(personId);
                            toupdate.PersonStatus = Status.Inactive;
                            PersonFacade.Update(toupdate);
                        }

                        loadListViewControl();
                        this.Master.SetSuccessMessage("<p>Successful user profile delete.</p>");
                    }
                }
            }
            catch (SqlException exc)
            {
                Utility.LogSiteError(exc);
                this.Master.SetErrorMessage("<p>A database error occurred.</p>");
            }
        });
    }
        public void CreatePersonTest()
        {
            //setup
            var facade = new PersonFacade(new SessionFactoryHelper(), new PersonRepository(), new CommunicationRepository());

            var person = new Person()
            {
                Name = "Person One", CreatedBy = _user, UpdatedBy = _user
            };

            //act
            person = facade.SavePerson(person);

            //assert
            Assert.IsNotNull(person);
            Assert.AreNotEqual(0, person.Id);
            Assert.AreEqual("Person One", person.Name);
        }
        public void AddPersonWithCommsTest()
        {
            //setup
            var facade = new PersonFacade(new SessionFactoryHelper(), new PersonRepository(), new CommunicationRepository());

            var person = new Person()
            {
                Name = "Person Two", CreatedBy = _user, UpdatedBy = _user
            };

            person.Communications.Add(new Communication()
            {
                CommunicationType = new CommunicationType()
                {
                    Value = "Email"
                },
                Detail    = "*****@*****.**",
                CreatedBy = _user,
                UpdatedBy = _user
            });/*
                * person.Communications.Add(new Communication()
                * {
                * CommunicationType = new CommunicationType() { Value = "Phone" },
                * Detail = "0299990000",
                * CreatedBy = _user,
                * UpdatedBy = _user
                * });*/

            //act
            person = facade.SavePerson(person);

            //assert
            Assert.IsNotNull(person);
            Assert.AreNotEqual(0, person.Id);
            Assert.AreEqual("Person Two", person.Name);
            Assert.AreEqual("*****@*****.**", person.Communications.First().Detail);
        }
    protected void OpenIdLogin1_LoggedIn1(object sender, OpenIdEventArgs e)
    {
        ExceptionHandler(this, () =>
        {
            e.Cancel = true;

            if (e.Response != null)
            {
                string openId = e.Response.ClaimedIdentifier.ToString().Trim();

                UserState.OpenIdResponse = new OpenIdResponse(e.Response);

                if (UserState.OpenIdResponse.IsAuthenticated)
                {
                    UserState.CurrentUser = PersonFacade.Select(openId);

                    if (UserState.CurrentUser != null && UserState.CurrentUser.PersonStatus.Equals(Status.Active))
                    {
                        SetLoginFormInActive();
                        SetLoginAuthenticatedActive();
                    }
                    else
                    {
                        SetLoginAuthenticatedInActive();
                        SetLoginFormInActive();
                        Response.Redirect("~/Account/register.aspx", true);
                    }
                }
                else
                {
                    SetLoginAuthenticatedInActive();
                    SetLoginFormInActive();
                    Response.Redirect("~/Default.aspx", true);
                }
            }
        });
    }
    private void RegisterUser()
    {
        Person newPerson = Person.CreatePerson();

        newPerson.PersonStatus   = Status.Pending;
        newPerson.FirstName      = NonAdminLevelAccessProfile1.FirstName;
        newPerson.LastName       = NonAdminLevelAccessProfile1.LastName;
        newPerson.EmailAddress   = NonAdminLevelAccessProfile1.EmailAddress;
        newPerson.PhoneNumber    = NonAdminLevelAccessProfile1.PhoneNumber;
        newPerson.Address1       = NonAdminLevelAccessProfile1.Address1;
        newPerson.Address2       = NonAdminLevelAccessProfile1.Address2;
        newPerson.City           = NonAdminLevelAccessProfile1.City;
        newPerson.State          = NonAdminLevelAccessProfile1.State;
        newPerson.ZipCode        = NonAdminLevelAccessProfile1.ZipCode;
        newPerson.Country        = "USA";
        newPerson.PersonStatus   = Status.Pending;
        newPerson.HasBeenTrained = false;
        newPerson.HasClipboard   = false;
        newPerson.OpenId         = NonAdminLevelAccessProfile1.OpenID;
        newPerson.PersonRole     = Role.RegularUser;
        PersonFacade.Insert(newPerson);

        newPerson.SendRegistrationConfirmation(Utility.SendCompleted);
    }
 public HomeController(PersonFacade fcade)
 {
     facade = fcade;
 }
 public LoginController(ApplicationUserFacade userFacade, PersonFacade personFacade)
 {
     this.userFacade = userFacade;
     _personFacade   = personFacade;
 }
Beispiel #15
0
 public HomeController(PersonFacade fcade)
 {
     facade = fcade;
 }
Beispiel #16
0
        static void Main(string[] args)
        {
            PersonFacade personFacade = new PersonFacade();

            PersonDTO person1 = new PersonDTO
            {
                Name      = "Karel",
                Surname   = "Novak",
                BirthDate = new DateTime(1968, 7, 15),
                IsMale    = true
            };

            PersonDTO person2 = new PersonDTO
            {
                Name      = "Marie",
                Surname   = "Novakova",
                BirthDate = new DateTime(1970, 4, 8),
                IsMale    = false
            };

            PersonDTO person3 = new PersonDTO
            {
                Name      = "Petr",
                Surname   = "Novak",
                BirthDate = new DateTime(1995, 2, 2),
                IsMale    = true
            };

            PersonDTO person4 = new PersonDTO
            {
                Name      = "Jana",
                Surname   = "Novakova",
                BirthDate = new DateTime(1999, 2, 4),
                IsMale    = false
            };

            //personFacade.CreatePerson(person1);
            //personFacade.CreatePerson(person2);
            //personFacade.CreatePerson(person3);
            //personFacade.CreatePerson(person4);
            person1.Id = 1;
            person2.Id = 2;
            person3.Id = 3;
            person4.Id = 4;

            //personFacade.SetFather(person4, person1);
            //personFacade.SetMother(person3, person2);
            person4.FatherId = 1;
            person4.MotherId = 2;

            personFacade.DeletePerson(3);

            //personFacade.SetPartner(person3, person4);

            //StringBuilder str = new StringBuilder();
            //foreach (var person in personFacade.GetAllPeople())
            //{
            //    str.Append(person)
            //        .Append("| Mother: ")
            //        .Append(person.MotherId?.ToString() ?? "Unknown")
            //        .Append("| Father: ")
            //        .Append(person.FatherId?.ToString() ?? "Unknown")
            //        .Append("| Partner: ")
            //        .Append(person.PartnerId?.ToString() ?? "Unknown")
            //        .Append(Environment.NewLine);
            //}
            //Console.WriteLine(str.ToString());
        }
 public PersonsListViewModel(PersonFacade personFacade)
 {
     _personFacade = personFacade;
 }
Beispiel #18
0
 public PersonController(PersonFacade personFacade, ApplicationUserFacade applicationUserFacade, NotificationFacade notificationFacade)
 {
     this.personFacade          = personFacade;
     this.applicationUserFacade = applicationUserFacade;
     this.notificationFacade    = notificationFacade;
 }
Beispiel #19
0
 public PersonFacadeAddressBuilder(PersonFacade person)
 {
     this.Person = person;
 }
 public PersonsOverviewViewModel(PersonFacade personFacade)
 {
     _personFacade = personFacade;
 }
 public UserController(ILogger <UserController> logger, PersonFacade personFacade)
 {
     this.logger       = logger;
     this.personFacade = personFacade;
 }
Beispiel #22
0
 public PersonFormViewModel(PersonFacade personFacade)
 {
     _personFacade = personFacade;
 }
Beispiel #23
0
 public PersonFacadeJobBuilder(PersonFacade person)
 {
     this.Person = person;
 }