Example #1
0
        public static PersonModel ToObjectId(DataRow reader)
        {
            PersonModel personModel = new PersonModel();

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

            Debug.WriteLine("PersonModel:" + personModel.ToString());
            return(personModel);
        }
Example #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);
        }