示例#1
0
        protected static FR_L5AR_GPDfABI_1633 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_GPDfABI_1633 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5AR_GPDfABI_1633();
            #region cls_Get_Taxes_for_CountryISOCode_and_TenantID

            var defaultCountryISOCode = CL2_Country.Atomic.Retrieval.cls_Get_DefaultCountryISOCode_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;

            var param = new P_L3TX_GTfCICaT_1359();
            param.CountryISOCode = defaultCountryISOCode.Country_639_1_ISOCode;

            var taxes = cls_Get_Taxes_for_CountryISOCode_and_TenantID.Invoke(Connection, Transaction, param, securityTicket).Result;
            if (taxes.Count() != 0)
            {
                returnValue.Result.Taxes = taxes;
            }

            #endregion

            #region cls_Get_all_Unit_for_Tenant

            var units = cls_Get_all_Unit_for_Tenant.Invoke(Connection, Transaction, securityTicket).Result;
            if (units.Count() != 0)
            {
                returnValue.Result.Units = units;
            }

            #endregion



            #region cls_Get_All_ArticleGroups_and_ArticleCount_for_TenantID

            var articleGroups = cls_Get_All_ProductGroups_and_ProductCount_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;

            if (Parameter.ExcludeAbdaGroup)
            {
                var list = articleGroups.ToList();

                var group = list.SingleOrDefault(x => x.GlobalPropertyMatchingID == DLCore_DBCommons.Utils.EnumUtils.GetEnumDescription(DLCore_DBCommons.APODemand.EProductGroup.ABDA));
                if (group != null)
                {
                    list.Remove(group);
                    articleGroups = list.ToArray();
                }
            }
            if (articleGroups.Count() != 0)
            {
                returnValue.Result.ArticleGroups = articleGroups;
            }

            #endregion

            #region cls_Get_AllProductTypes_for_TenantID

            var productTypes = cls_Get_AllProductTypes_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            returnValue.Result.ProductTypes = productTypes;

            #endregion

            if (Parameter.ArticleID != Guid.Empty)
            {
                #region Selected_and_all_article_groups

                var groupQuery = new ORM_CMN_PRO_Product_2_ProductGroup.Query();
                groupQuery.CMN_PRO_Product_RefID = Parameter.ArticleID;
                var groupsORM = ORM_CMN_PRO_Product_2_ProductGroup.Query.Search(Connection, Transaction, groupQuery);

                List <Guid> selectedGroups = new List <Guid>();

                foreach (var group in groupsORM)
                {
                    if (group.IsDeleted == false)
                    {
                        selectedGroups.Add(group.CMN_PRO_ProductGroup_RefID);
                    }
                }
                if (selectedGroups.Count() != 0)
                {
                    returnValue.Result.SelectedArticleGroups = selectedGroups.ToArray();
                }

                #endregion
            }
            return(returnValue);

            #endregion UserCode
        }
示例#2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5AR_GPDfABI_1633 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5AR_GPDfABI_1633 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
示例#3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5AR_GPDfABI_1633 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AR_GPDfABI_1633 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5AR_GPDfABI_1633 functionReturn = new FR_L5AR_GPDfABI_1633();

            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_PreloadingData_for_ArticleBasicInfo", ex);
            }
            return(functionReturn);
        }
示例#4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5AR_GPDfABI_1633 Invoke(string ConnectionString, P_L5AR_GPDfABI_1633 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }