Пример #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Person p = new Person();
            p = cmbPersons.SelectedItem as Person;

            b.Delete(p);
        }
Пример #2
0
        public List<Person> FillComboBox()
        {
            List<Person> personsList = new List<Person>();
            try
            {
                command.CommandText = "SELECT * FROM TPersons";
                command.CommandType = CommandType.Text;
                connection.Open();

                OleDbDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Person p = new Person();

                    p.Id = Convert.ToInt32(reader["ID"].ToString());
                    p.FirstName = reader["FirstName"].ToString();
                    p.LastName = reader["LastName"].ToString();

                    personsList.Add(p);
                }
                return personsList;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Пример #3
0
 private static void LoadList()
 {
     for (int i = 0; i < 5; i++) {
         var person = new Person {FirstName = (i%2 == 0) ? "John" : "James", LastName = "Smith"};
         personList.Add(person);
     }
 }
Пример #4
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            Person p = new Person();
            p.FirstName = txtFirstName.Text;
            p.LastName = txtLastName.Text;

            b.Insert(p);
        }
Пример #5
0
 /// <summary>
 /// Function to retrieve filtered list of persons.
 /// </summary>
 /// <param name="persons">Instance of Persons</param>
 /// <param name="personIdentityList">List of person identities</param>
 /// <returns>Instance of Persons containing filtered persons</returns>
 internal static Person RetrieveFilteredPersons(this Person persons, IList<PersonIdentity> personIdentityList)
 {
     Person filteredPersons = new Person();
     filteredPersons.AssignGuests(persons.Guests.RetrieveMatchingGuests(personIdentityList));
     filteredPersons.AssignCrewmembers(persons.Crewmembers.RetrieveMatchingCrewmembers(personIdentityList));
     filteredPersons.AssignVisitors(persons.Visitors.RetrieveMatchingVisitors(personIdentityList));
     return filteredPersons;
 }
Пример #6
0
 public async Task RetrievePersonsByIdAsync()
 {
     var objPerson = new Person();
     objPerson.PersonId = "5";
     objPerson.PersonTypeId = "1";
     this.personRepository.Setup(mockItem => mockItem.GetPersonsByIdAsync(It.IsNotNull<string>(), It.IsNotNull<string>())).Returns(Task.FromResult(objPerson));
     var personDetails = await this.personManager.GetPersonsByIdAsync("5", "1");
     Assert.AreEqual(objPerson.PersonId, personDetails.PersonId);
     Assert.AreEqual(objPerson.PersonTypeId, personDetails.PersonTypeId);
     Assert.IsNotNull(personDetails);
 }
Пример #7
0
        public static externalDTO.Person MapFromDomain(internalDTO.Person person)
        {
            var res = person == null ? null : new externalDTO.Person()
            {
                Id        = person.Id,
                FirstName = person.FirstName,
                LastName  = person.LastName,
                AppUserId = person.AppUserId,
            };

            return(res);
        }
Пример #8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Person oldPerson = new Person();
            Person newPerson = new Person();

            oldPerson = cmbPersons.SelectedItem as Person;

            newPerson.FirstName = txtNewFirstName.Text;
            newPerson.LastName = txtNewLastName.Text;

            b.Update(oldPerson, newPerson);
        }
Пример #9
0
 public ActionResult Delete(Person model)
 {
     try
     {
         _peopleServie.DeletePerson(model);
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         return View("NotFound");
     }
 }
Пример #10
0
        public ActionResult Create(Person person)
        {
            try
            {
                _peopleServie.CreatePerson(person);
            }
            catch (Exception)
            {
                return View("NotFound");
            }

            return RedirectToAction("Index");
        }
Пример #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            Person author = new Person
            {
                Age = 24,
                Name = "Rustam"
            };

            _label = new UILabel();
            _label.Text = author.ToString();
            _label.SizeToFit();

            View.AddSubview(_label);
            _label.Center = View.Center;
        }
