Exemplo n.º 1
0
 int AddSubjectScheme()
 {
     try
     {
         var sqlParamWithValue = new HashSet <IDictionary <string, object> >();
         foreach (SchoolClass S in olvKlasa.FilteredObjects)
         {
             sqlParamWithValue.Add(new Dictionary <string, object>()
             {
                 { "@IdSzkola", UserSession.User.Settings.SchoolID },
                 { "@KodKlasy", S.ClassCode },
                 { "@RokSzkolny", UserSession.User.Settings.SchoolYear },
                 { "@NazwaKlasy", S.ClassName },
                 { "@IsVirtual", S.IsVirtual },
                 { "@Owner", UserSession.User.Login },
                 { "@User", UserSession.User.Login },
                 { "@IP", AppSession.HostIP }
             });
         }
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(dbs.AddManyRecordsAsync(SchoolClassSQL.InsertSchoolClass(), sqlParamWithValue).Result.RecordCount);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(-1);
     }
 }
Exemplo n.º 2
0
 async Task <long> AddSchoolClass()
 {
     try
     {
         using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
         {
             var dbs = scope.Resolve <IDataBaseService>();
             return(await dbs.AddRecordAsync(SchoolClassSQL.InsertSchoolClass(), CreateInsertParams()));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }