public ThreeObjectsModel(PersonModel person2, VehicleModel vehicle2, ApprovalModel approval2)
 {
     personModel   = person2;
     vehicleModel  = vehicle2;
     approvalModel = approval2;
 }
Ejemplo n.º 2
0
        public static PersonModel ToObject(DataRow reader)
        {
            PersonModel personModel = new PersonModel();

            personModel.personId = reader[0].ToString();


            try
            {
                personModel.personFirstName = reader[1].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personFirstName:" + ex.Message);
            }

            try
            {
                personModel.personLastName = reader[2].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personLastName:" + ex.Message);
            }

            try
            {
                personModel.personBeforeTelephone = reader[3].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personBeforeTelephone:" + ex.Message);
            }

            try
            {
                personModel.personTelephone = reader[4].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personTelephone:" + ex.Message);
            }

            try
            {
                personModel.personBeforeCellphone = reader[5].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personBeforeCellphone:" + ex.Message);
            }

            try
            {
                personModel.personCellphone = reader[6].ToString();
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personCellphone:" + ex.Message);
            }

            try
            {
                personModel.personCode = int.Parse(reader[7].ToString());
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("personCode:" + ex.Message);
            }



            Debug.WriteLine("PersonModel:" + personModel.ToString());
            return(personModel);
        }