Пример #12
0
        public void Delete(Person p)
        {
            try
            {
                command.CommandText = "DELETE FROM TPersons WHERE ID= " + p.Id;
                command.CommandType = CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Пример #13
0
 public void MovePersonToGroup(Person person, Group curGroup, Group newGroup)
 {
     contacts.MovePersonToGroup(person, curGroup, newGroup);
 }
Пример #14
0
 public void AddPersonToGroup(Person person, Group group)
 {
     contacts.AddPersonToGroup(person, group);
 }
Пример #15
0
 public ActionResult Create()
 {
     var model = new Person();
     return View(model);
 }
Пример #16
0
        public void UpdateInfo(Person person)
        {
            Type t = typeof(Person);
            var properties = t.GetProperties();

            foreach (var item in properties)
            {
                item.SetValue(this, item.GetValue(person));
            }
        }
Пример #17
0
        public void Insert(Person p)
        {
            try
            {
                command.CommandText = "INSERT INTO TPersons([firstname], [lastname], [dob], [position], [catagory], [gender]) VALUES('" + p.Firstname + "','" + p.Lastname + "', '" + p.Dob + "','" + p.Position + "', '" + p.Catagory + "', '" + p.Gender + "')";
                command.CommandType = CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Пример #18
0
        public void Update(Person oldPerson, Person newPerson)
        {
            List<Person> personslist = new List<Person>();

            try
            {
                command.CommandText = "UPDATE Tpersons SET [FirstName]= '"+newPerson.Firstname +"', [LastName]= '"+newPerson.Lastname+"', [DOB] = '"+newPerson.Dob+"', [Gender] = '"+newPerson.Gender+"', [Position] = '"+newPerson.Position+"', [Catagory] = '"+newPerson.Catagory+"' WHERE [ID] = " +oldPerson.Id;
                command.CommandType = CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();

            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Пример #19
0
        public void LoadContacts()
        {
            //BinaryDataAccess bda = new BinaryDataAccess();
            //this.contacts = bda.LoadData("data.dat");

            Group group1 = new Group();
            group1.Name = "Family";

            string name1 = "maichao";
            string company1 = "ynu";
            string position1 = "student";

            Person person1 = new Person { Name = name1, Company = company1, Position = position1 };

            Pair<string, string> num1 = new Pair<string, string>("187", "cellphone");
            Pair<Guid, Pair<string, string>> phone1 = new Pair<Guid, Pair<string, string>>(Guid.NewGuid(), num1);

            person1.AddPhone(phone1);

            Pair<string, string> num2 = new Pair<string, string>("187", "cellphone");
            Pair<Guid, Pair<string, string>> phone2 = new Pair<Guid, Pair<string, string>>(Guid.NewGuid(), num2);

            person1.AddPhone(phone2);

            group1.AddPerson(person1);

            string name2 = "mai";
            string company2 = "ynu";
            string position2 = "graduate";

            Person person2 = new Person { Name = name2, Company = company2, Position = position2 };

            group1.AddPerson(person2);

            Group group2 = new Group();
            group2.Name = "Work";

            string name3 = "chao";
            string company3 = "ynu";
            string position3 = "graduate";

            Person person3 = new Person { Name = name3, Company = company3, Position = position3 };

            group2.AddPerson(person3);

            Group group3 = new Group();
            group3.Name = "Other";

            string name4 = "maichao";
            string company4 = "ynu";
            string position4 = "student";

            Person person4 = new Person { Name = name4, Company = company4, Position = position4 };

            group3.AddPerson(person4);

            string name5 = "mai";
            string company5 = "ynu";
            string position5 = "graduate";

            Person person5 = new Person { Name = name5, Company = company5, Position = position5 };

            group3.AddPerson(person5);

            string name = "maimai";
            string company = "ynu";
            string position = "graduate";

            Person person = new Person { Name = name, Company = company, Position = position };

            group1.AddPerson(person);
            group2.AddPerson(person);
            group3.AddPerson(person);

            contacts.AddGroup(group1);
            contacts.AddGroup(group2);
            contacts.AddGroup(group3);
        }
Пример #20
0
 /// <summary>
 /// Assigns the global message person result.
 /// </summary>
 /// <param name="personData">The person data.</param>
 public void AssignGlobalMessagePersonResult(Person personData)
 {
     if (personData != null)
     {
         this.globalMessagePersonList.Add(personData);
     }
 }
Пример #21
0
 public ActionResult Edit(Person person)
 {
     try
     {
         _peopleServie.EditPerson(person);
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         return View("NotFound");
     }
 }
Пример #22
0
 public void DeletePerson(Person person)
 {
     Persons.Remove(this.SearchPersonById(person.Id));
 }
Пример #23
0
 public async Task GetPersonsAlertAndMessageAsyncTest()
 {
     var persons = new ListResult<Person>();
     var objPerson = new Person();
     objPerson.PersonId = "5";
     objPerson.PersonTypeId = "1";
     persons.AssignItems(new List<Person> { objPerson });
     this.personRepository.Setup(mockItem => mockItem.GetPersonsAlertAndMessageAsync(It.IsNotNull<SearchFilters>())).Returns(Task.FromResult(persons));
     var personDetails = await this.personManager.GetPersonsAlertAndMessageAsync(new SearchFilters());
     Assert.IsTrue(personDetails.Items.Any(personDetailItem => personDetailItem.PersonId.Equals(objPerson.PersonId, StringComparison.OrdinalIgnoreCase)));
     Assert.IsNotNull(personDetails);
 }
Пример #24
0
 public void UpdatePerson(Person person)
 {
     contacts.UpdatePerson(person);
 }
Пример #25
0
 public void AddPerson(Person person)
 {
     contacts.AddPerson(person);
 }
Пример #26
0
 /// <summary>
 /// Assigns the global person result.
 /// </summary>
 /// <param name="personData">The person data.</param>
 public void AssignGlobalPersonResult(Person personData)
 {
     if (personData != null)
     {
         this.filterPersonList.Add(personData);
     }
 }
Пример #27
0
 public Edit(Person customer)
 {
     FirstName = customer.Firstname;
     LastName = customer.Lastname;
     UserName = customer.UserName;
 }
Пример #28
0
 public void AddPerson(Person person)
 {
     Persons.Add(person);
 }
Пример #29
0
 public void DeletePerson(Person person)
 {
     contacts.DeletePerson(person);
 }
Пример #30
0
 public void UpdatePerson(Person person)
 {
     this.SearchPersonById(person.Id).UpdateInfo(person);
 }
Пример #31
0
        //
        //  Insert a Person
        //
        public int InsertPerson(Person val)
        {
            if (!IsAuthorized("POST", "/Person"))
                throw new FaultException<IllegalAcess>( new IllegalAcess());

            try
            {
                using (var c = new Connect())
                {
                    c.BeginTrx(IsolationLevel.ReadCommitted);
                    var personDoa = new PersonDataMapper(c.GetConnection());
                    personDoa.SetTransaction(c.Transaction);
                    int result = personDoa.Insert(val);
                    c.Commit();
                    return result;
                }
            }
            catch (Exception exception)
            {
                throw new FaultException<ServerError>(new ServerError());
            }
        }