Esempio n. 1
0
        public RegisterStudentModel Registernumber(RegisterStudentModel registerStudent)
        {
            string departmentCode = _departmentGateway.GateDepartmentCodeByDepartmentId(registerStudent.DepartmentId);
            List <RegisterStudentModel> student =
                _registerStudentGateway.GateStudentByDepartmentId(registerStudent.DepartmentId);
            string year      = registerStudent.Date.ToString("yyyy");
            int    yearcount = 0;
            int    count     = student.Count;

            if (count != 0)
            {
                foreach (var studentList in student)
                {
                    string regYear = studentList.Date.ToString("yyyy");
                    if (regYear == year)
                    {
                        yearcount++;
                    }
                }
            }
            yearcount++;
            registerStudent.RegistationNumber = departmentCode + "-" + year + "-" + yearcount.ToString().PadLeft(3, '0');
            return(registerStudent);
        }