Exemplo n.º 1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5AR_GPDfABI_1110 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AR_GABIfAID_0950 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5AR_GPDfABI_1110 functionReturn = new FR_L5AR_GPDfABI_1110();

            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);
        }
Exemplo n.º 2
0
        protected static FR_L5AR_GPDfABI_1110 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_GABIfAID_0950 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode

            //Put your code here

            var returnValue = new FR_L5AR_GPDfABI_1110();
            returnValue.Result = new L5AR_GPDfABI_1110();

            #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;
            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;
            returnValue.Result.Units = units;

            #endregion

            #region cls_Get_AllDosageFroms_for_TenantID

            var dosageForms = cls_Get_AllDosageFroms_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            returnValue.Result.DosageForms = dosageForms;

            #endregion

            #region cls_Get_All_ArticleGroups_and_ArticleCount_for_TenantID

            var articleGroups = cls_Get_All_ArticleGroups_and_ArticleCount_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();
                }
            }

            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 cls_Get_ArticleBasicInfo_for_ArticleID

                CL5_APOAdmin_Articles.Atomic.Retrieval.P_L5AR_GABIfAID_0950 articleBasicInfoParam = new Atomic.Retrieval.P_L5AR_GABIfAID_0950();
                articleBasicInfoParam.ArticleID = Parameter.ArticleID;

                var articleBasicInfo = cls_Get_ArticleBasicInfo_for_ArticleID.Invoke(Connection, Transaction, articleBasicInfoParam, securityTicket).Result;
                returnValue.Result.BasicArticleData = articleBasicInfo;

                #endregion

                #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);
                    }
                }

                returnValue.Result.SelectedArticleGroups = selectedGroups.ToArray();

                #endregion
            }

            return(returnValue);

            #endregion UserCode
        }