protected static FR_L5AWSSC_CUPfSCBO_1414 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AWSSC_CUPfSCBO_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5AWSSC_CUPfSCBO_1414(); returnValue.Result = new L5AWSSC_CUPfSCBO_1414(); // Get shopping cart var shoppingCart = new CL1_ORD_PRC.ORM_ORD_PRC_ShoppingCart(); shoppingCart.Load(Connection, Transaction, Parameter.ORD_PRC_ShoppingCartID); // Check does current user has a privilege to order ABDA articles var flrParam = new CL2_FunctionLevelRight.Complex.Retrieval.P_L2FLR_GFLRfABoIoG_1554(); flrParam.AccountFunctionLevelRightGroup = new string[1] { DLCore_DBCommons.Utils.EnumUtils.GetEnumDescription(EAccountFunctionLevelRightGroup.APOWebShop) }; var levels = CL2_FunctionLevelRight.Complex.Retrieval.cls_Get_FunctionalLevelRight_for_Account_Based_on_Individuals_or_Groups.Invoke(Connection, Transaction, flrParam, securityTicket); EAccountFunctionLevelRight maxLevel = EAccountFunctionLevelRight.APOWebShopLevel1; foreach (var str in levels.Result) { EAccountFunctionLevelRight l = (EAccountFunctionLevelRight)DLCore_DBCommons.Utils.EnumUtils.GetEnumValueByDescription(str.RightLevel, typeof(EAccountFunctionLevelRight)); if ((int)l > (int)maxLevel) { maxLevel = l; } } switch (maxLevel) { case EAccountFunctionLevelRight.APOWebShopLevel1: returnValue.Result.HasPrivileges = false; returnValue.Result.CreateApprovalShoppingCart = true; break; case EAccountFunctionLevelRight.APOWebShopLevel2: returnValue.Result.HasPrivileges = true; returnValue.Result.CreateApprovalShoppingCart = true; break; case EAccountFunctionLevelRight.APOWebShopLevel3: returnValue.Result.HasPrivileges = true; break; } return(returnValue); #endregion UserCode }
///<summary> /// Ivokes the method with the given Connection, leaving it open if no exceptions occured ///<summary> public static FR_L5AWSSC_CUPfSCBO_1414 Invoke(DbConnection Connection, P_L5AWSSC_CUPfSCBO_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, null, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5AWSSC_CUPfSCBO_1414 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AWSSC_CUPfSCBO_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5AWSSC_CUPfSCBO_1414 functionReturn = new FR_L5AWSSC_CUPfSCBO_1414(); 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_Check_User_Permissions_for_ShoppingCart_Before_Order", ex); } return(functionReturn); }