예제 #1
0
 public static bool UpdatePeroid(OkresZatrudnienia updatedPeroid)
 {
     using (IDbConnection myDBconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["EWUDatabase"].ConnectionString))
     {
         if (myDBconnection.State == ConnectionState.Closed)
         {
             myDBconnection.Open();
         }
         var result = myDBconnection.Execute(@"UPDATE ewu.okres_zatrudnienia 
                                             SET 
                                             IDpracownika = @IDemployee,
                                             IDstanowiska = @Position, 
                                             IDwymiar = @DayJob, 
                                             staz_pracy = @DayJob,
                                             zatrudniony_od = @Since,
                                             zatrudniony_do = @ToDate
                                             WHERE IDzatrudnienia = @IDper",
                                             new
         {
             IDemployee = updatedPeroid.IDpracownika,
             IDper      = updatedPeroid.IDzatrudnienia,
             Position   = updatedPeroid.IDstanowiska,
             DayJob     = updatedPeroid.IDwymiar,
             Practice   = updatedPeroid.staz_pracy,
             Since      = updatedPeroid.zatrudniony_od,
             ToDate     = updatedPeroid.zatrudniony_do
         });
         return(result == 1);
     }
 }
예제 #2
0
 public static bool InsertPeroid(OkresZatrudnienia newPeroid)
 {
     using (IDbConnection myDBconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["EWUDatabase"].ConnectionString))
     {
         if (myDBconnection.State == ConnectionState.Closed)
         {
             myDBconnection.Open();
         }
         var result = myDBconnection.Execute(@"INSERT INTO ewu.okres_zatrudnienia 
                                             (IDpracownika, IDstanowiska, IDwymiar, staz_pracy, zatrudniony_od, zatrudniony_do) 
                                             VALUES (@IDemp, @Position, @DayJob, @Practice ,@Since, @ToDate)",
                                             new
         {
             IDemp    = newPeroid.IDpracownika,
             Position = newPeroid.IDstanowiska,
             DayJob   = newPeroid.IDwymiar,
             Practice = newPeroid.staz_pracy,
             Since    = newPeroid.zatrudniony_od,
             ToDate   = newPeroid.zatrudniony_do
         });
         return(result == 1);
     }
 }