Esempio n. 1
0
        public static void Apply(this ConfigurationBroker con, Broker broker)
        {
            logger.Debug("Trying to apply main configuration\r\n with datetime stamp: {0} {1}", con.CreationDate.ToLongDateString(), con.CreationDate.ToLongTimeString());

            for (int i = 0; i < con.Connections.Length; i++)
            {
                cConnection connection = con.Connections[i];
                if (connection.queueTypeName == null)
                {
                    logger.Error("Connection has not auto specific property, ignored: {0}", i);
                }
                else if (connection.QueueParameters == null)
                {
                    logger.Error("Connection parameters for queue: {0} is absent, this queue will be ignored", connection.Name);
                }
                else
                {
                    var qinterface = broker.QueueInterfaces.GetQueue(connection.queueTypeName);
                    QueueSpecificParameters parameters = qinterface.GetParametersModel();
                    parameters.SetHolder(connection.QueueParameters);
                    broker.RegisterConnection(connection.Name, qinterface, parameters);
                }
            }

            foreach (var channel in con.Channels)
            {
                try
                {
                    broker.RegisterChannel(channel.connectionName, channel.Name);
                }
                catch (Exception e)
                {
                    logger.Exception(e, "Channels configuration applying, ignored");
                }
            }
            for (int i = 0; i < con.Tasks.Length; i++)
            {
                var task = con.Tasks[i];
                if (task == null)
                {
                    logger.Error("Task has not auto specific property, ignored: {0}", i);
                }
                else if (!task.Auto)
                {
                    try
                    {
                        broker.RegisterTask(task.ChannelName, task.ModuleName, task.intervalType, task.intervalValue, task.parameters, task.Description);
                    }
                    catch (Exception e)
                    {
                        logger.Exception(e, "Tasks configuration applying, ignored");
                    }
                }
            }
        }
Esempio n. 2
0
                public cCommandPipeline(cCallbackSynchroniser pSynchroniser, Action <cTrace.cContext> pDisconnected, cBatchSizerConfiguration pNetworkWriteConfiguration, cIdleConfiguration pIdleConfiguration, cTrace.cContext pParentContext)
                {
                    var lContext = pParentContext.NewObject(nameof(cCommandPipeline), pIdleConfiguration);

                    mSynchroniser = pSynchroniser ?? throw new ArgumentNullException(nameof(pSynchroniser));
                    mDisconnected = pDisconnected ?? throw new ArgumentNullException(nameof(pDisconnected));
                    if (pNetworkWriteConfiguration == null)
                    {
                        throw new ArgumentNullException(nameof(pNetworkWriteConfiguration));
                    }
                    mConnection        = new cConnection(pNetworkWriteConfiguration);
                    mIdleConfiguration = pIdleConfiguration;

                    mResponseTextProcessor = new cResponseTextProcessor(pSynchroniser);

                    // these depend on the cancellationtokensource being constructed
                    mBackgroundReleaser = new cReleaser("commandpipeline_background", mBackgroundCancellationTokenSource.Token);
                    mBackgroundAwaiter  = new cAwaiter(mBackgroundCancellationTokenSource.Token);

                    mBackgroundSendBuffer = new cSendBuffer(pSynchroniser, mConnection, mBackgroundCancellationTokenSource.Token);

                    // plumbing
                    mIdleBlock.Released += mBackgroundReleaser.Release; // when the idle block is removed, kick the background process
                }
        //
        //  Page class constructor
        //
        public cUserLevels_view(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "view";
            m_PageObjName = "UserLevels_view";
            m_PageObjTypeName = "cUserLevels_view";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (UserLevels == null)
                UserLevels = new cUserLevels(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "UserLevels";
            m_Table = UserLevels;
            CurrentTable = UserLevels;

            //CurrentTableType = UserLevels.GetType();
            // Initialize URLs

            string KeyUrl = "";
            if (ew_NotEmpty(ew_Get("UserLevelID"))) {
                RecKey["UserLevelID"] = ew_Get("UserLevelID");
                KeyUrl += "&UserLevelID=" + ew_UrlEncode(RecKey["UserLevelID"]);
            }
            ExportPrintUrl = PageUrl + "export=print" + KeyUrl;
            ExportHtmlUrl = PageUrl + "export=html" + KeyUrl;
            ExportExcelUrl = PageUrl + "export=excel" + KeyUrl;
            ExportWordUrl = PageUrl + "export=word" + KeyUrl;
            ExportXmlUrl = PageUrl + "export=xml" + KeyUrl;
            ExportCsvUrl = PageUrl + "export=csv" + KeyUrl;
            ExportPdfUrl = PageUrl + "export=pdf" + KeyUrl;

            // Connect to database
            if (Conn == null)
                Conn = new cConnection();

            // Export options
            ExportOptions = new cListOptions();
            ExportOptions.Tag = "span";
            ExportOptions.Separator = "&nbsp;&nbsp;";
        }
        //
        //  Page class constructor
        //
        public cPersonas_add(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "add";
            m_PageObjName = "Personas_add";
            m_PageObjTypeName = "cPersonas_add";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Areas == null)
                Areas = new cAreas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (VehiculosAutorizados_grid == null)
                VehiculosAutorizados_grid = new cVehiculosAutorizados_grid(ParentPage);
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);

            // Table
            m_TableName = "Personas";
            m_Table = Personas;
            CurrentTable = Personas;

            //CurrentTableType = Personas.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        //  Page class constructor
        //
        public cUserLevels_edit(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "edit";
            m_PageObjName = "UserLevels_edit";
            m_PageObjTypeName = "cUserLevels_edit";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (UserLevels == null)
                UserLevels = new cUserLevels(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "UserLevels";
            m_Table = UserLevels;
            CurrentTable = UserLevels;

            //CurrentTableType = UserLevels.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        // Page main processing
        //
        public void Page_Main()
        {
            // Open connection to the database
            Conn = new cConnection();

            // Initialize table object
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (Security == null) Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel("VehiculosAutorizados");

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }
            if (!Security.CanList) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();
        }
        // Get values from database
        private void GetLookupValues(string Sql)
        {
            ArrayList RsArr;
            string str;

            // Connect to database
            Conn = new cConnection();
            try {
                RsArr = Conn.GetRows(Sql);
            }	finally {
                Conn.Dispose();
            }

            // Output
            foreach (OrderedDictionary Row in RsArr) {
                foreach (DictionaryEntry f in Row) {
                    str = Convert.ToString(f.Value);
                    str = RemoveDelimiters(str);
                    ew_Write(str + EW_FIELD_DELIMITER);
                }
                ew_Write(EW_RECORD_DELIMITER);
            }
        }
Esempio n. 8
0
 public cSendBuffer(cCallbackSynchroniser pSynchroniser, cConnection pConnection, CancellationToken pCancellationToken)
 {
     mSynchroniser      = pSynchroniser ?? throw new ArgumentNullException(nameof(pSynchroniser));
     mConnection        = pConnection ?? throw new ArgumentNullException(nameof(pConnection));
     mCancellationToken = pCancellationToken;
 }
Esempio n. 9
0
 // Execute SQL and return first value of first row
 public static object ew_ExecuteScalar(string Sql)
 {
     cConnection c = new cConnection();
     try {
         return c.ExecuteScalar(Sql);
     }	finally {
         c.Dispose();
     }
 }
Esempio n. 10
0
 // Execute SQL and return first row
 public static OrderedDictionary ew_ExecuteRow(string Sql)
 {
     SqlDataReader dr = null;
     cConnection c = new cConnection();
     try {
         dr = c.GetDataReader(Sql);
         if (dr != null && dr.Read()) {
             return c.GetRow(ref dr);
         } else {
             return null;
         }
     }	finally {
         if (dr != null) {
             dr.Close();
             dr.Dispose();
         }
         c.Dispose();
     }
 }
Esempio n. 11
0
 // Execute SQL
 public static int ew_Execute(string Sql)
 {
     cConnection c = new cConnection();
     try {
         return c.Execute(Sql);
     }	finally {
         c.Dispose();
     }
 }
        //
        //  Page class constructor
        //
        public cTiposDocumentos_delete(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "delete";
            m_PageObjName = "TiposDocumentos_delete";
            m_PageObjTypeName = "cTiposDocumentos_delete";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (TiposDocumentos == null)
                TiposDocumentos = new cTiposDocumentos(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "TiposDocumentos";
            m_Table = TiposDocumentos;
            CurrentTable = TiposDocumentos;

            //CurrentTableType = TiposDocumentos.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        //  Page class constructor
        //
        public cHistoricoVehiculos_list(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "list";
            m_PageObjName = "HistoricoVehiculos_list";
            m_PageObjTypeName = "cHistoricoVehiculos_list";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (HistoricoVehiculos == null)
                HistoricoVehiculos = new cHistoricoVehiculos(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "HistoricoVehiculos";
            m_Table = HistoricoVehiculos;
            CurrentTable = HistoricoVehiculos;

            //CurrentTableType = HistoricoVehiculos.GetType();
            // Initialize URLs

            ExportPrintUrl = PageUrl + "export=print";
            ExportExcelUrl = PageUrl + "export=excel";
            ExportWordUrl = PageUrl + "export=word";
            ExportHtmlUrl = PageUrl + "export=html";
            ExportXmlUrl = PageUrl + "export=xml";
            ExportCsvUrl = PageUrl + "export=csv";
            ExportPdfUrl = PageUrl + "export=pdf";
            AddUrl = "HistoricoVehiculosadd.aspx";
            InlineAddUrl = PageUrl + "a=add";
            GridAddUrl = PageUrl + "a=gridadd";
            GridEditUrl = PageUrl + "a=gridedit";
            MultiDeleteUrl = "HistoricoVehiculosdelete.aspx";
            MultiUpdateUrl = "HistoricoVehiculosupdate.aspx";

            // Connect to database
            if (Conn == null)
                Conn = new cConnection();

            // Initialize list options
            ListOptions = new cListOptions();

            // Export options
            ExportOptions = new cListOptions();
            ExportOptions.Tag = "span";
            ExportOptions.Separator = "&nbsp;&nbsp;";
        }
Esempio n. 14
0
        //
        //  Page class constructor
        //
        public clogin(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "login";
            m_PageObjName = "login";
            m_PageObjTypeName = "clogin";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        //  Page class constructor
        //
        public cVehiculosPicoYPlacaHoras_grid(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "grid";
            m_PageObjName = "VehiculosPicoYPlacaHoras_grid";
            m_PageObjTypeName = "cVehiculosPicoYPlacaHoras_grid";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (VehiculosPicoYPlacaHoras == null)
                VehiculosPicoYPlacaHoras = new cVehiculosPicoYPlacaHoras(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);

            // Table
            m_TableName = "VehiculosPicoYPlacaHoras";
            m_Table = VehiculosPicoYPlacaHoras;
            MasterTable = CurrentTable;

            //MasterTableType = CurrentTableType;
            CurrentTable = VehiculosPicoYPlacaHoras;

            //CurrentTableType = VehiculosPicoYPlacaHoras.GetType();
            VehiculosPicoYPlacaHoras.LoadDetailParms();
            if (ew_NotEmpty(ew_Get("confirmpage")))
                ConfirmPage = ew_ConvertToBool(ew_Get("confirmpage"));
            if (VehiculosPicoYPlacaHoras.CurrentMasterTable == "VehiculosAutorizados") {
                VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.FldIsDetailKey = true;
                if (ew_NotEmpty(ew_Get("IdVehiculoAutorizado"))) {
                    VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.CurrentValue = ew_Get("IdVehiculoAutorizado");
                    VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.SessionValue = VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.CurrentValue;
                }
            }

            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();

            // Initialize list options
            ListOptions = new cListOptions();
        }
        //
        //  Page class constructor
        //
        public cRegistrosVehiculos_add(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "add";
            m_PageObjName = "RegistrosVehiculos_add";
            m_PageObjTypeName = "cRegistrosVehiculos_add";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (RegistrosVehiculos == null)
                RegistrosVehiculos = new cRegistrosVehiculos(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "RegistrosVehiculos";
            m_Table = RegistrosVehiculos;
            CurrentTable = RegistrosVehiculos;

            //CurrentTableType = RegistrosVehiculos.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        //  Page class constructor
        //
        public cHistoricoVehiculos_search(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "search";
            m_PageObjName = "HistoricoVehiculos_search";
            m_PageObjTypeName = "cHistoricoVehiculos_search";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (HistoricoVehiculos == null)
                HistoricoVehiculos = new cHistoricoVehiculos(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "HistoricoVehiculos";
            m_Table = HistoricoVehiculos;
            CurrentTable = HistoricoVehiculos;

            //CurrentTableType = HistoricoVehiculos.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        //  Page class constructor
        //
        public cPersonas_grid(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "grid";
            m_PageObjName = "Personas_grid";
            m_PageObjTypeName = "cPersonas_grid";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Areas == null)
                Areas = new cAreas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "Personas";
            m_Table = Personas;
            MasterTable = CurrentTable;

            //MasterTableType = CurrentTableType;
            CurrentTable = Personas;

            //CurrentTableType = Personas.GetType();
            Personas.LoadDetailParms();
            if (ew_NotEmpty(ew_Get("confirmpage")))
                ConfirmPage = ew_ConvertToBool(ew_Get("confirmpage"));
            if (Personas.CurrentMasterTable == "Areas") {
                Personas.IdArea.FldIsDetailKey = true;
                if (ew_NotEmpty(ew_Get("IdArea"))) {
                    Personas.IdArea.CurrentValue = ew_Get("IdArea");
                    Personas.IdArea.SessionValue = Personas.IdArea.CurrentValue;
                }
            }

            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();

            // Initialize list options
            ListOptions = new cListOptions();
        }