Ejemplo n.º 1
0
 public bool DeleteOpenNet(OpenNetObject openNet)
 {
     try
     {
         Config.Conn.Execute("DELETE FROM dat_OpenNet WHERE OpenNetId = @OpenNetId", openNet);
     }
     catch (Exception ex)
     {
         ErrorLogObject.LogError("OpenNetObject::DeleteOpenNet", ex);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public OpenNetObject SaveOpenNet(OpenNetObject openNet)
 {
     if (openNet.OpenNetId.HasValue) // Update
     {
         string sql = @"
             UPDATE  dat_OpenNet
             SET     SortMainId = @SortMainId,
                     AccessNumber = @AccessNumber,
                     DocLocation = @DocLocation,
                     FieldOfficeAym = @FieldOfficeAym,
                     DeclassificationStatus = @DeclassificationStatus,
                     DeclassificationDate = @DeclassificationDate,
                     KeyWords = @KeyWords
             WHERE   OpenNetId = @OpenNetId";
         Config.Conn.Execute(sql, openNet);
     }
     else
     {
         string sql = @"
             INSERT INTO dat_OpenNet (
                 SortMainId,
                 AccessNumber,
                 DocLocation,
                 FieldOfficeAym,
                 DeclassificationStatus,
                 DeclassificationDate,
                 KeyWords
             )
             VALUES (
                 @SortMainId,
                 @AccessNumber,
                 @DocLocation,
                 @FieldOfficeAym,
                 @DeclassificationStatus,
                 @DeclassificationDate,
                 @KeyWords
             )
             SELECT CAST(SCOPE_IDENTITY() AS INT)";
         openNet.OpenNetId = Config.Conn.Query <int>(sql, openNet).Single();
     }
     return(openNet);
 }