/// <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; }
/// <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; }
/// <summary> /// 会社基本情報を登録します。 /// </summary> /// <param name="kaisha">会社基本情報</param> /// <returns>登録処理の結果</returns> public static RegistrationResult Save(ModelKaisha kaisha) { var registraion = new RegistrationResult(); using (var conn = Db.OpenConnection()) { var tran = conn.BeginTransaction(); try { var beforeKaisha = Get(); if (beforeKaisha == null) { registraion.AffectedRows = conn.Execute(SqlInsertKaisha, kaisha, transaction: tran); } else { registraion.AffectedRows = conn.Execute(SqlUpdateKaisha, kaisha, transaction: tran); } tran.Commit(); } catch (Exception ex) { tran.Rollback(); registraion.SetError(ex.Message, ex); } } return registraion; }