Exemplo n.º 1
0
        public long GetNextCode(int personType)
        {
            long       nextCode   = 0;
            PersonData personData = new PersonData();
            PersonDto  personDto  = personData.SelectLatestPersonByType(personType);

            if (personDto != null && personDto.PersonId > 0)
            {
                nextCode = personDto.PersonId + 1;
            }
            else
            {
                if (personType == (int)EnumCommonClass.PersonType.Faculty)
                {
                    nextCode = (int.Parse(Properties.Settings.Default["FacultyCode"].ToString()) * 1000) + 1;
                }
                else if (personType == (int)EnumCommonClass.PersonType.Student)
                {
                    nextCode = (int.Parse(Properties.Settings.Default["StudentCode"].ToString()) * 1000) + 1;
                }
            }
            return(nextCode);
        }