Exemplo n.º 1
0
 public static IEnumerable <SchoolClass> GetClassList()
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(dbs.FetchRecordSetAsync(SchoolClassSQL.SelectSchoolClassCombo(UserSession.User.Settings.SchoolID.ToString(), UserSession.User.Settings.SchoolYear), SchoolClassModel).Result);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public static async Task <IEnumerable <SchoolClass> > GetClassList()
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.FetchRecordSetAsync(SchoolClassSQL.SelectSchoolClassCombo(UserSession.User.Settings.SchoolID.ToString(), UserSession.User.Settings.SchoolYear), (R) => new SchoolClass()
             {
                 ID = Convert.ToInt32(R["ID"]),
                 ClassCode = R["KodKlasy"].ToString(),
                 ClassName = R["NazwaKlasy"].ToString()
             }));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(new HashSet <SchoolClass>());
     }
 }