public static bool AddPrivateLawyerInfoList(List <ATTPrivateLawyer> lst) { string SP = ""; double PID = 213; GetConnection DBConn = new GetConnection(); OracleConnection Conn = DBConn.GetDbConn(Module.LJMS); OracleTransaction Tran = Conn.BeginTransaction(); List <OracleParameter> paramArray = new List <OracleParameter>(); try { foreach (ATTPrivateLawyer lawyer in lst) { if (lawyer.Action == "A") { SP = "SP_ADD_P_LAWYER_INFO"; } else if (lawyer.Action == "E") { SP = "SP_EDIT_P_LAWYER_INFO"; } else if (lawyer.Action == "D") { SP = ""; } paramArray.Add(Utilities.GetOraParam("P_P_ID", PID, OracleDbType.Double, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_LAWYER_TYPE_ID", lawyer.LawyerTypeID, OracleDbType.Int16, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_LICENSE_NO", lawyer.Lisence, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_UNIT_ID", lawyer.UnitID, OracleDbType.Int16, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_FROM_DATE", lawyer.FromDate, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_TO_DATE", lawyer.ToDate, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_ENTRY_BY", lawyer.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input)); SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, SP, paramArray.ToArray()); paramArray.Clear(); DLLPrivateLawyerRenewal.AddPrivateLawyerReenwalList(lawyer.LstRenewal, Tran, PID); } Tran.Commit(); return(true); } catch (Exception ex) { Tran.Rollback(); throw ex; } finally { DBConn.CloseDbConn(); } }
public static bool AddPrivateLawyerInfoList(List <ATTPrivateLawyer> lst, OracleTransaction Tran, double PID) { string SP = ""; List <OracleParameter> paramArray = new List <OracleParameter>(); try { foreach (ATTPrivateLawyer lawyer in lst) { if (lawyer.Action == "A") { SP = "SP_ADD_P_LAWYER_INFO"; } else if (lawyer.Action == "E") { SP = "SP_EDIT_P_LAWYER_INFO"; } else if (lawyer.Action == "D") { SP = ""; } if (SP != "") { paramArray.Add(Utilities.GetOraParam("P_P_ID", PID, OracleDbType.Double, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_LAWYER_TYPE_ID", lawyer.LawyerTypeID, OracleDbType.Int16, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_LICENSE_NO", lawyer.Lisence, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_UNIT_ID", lawyer.UnitID, OracleDbType.Int16, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_FROM_DATE", lawyer.FromDate, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_TO_DATE", lawyer.ToDate, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam("P_ENTRY_BY", lawyer.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input)); SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, SP, paramArray.ToArray()); SP = ""; } paramArray.Clear(); if (lawyer.LstRenewal.Count > 0) { if (DLLPrivateLawyerRenewal.AddPrivateLawyerReenwalList(lawyer.LstRenewal, Tran, PID) == false) { return(false); } } } return(true); } catch (Exception ex) { throw ex; } }