Пример #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5BK_SB_1320 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            var item = new ORM_ACC_BNK_Bank();
            if (Parameter.ACC_BNK_BankID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.ACC_BNK_BankID);
                if (result.Status != FR_Status.Success || item.ACC_BNK_BankID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            item.BankName   = Parameter.BankName;
            item.BankNumber = Parameter.BankNubmer;
            item.BICCode    = Parameter.BICCode;

            item.RoutingNumber       = Parameter.RoutingNumber;
            item.Tenant_RefID        = securityTicket.TenantID;
            item.BankLocationComment = Parameter.BankLocationComment;

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISOCode_Alpha2;
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;

            List <ORM_CMN_Country> countries = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery);
            if (countries.Count != 0)
            {
                item.Country_RefID = countries[0].CMN_CountryID;
            }

            item.Save(Connection, Transaction);

            returnValue.Result = item.ACC_BNK_BankID;
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
Пример #2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, P_L5BK_SB_1320 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
Пример #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5BK_SB_1320 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Save_Bank", ex);
            }
            return(functionReturn);
        }