Esempio n. 1
0
        protected static FR_L3BA_GBAPfBP_1535 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L3BA_GBAPfBP_1535();
            //Put your code here
            var result = new L3BA_GBAPfBP_1535();

            var tenantBP = CL1_CMN_BPT.ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction,
                                                                                    new CL1_CMN_BPT.ORM_CMN_BPT_BusinessParticipant.Query
            {
                IsTenant = true,
                IfTenant_Tenant_RefID = securityTicket.TenantID,
                Tenant_RefID          = securityTicket.TenantID
            }).Single().CMN_BPT_BusinessParticipantID;

            Guid currentFiscalYearID = CL2_FiscalYear.Complex.Retrieval.cls_Get_Current_FiscalYear.Invoke(Connection, Transaction, securityTicket).Result.ACC_FiscalYearID;

            // bookingtypsAssignment
            var bookingAccountAssignmentParam = new CL3_BookingAccounts.Atomic.Retrieval.P_L3BA_GBAPBPAfBP_1717
            {
                FiscalYearID = currentFiscalYearID,
                BusinessParticipantID_List = new Guid[] { tenantBP }
            };


            var res_BookingAccountAssignment = CL3_BookingAccounts.Atomic.Retrieval.cls_Get_BookingAccount_Purpose_BPAssignment_for_BPID_List.Invoke(
                Connection, Transaction, bookingAccountAssignmentParam, securityTicket).Result;

            // bookingAccounts

            var bookingAccountParam = new CL3_BookingAccounts.Atomic.Retrieval.P_L3BA_GBAfTaFYI_0930
            {
                FiscalYearID = currentFiscalYearID
            };

            var res_BookingAccounts = CL3_BookingAccounts.Atomic.Retrieval.cls_Get_BookingAccounts_for_TenantID_and_FiscalYearID.Invoke(
                Connection, Transaction, bookingAccountParam, securityTicket).Result;


            result.BookingAccountsAssignment = new L3BA_GBAPBPAfBP_1717[res_BookingAccountAssignment.Count()];
            result.BookingAccountsAssignment = res_BookingAccountAssignment;

            result.BookingAccounts = new L3BA_GBAfTaFYI_0930[res_BookingAccounts.Count()];
            result.BookingAccounts = res_BookingAccounts;

            result.BusinessParticipantID = tenantBP;

            returnValue.Result = result;
            return(returnValue);

            #endregion UserCode
        }
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L3BA_GBAfTaFYI_0930_Array Invoke(string ConnectionString, P_L3BA_GBAfTaFYI_0930 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
        protected static FR_L3BA_GBAfTaFYI_0930_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3BA_GBAfTaFYI_0930 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L3BA_GBAfTaFYI_0930_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_BookingAccounts.Atomic.Retrieval.SQL.cls_Get_BookingAccounts_for_TenantID_and_FiscalYearID.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "FiscalYearID", Parameter.FiscalYearID);



            List <L3BA_GBAfTaFYI_0930> results = new List <L3BA_GBAfTaFYI_0930>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "BookingAccountName", "ACC_BOK_BookingAccountID", "BookingAccountNumber", "FiscalYearName", "Tenant_RefID", "ACC_FiscalYearID", "StartDate", "EndDate", "IsDeleted" });
                while (reader.Read())
                {
                    L3BA_GBAfTaFYI_0930 resultItem = new L3BA_GBAfTaFYI_0930();
                    //0:Parameter BookingAccountName of type String
                    resultItem.BookingAccountName = reader.GetString(0);
                    //1:Parameter ACC_BOK_BookingAccountID of type Guid
                    resultItem.ACC_BOK_BookingAccountID = reader.GetGuid(1);
                    //2:Parameter BookingAccountNumber of type String
                    resultItem.BookingAccountNumber = reader.GetString(2);
                    //3:Parameter FiscalYearName of type String
                    resultItem.FiscalYearName = reader.GetString(3);
                    //4:Parameter Tenant_RefID of type Guid
                    resultItem.Tenant_RefID = reader.GetGuid(4);
                    //5:Parameter ACC_FiscalYearID of type Guid
                    resultItem.ACC_FiscalYearID = reader.GetGuid(5);
                    //6:Parameter StartDate of type DateTime
                    resultItem.StartDate = reader.GetDate(6);
                    //7:Parameter EndDate of type DateTime
                    resultItem.EndDate = reader.GetDate(7);
                    //8:Parameter IsDeleted of type bool
                    resultItem.IsDeleted = reader.GetBoolean(8);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_BookingAccounts_for_TenantID_and_FiscalYearID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L3BA_GBAfTaFYI_0930_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3BA_GBAfTaFYI_0930 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L3BA_GBAfTaFYI_0930_Array functionReturn = new FR_L3BA_GBAfTaFYI_0930_Array();

            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_Get_BookingAccounts_for_TenantID_and_FiscalYearID", ex);
            }
            return(functionReturn);
        }
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L3BA_GBAfTaFYI_0930_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L3BA_GBAfTaFYI_0930 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }