Exemple #1
0
 /// <summary>
 /// 荷主マスタを削除します。
 /// </summary>
 /// <param name="ninushi">荷主マスタ</param>
 /// <returns>登録処理の結果</returns>
 public static RegistrationResult Delete(ModelNinushi ninushi)
 {
     var registration = new RegistrationResult();
     using (var conn = Db.OpenConnection())
     {
         var tran = conn.BeginTransaction();
         try
         {
             registration.AffectedRows = conn.Execute(SqlDelete, ninushi, tran);
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             registration.SetError(ex.Message, ex);
         }
     }
     return registration;
 }
Exemple #2
0
 /// <summary>
 /// 荷主マスタを登録します。
 /// </summary>
 /// <param name="ninushi">荷主コード</param>
 /// <returns>登録処理の結果</returns>
 public static RegistrationResult Save(ModelNinushi ninushi)
 {
     var registration = new RegistrationResult();
     using (var conn = Db.OpenConnection())
     {
         var tran = conn.BeginTransaction();
         try
         {
             var beforeNinushi = Load(ninushi.NinushiCd);
             if (beforeNinushi == null)
             {
                 registration.AffectedRows = conn.Execute(SqlInsert, ninushi, tran);
             }
             else
             {
                 registration.AffectedRows = conn.Execute(SqlUpdate, ninushi, tran);
             }
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             registration.SetError(ex.Message, ex);
         }
     }
     return registration;
 }