Beispiel #1
0
 private async Task <IEnumerable <SchoolSubjectModel> > GetSchoolSubjectList()
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.FetchRecordSetAsync(SubjectSQL.SelectSchoolSubject(UserSession.User.Settings.SchoolID.ToString()), SchoolSubjectModel.CreateSchoolSubject));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(new HashSet <SchoolSubjectModel>());
     }
 }
Beispiel #2
0
 async Task <IEnumerable <SubjectModel> > GetSubjectList(string ClassId)
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.FetchRecordSetAsync(SubjectSQL.SelectSchoolSubject(UserSession.User.Settings.SchoolID.ToString(), ClassId), (R) => new SubjectModel()
             {
                 ID = Convert.ToInt32(R["ID"]),
                 Alias = R["Alias"].ToString()
             }));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(new HashSet <SubjectModel>());
     }
 }