Exemple #1
0
        public static People GetPeopleById(int personId)
        {
            if (personId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroAreaId);
            }

            People theData = null;

            try
            {
                PeopleTableAdapter       localAdapter = new PeopleTableAdapter();
                PeopleDS.PeopleDataTable theTable     = localAdapter.GetPersonById(personId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    PeopleDS.PeopleRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía la persona de id: " + personId, exc);
                throw exc;
            }

            return(theData);
        }
Exemple #2
0
        private static People FillRecord(PeopleDS.PeopleRow row)
        {
            People theNewRecord = new People(
                row.personID,
                row.id,
                row.name,
                row.organizationID,
                row.IsareaIDNull() ? 0 : row.areaID);

            theNewRecord.OrganizationName = row.organizationName;
            theNewRecord.AreaName         = row.IsareaNameNull() ? "" : row.areaName;
            theNewRecord.NumberOfKpis     = row.IsnumberKPIsNull() ? 0 : row.numberKPIs;
            theNewRecord.IsOwner          = row.IsisOwnerNull() ? false : Convert.ToBoolean(row.isOwner);
            return(theNewRecord);
        }