Exemple #1
0
        public string CreateToken(StaffViewModel objViewModel, long userId, long organizationId)
        {
            int recordAffected = 0;

            DBConnectionString.RegistrationToken registrationToken = new DBConnectionString.RegistrationToken();
            registrationToken.OrganizationId = organizationId;
            // registrationToken.CourseId = (int)objViewModel.CourseId;
            // registrationToken.ClassId = objViewModel.ClassId;
            // registrationToken.SectionId = objViewModel.SectionId;
            //if (objViewModel.DepartmentId != null)
            //{
            //    registrationToken.DepartmentId = (int)objViewModel.DepartmentId;
            //}
            registrationToken.Token      = UserStatistics.GenerateToken();
            registrationToken.CreatedBy  = userId;
            registrationToken.RoleId     = (int)UserRoles.Teacher;
            registrationToken.InsertedOn = DateTime.Now;
            recordAffected = Convert.ToInt32(registrationToken.Insert());
            if (recordAffected > 0)
            {
                return(registrationToken.Token);
            }
            return(string.Empty);
        }
Exemple #2
0
 public string CreateToken(StudentViewModel objViewModel, long userId, long organizationId)
 {
     int recordAffected = 0;
     DBConnectionString.RegistrationToken registrationToken = new DBConnectionString.RegistrationToken();
     registrationToken.OrganizationId = organizationId;
     registrationToken.CourseId = (int)objViewModel.CourseId;
     registrationToken.ClassId = objViewModel.ClassId;
     registrationToken.SectionId = objViewModel.SectionId;
     if (objViewModel.DepartmentId != null)
     {
         registrationToken.DepartmentId = (int)objViewModel.DepartmentId;
     }
     registrationToken.Token = UserStatistics.GenerateToken();
     registrationToken.CreatedBy = userId;
     registrationToken.InsertedOn = DateTime.Now;
     registrationToken.RoleId = (int)UserRoles.Student;
     recordAffected = Convert.ToInt32(registrationToken.Insert());
     if (recordAffected > 0)
     {
         return registrationToken.Token;
     }
     return string.Empty;
 }