Пример #1
0
 public bool DeleteProtectedData(ProtectedDataObject protectedData)
 {
     try
     {
         Config.Conn.Execute("DELETE FROM dat_ProtectedData WHERE ProtectedDataId = @ProtectedDataId", protectedData);
     }
     catch (Exception ex)
     {
         ErrorLogObject.LogError("ProtectedDataObject::DeleteProtectedData", ex);
         return(false);
     }
     return(true);
 }
Пример #2
0
 public ProtectedDataObject SaveProtectedData(ProtectedDataObject protectedData)
 {
     if (protectedData.ProtectedDataId.HasValue) // Update
     {
         string sql = @"
             UPDATE  dat_ProtectedData
             SET     SortMainId = @SortMainId,
                     Crada = @Crada,
                     Description = @Description,
                     ReleaseDate = @ReleaseDate,
                     ExemptNumber = @ExemptNumber
             WHERE   ProtectedDataId = @ProtectedDataId";
         Config.Conn.Execute(sql, protectedData);
     }
     else
     {
         string sql = @"
             INSERT INTO dat_ProtectedData (
                 SortMainId,
                 Crada,
                 Description,
                 ReleaseDate,
                 ExemptNumber
             )
             VALUES (
                 @SortMainId,
                 @Crada,
                 @Description,
                 @ReleaseDate,
                 @ExemptNumber
             )
             SELECT CAST(SCOPE_IDENTITY() AS INT)";
         protectedData.ProtectedDataId = Config.Conn.Query <int>(sql, protectedData).Single();
     }
     return(protectedData);
 }