예제 #1
0
 public GeneralApiResult<UserDto> Login(string userName, string password)
 {
     IUserApi userApi = new UserApi();
     var funcResult = userApi.Login(userName, password);
     var model = new GeneralApiResult<UserDto>();
     model.Data = funcResult.ReturnValue;
     model.Message = funcResult.Info;
     model.Result = funcResult.Status;
     return model;
 }
예제 #2
0
 public GeneralApiResult<StudentDto> GetBookRecords(string userName, bool isToday = true)
 {
     var result = new GeneralApiResult<StudentDto>();
     var user = UserBLL.GetUserInfoByUserName(userName);
     if (user != null)
     {
         var userDto = StudentBLL.GetStudentDtoByUserId(user.UserId);
         var bookrecords = StudyBLL.GetWaitingCourseListByUserId(userDto.UserId);
         if (isToday)
         {
             bookrecords = bookrecords.Where(b => b.BeginTime.Date == DateTime.Today).ToList();
         }
         var student = new StudentDto()
         {
             UserId = user.UserId,
             UserName = userName,
             CName = user.CName,
             EName = user.EName,
             CC = userDto.CC,
             BookRecords = new List<BookRecordDto>(bookrecords.Count)
         };
         foreach (var bookRecordModel in bookrecords)
         {
             var bookRecordDto = new BookRecordDto()
             {
                 ArrangeCourseBeginTime = bookRecordModel.BeginTime,
                 ArrangeCourseEndTime = bookRecordModel.EndTime,
                 ArrangeCourseId = bookRecordModel.ArrangeCourseId,
                 AttendStatusType = (AttendStatusType)System.Enum.ToObject(typeof(AttendStatusType), bookRecordModel.AttendStatusType),
                 BranchCName = bookRecordModel.BranchCName,
                 CourseEName = bookRecordModel.CourseName,
                 PassStatusType = (PassStatusType)System.Enum.ToObject(typeof(PassStatusType), bookRecordModel.PassStatusType),
                 ProductLevelId = bookRecordModel.ProductLevelId,
                 ProductLevelName = bookRecordModel.ProductLevelName,
                 TeacherName = bookRecordModel.TeacherName,
                 IsOc = bookRecordModel.IsOc,
                 // IsUnBook = bookRecordModel.IsUnBook,
                 IsOnline = bookRecordModel.IsOnline,
                 IsVip = bookRecordModel.IsVip,
                 //UnBookReason = bookRecordModel.UnBookReason,
                 //UnBookTime = bookRecordModel.UnBookTime,
                 //UnBookUserId = bookRecordModel.UnBookUserId,
                 //UnBookUserName = bookRecordModel.UnBookUserName,
                 ClassRoom = bookRecordModel.ClassroomName
             };
             student.BookRecords.Add(bookRecordDto);
         }
         result.Code = "0";
         result.Message = "OK";
         result.Result = true;
         result.Data = student;
     }
     return result;
 }