Beispiel #1
0
        protected static FR_L2FLR_GFLRfABoIoG_1554_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L2FLR_GFLRfABoIoG_1554 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L2FLR_GFLRfABoIoG_1554_Array();

            var rights = new List <L2FLR_GFLRfABoIoG_1554>();
            foreach (var rightGroup in Parameter.AccountFunctionLevelRightGroup)
            {
                var individualParam = new CL2_FunctionLevelRight.Atomic.Retrieval.P_L5FLR_GFLRfABoIR_1216();
                individualParam.AccountFunctionLevelRightGroup = rightGroup;
                var individualRights = CL2_FunctionLevelRight.Atomic.Retrieval.cls_Get_FunctionalLevelRights_for_Account_Based_on_IndividualRelation.Invoke(Connection, Transaction, individualParam, securityTicket).Result;

                foreach (var ir in individualRights)
                {
                    var right = new L2FLR_GFLRfABoIoG_1554();
                    right.AccountID = ir.USR_AccountID;
                    right.USR_Account_FunctionLevelRightID = ir.USR_Account_FunctionLevelRightID;
                    right.RightLevel = ir.RightLevel;
                    rights.Add(right);
                }

                var groupParam = new CL2_FunctionLevelRight.Atomic.Retrieval.P_L2FLR_GFLRfABoAG_1206();
                groupParam.AccountFunctionLevelRightGroup = rightGroup;
                var groupRights =
                    CL2_FunctionLevelRight.Atomic.Retrieval
                    .cls_Get_FunctionLevelRight_for_Account_Based_on_AccountGroup.Invoke(Connection, Transaction,
                                                                                         groupParam, securityTicket).Result;

                foreach (var gr in groupRights)
                {
                    var right = new L2FLR_GFLRfABoIoG_1554();
                    right.AccountID = gr.USR_AccountID;
                    right.USR_Account_FunctionLevelRightID = gr.USR_Account_FunctionLevelRightID;
                    right.RightLevel = gr.RightLevel;
                    if (
                        !rights.Any(
                            x => x.USR_Account_FunctionLevelRightID == right.USR_Account_FunctionLevelRightID))
                    {
                        rights.Add(right);
                    }
                }
            }

            returnValue.Result = rights.ToArray();
            return(returnValue);

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

            FR_L2FLR_GFLRfABoIoG_1554_Array functionReturn = new FR_L2FLR_GFLRfABoIoG_1554_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_FunctionalLevelRight_for_Account_Based_on_Individuals_or_Groups", ex);
            }
            return(functionReturn);
        }