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

            FR_L6DI_GAPwPC_1329 functionReturn = new FR_L6DI_GAPwPC_1329();

            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_AllProcedures_with_ProceduresCount", ex);
            }
            return(functionReturn);
        }
Exemplo n.º 2
0
        protected static FR_L6DI_GAPwPC_1329 Execute(DbConnection Connection, DbTransaction Transaction, P_L6DI_GAPwPC_1329 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L6DI_GAPwPC_1329();

            returnValue.Result = new L6DI_GAPwPC_1329();
            List <L5DIGAPfTID_1318> procedureList = new List <L5DIGAPfTID_1318>();
            returnValue.Result.Procedures       = procedureList.ToArray();
            returnValue.Result.CurrentPage      = 1;
            returnValue.Result.NumberOfPages    = 1;
            returnValue.Result.NumberOfElements = 0;

            /*@
             *
             * Get procedures
             * ************************************/
            P_L5DIGAPfTID_1318 par = new P_L5DIGAPfTID_1318();
            if (Parameter.IsASC_Order == false)
            {
                par.OrderBy = "DESC";
            }
            else
            {
                par.OrderBy = "ASC";
            }
            par.OrderValue       = Parameter.OrderValue;
            par.StartIndex       = (Parameter.PageClicked - 1) * Parameter.NumberOfElementsPerPage;
            par.NumberOfElements = Parameter.NumberOfElementsPerPage;

            String searchCriterium = "";

            if (Parameter.Search_Param != null && Parameter.Search_Param != "")
            {
                searchCriterium = " AND LOWER( hec_tre_potentialprocedure_catalogcodes.Code ) LIKE '%" + Parameter.Search_Param.ToLower() + "%' OR " +
                                  " Lower(hec_tre_potentialprocedures_de.Content) Like '%" + Parameter.Search_Param.ToLower() + "%'";
            }

            par.SearchCriterium           = searchCriterium;
            par.CatalogID                 = Parameter.CatalogID;
            par.LanguageID                = Parameter.LanguageID;
            returnValue.Result.Procedures = cls_Get_AllProcedures_for_TenantID.Invoke(Connection, Transaction, par, securityTicket).Result;

            /*@
             *
             * Get procedures number
             * ************************************/
            P_L5DIGCoAP_1355 parameter = new P_L5DIGCoAP_1355();
            parameter.SearchCriterium = searchCriterium;
            parameter.CatalogID       = Parameter.CatalogID;

            var value            = cls_Get_Count_Of_AllProcedures.Invoke(Connection, Transaction, parameter, securityTicket).Result.FirstOrDefault();
            int numberOfElements = 0;
            if (value != null)
            {
                numberOfElements = value.NumberOfElements;
                returnValue.Result.NumberOfElements = value.NumberOfElements;
            }
            else
            {
                returnValue.Result.NumberOfElements = 0;
            }
            int pageCount = (numberOfElements + Parameter.NumberOfElementsPerPage - 1) / Parameter.NumberOfElementsPerPage;
            returnValue.Result.NumberOfPages = pageCount;
            returnValue.Result.CurrentPage   = Parameter.PageClicked;

            return(returnValue);

            #endregion UserCode
        }