Exemplo n.º 1
0
        public bool GetAppSetting(string name, bool defaultvalue)
        {
            bool   result  = defaultvalue;
            object enabled = ConfigurationManager.AppSettings[name];

            if (enabled != null)
            {
                if (!bool.TryParse(enabled.ToString(), out result))
                {
                    EventLogManager.WriteEntry(string.Format("Configuration setting {0}=\"{1}\" is invalid.", name, enabled.ToString()),
                                               EventLogEntryType.Warning);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public void RevokeCertificate(X509Certificate2 cert)
        {
            if (cert == null)
            {
                throw new ArgumentNullException("cert", "Certificate cannot be null");
            }

            message  = String.Format("Client {0}  with certificate[Subject {1}] has been revoked.Revocation list updated.", (Thread.CurrentPrincipal.Identity as WindowsIdentity).Name, cert.Subject);
            evntType = EventLogEntryType.SuccessAudit;
            EventLogManager.WriteEntryCMS(message, evntType, Convert.ToInt32(IDType.RevokeSuccess));

            AddToRevocationList(cert);
            DeleteLocalCertificate(cert);
            NotifyAllClients(cert);
        }
Exemplo n.º 3
0
        private void UpdateFailure(MimeDSNRecipient r)
        {
            ISession session = SnCore.Data.Hibernate.Session.Factory.OpenSession();

            try
            {
                EventLogManager.WriteEntry(string.Format("Searching for {0}.", r.FinalRecipientEmailAddress));
                UpdateFailureEmails(r, session);
                UpdateFailureInvitations(r, session);
            }
            finally
            {
                session.Close();
            }
        }
Exemplo n.º 4
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            base.OnActionExecuting(actionContext);

            bool   authenticated = false;
            string message       = "Access denied.";

            string apiKey = null;

            try
            {
                // Is there an api key header present?
                if (actionContext.Request.Headers.Contains("x-api-key"))
                {
                    // Get the api key from the header.
                    apiKey = actionContext.Request.Headers.GetValues("x-api-key").FirstOrDefault();

                    // Make sure it's not null and it's 32 characters or we're wasting our time.
                    if (apiKey != null && apiKey.Length == 32)
                    {
                        // Attempt to look up the api user.
                        APIUser apiUser = APIUserManager.GetByAPIKey(apiKey);

                        // Did we find one and double check the api key.
                        if (apiUser != null && apiUser.APIKey == apiKey)
                        {
                            // Genuine API user.
                            authenticated = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // Set appropriate message.
                message = "An error occurred while trying to authenticate this request.";

                EventLogManager.Log("AUTH_EXCEPTION", EventLogSeverity.Info, null, ex);
            }

            // If authentication failure occurs, return a response without carrying on executing actions.
            if (!authenticated)
            {
                EventLogManager.Log("AUTH_BAD_APIKEY", EventLogSeverity.Warning, string.Format("Authentication failed for API key: {0}.", apiKey));

                actionContext.Response = actionContext.Request.CreateErrorResponse(HttpStatusCode.Forbidden, message);
            }
        }
Exemplo n.º 5
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            base.OnActionExecuting(actionContext);

            bool   authenticated = false;
            string message       = "Access denied.";

            string apiKey = null;

            try
            {
                apiKey = actionContext.Request.GetApiKey();

                EventLogManager.Log("api-key is", EventLogSeverity.Info, apiKey);

                // Make sure it's not null and it's 32 characters or we're wasting our time.
                if (apiKey != null && apiKey.Length == 32)
                {
                    EventLogManager.Log("Find APIUSER using key", EventLogSeverity.Info, apiKey);
                    // Attempt to look up the api user.
                    APIUser apiUser = APIUserManager.FindAndPrepare(apiKey);

                    EventLogManager.Log("APIUSER.prepared ", EventLogSeverity.Info, apiUser.Prepared.ToString());
                    // Did we find one and is it ready to use?
                    if (apiUser != null && apiUser.Prepared)
                    {
                        EventLogManager.Log("Authenticated URI: ", EventLogSeverity.Info, "True: " + actionContext.Request.RequestUri);
                        // Genuine API user.
                        authenticated = true;
                    }
                }
            }
            catch (Exception ex)
            {
                // Set appropriate message.
                message = "An error occurred while trying to authenticate this request.";

                EventLogManager.Log("AUTH_EXCEPTION", EventLogSeverity.Info, null, ex);
            }

            // If authentication failure occurs, return a response without carrying on executing actions.
            if (!authenticated)
            {
                EventLogManager.Log("AUTH_BAD_APIKEY", EventLogSeverity.Warning, string.Format("Authentication failed for API key: {0}.", apiKey));

                actionContext.Response = actionContext.Request.CreateErrorResponse(HttpStatusCode.Forbidden, message);
            }
        }
Exemplo n.º 6
0
        private void OnProductionNotAvailable()
        {
            PlayerResources.OnResourceChanged += CheckIfNecessaryInputResourcesAreAvailable;
            //PlayerResources.OnMoneyChanged += (x) => CheckIfNecessaryInputResourcesAreAvailable();
            enabled = false;
            ToggleBuildingEffects(false);
            if (OnNotEnoughInputResourcesAvailable != null)
            {
                OnNotEnoughInputResourcesAvailable(this);
            }

            int missingID;

            PlayerResources.Instance.HasResourcesAmount(data.Resourceinput, data.Resourceinputamount, out missingID);
            EventLogManager.AddNewResourceUnavailableLog(this, missingID);
        }
Exemplo n.º 7
0
        public async Task <HttpResponseMessage> AddPackages(string sessionGuid)
        {
            if (!SessionManager.SessionExists(sessionGuid))
            {
                // Session doesn't exist.
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid session."));
            }

            try
            {
                // Does the request contain multipart/form-data?
                if (!Request.Content.IsMimeMultipartContent())
                {
                    throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
                }

                // Get the api key from the header.
                string apiKey = Request.Headers.GetValues("x-api-key").FirstOrDefault();

                // Get the api user.
                APIUser apiUser = APIUserManager.FindAndPrepare(apiKey);

                // Receive files.
                MultipartMemoryStreamProvider provider = await Request.Content.ReadAsMultipartAsync();

                foreach (HttpContent file in provider.Contents)
                {
                    string filename = file.Headers.ContentDisposition.FileName.Replace("\"", "");

                    using (MemoryStream ms = new MemoryStream(await file.ReadAsByteArrayAsync()))
                    {
                        using (Stream ds = Crypto.Decrypt(ms, apiUser.EncryptionKey))
                        {
                            SessionManager.AddPackage(sessionGuid, ds, filename);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                EventLogManager.Log("REMOTE_EXCEPTION", EventLogSeverity.Warning, null, ex);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
Exemplo n.º 8
0
        public static ActionResult RemoveEventLogs(Session session)
        {
            try
            {
                session.Log("Beginning the uninstall of the event log source.");

                EventLogManager.RemoveSource();

                session.Log("Uninstall of the event log source was successful.");
                return(ActionResult.Success);
            }
            catch (Exception e)
            {
                session.Log(e.Message + "\n" + e.StackTrace);
                return(ActionResult.Failure);
            }
        }
Exemplo n.º 9
0
    private void SellTradeOffer(int tradeAcceptant, int resourceID, int amount)
    {
        resourcesAmountForTrade[resourceID] -= amount;
        if (resourcesAmountForTrade[resourceID] < 0)
        {
            resourcesAmountForTrade[resourceID] = 0;
        }

        float      value      = resourcesCostForTrade[resourceID] * amount;
        TradeOffer tradeOffer = new TradeOffer(this, resourceID, amount, value);

        MarketPlace.OnTradeOfferSold(tradeOffer);
        if (isLocalPlayer)
        {
            EventLogManager.AddNewTradeOfferSoldLog(tradeOffer);
        }
    }
Exemplo n.º 10
0
        //Read from register (instalation path, connection settings)

        private void Initialization()
        {
            cmSettings  = ConnectionSettingsManager.GetCMSettings();
            crmSettings = ConnectionSettingsManager.GetCRMSettings();
            try
            {
                cmRepo  = new CMRepository(cmSettings);
                crmRepo = new CRMRepository(crmSettings);
            }
            catch (Exception)
            {
                EventLogManager.WriteMessage(new Message()
                {
                    Description = "Connection settings error", Type = "Error", Time = DateTime.Now
                }, EventType.Error);
            }
        }
Exemplo n.º 11
0
        public void RunSyndication(ISession session, ManagedSecurityContext sec)
        {
            IQuery query = session.CreateSQLQuery(
                "SELECT {AccountFeed.*} FROM AccountFeed" +
                " WHERE (NOT EXISTS ( SELECT AccountFeedItem_Id FROM AccountFeedItem item WHERE item.AccountFeed_Id = AccountFeed.AccountFeed_Id ))" +
                " OR ( AccountFeed.LastError NOT LIKE '' )" +
                " OR ( DATEDIFF(hour, AccountFeed.Updated, getutcdate()) > AccountFeed.UpdateFrequency )" +
                " ORDER BY AccountFeed.Updated ASC")
                           .AddEntity("AccountFeed", typeof(AccountFeed));

            IList <AccountFeed> list = query.List <AccountFeed>();

            foreach (AccountFeed feed in list)
            {
                if (IsStopping)
                {
                    break;
                }

                try
                {
                    ManagedAccountFeed m_feed = new ManagedAccountFeed(session, feed);
                    if (IsDebug)
                    {
                        EventLogManager.WriteEntry(string.Format("Syndication service updating {0} ({1}).",
                                                                 feed.Name, feed.Id), EventLogEntryType.Information);
                    }
                    m_feed.Update(sec);
                    m_feed.UpdateImages(sec);
                    m_feed.UpdateMedias(sec);
                }
                catch (ThreadAbortException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    feed.LastError = ex.Message;
                    session.Save(feed);
                }

                session.Flush();
                Thread.Sleep(1000 * InterruptInterval);
            }
        }
Exemplo n.º 12
0
        void SyncList()
        {
            //delete this sleep time
            Thread.Sleep(30000);

            while (true)
            {
                //Read refresh rate from registry
                try
                {
                    refreshRate = Convert.ToInt64(ServiceSettingsManager.GetRefreshRate()); //In minut
                    if (refreshRate == 0)
                    {
                        throw new Exception();
                    }
                }
                catch
                {
                    refreshRate = 2;
                }
                refreshRate = refreshRate * 60000;
                Stopwatch watch = Stopwatch.StartNew();

                try
                {
                    syncCrmCm = new SyncCrmCm();
                    syncCrmCm.Sync();
                }
                catch (Exception e)
                {
                    EventLogManager.WriteMessage(new Message()
                    {
                        Description = e.Message.ToString(), System = "Sync", Time = DateTime.Now
                    }, EventType.Error);
                }
                watch.Stop();
                long elapsedMs   = watch.ElapsedMilliseconds;
                long timeToSleep = refreshRate - elapsedMs;
                if (timeToSleep > 0)
                {
                    Thread.Sleep(Convert.ToInt32(timeToSleep));
                }
            }
        }
Exemplo n.º 13
0
        public static void Start()
        {
            //obsolete timer start
            tmrObsoleteLicenses.Interval = 300000;
            tmrObsoleteLicenses.Elapsed += TmrObsoleteLicenses_Elapsed;
            tmrObsoleteLicenses.Start();


            //online licenses
            LicenseServerOnlineCatalogManager.OnCatalogLicensesFetched += OnCatalogLicensesFetched;

            ConnectionManager.Start(11006, false);
            ConnectionManager.AtumClientLicenseRequest       += ConnectionManager_AtumClientLicenseRequest;
            ConnectionManager.AtumClientRemoveLicenseRequest += ConnectionManager_AtumClientRemoveLicenseRequest;


            AvailableLicenses = new AvailableLicenses();

            //check if previous license file exists then preload them
            if (File.Exists(DAL.ApplicationSettings.Settings.LocalLicenseFilePath))
            {
                var offlineLicenses = OnlineCatalogLicenses.FromLicenseFile();

                if (offlineLicenses != null)
                {
                    foreach (var offlineLicense in offlineLicenses)
                    {
                        if (offlineLicense.Activated && offlineLicense.Amount > 0 && offlineLicense.ExpirationDate >= DateTime.Now)
                        {
                            AvailableLicenses.Add(new AvailableLicense()
                            {
                                Activated      = offlineLicense.Activated,
                                LicenseGUID    = offlineLicense.LicenseGUID,
                                ExpirationDate = offlineLicense.ExpirationDate,
                                LicenseType    = offlineLicense.LicenseType,
                                Amount         = offlineLicense.Amount
                            });
                        }
                    }
                }

                EventLogManager.WriteToEventLog("Offline license(s) found", "Amount " + AvailableLicenses.Count);
            }
        }
Exemplo n.º 14
0
        public void Deploy()
        {
            // Do the install.
            JavaScriptSerializer  jsonSer = new JavaScriptSerializer();
            SessionDataController dc      = new SessionDataController();

            // Set as started.
            Session.Status = SessionStatus.InProgess;
            dc.Update(Session);

            // Install in order.
            foreach (KeyValuePair <int, InstallJob> keyPair in OrderedInstall)
            {
                // Get install job.
                InstallJob job = keyPair.Value;

                // Attempt install.
                job.Install();

                // Log package installs.
                foreach (PackageJob package in job.Packages)
                {
                    string log = string.Format("Package successfully installed: {0} @ {1}, session: {2}.", package.Name, package.VersionStr, Session.Guid);

                    EventLogManager.Log("PACKAGE_INSTALLED", EventLogSeverity.Info, log);
                }

                // Make sorted list serialisable.
                SortedList <string, InstallJob> serOrderedInstall = new SortedList <string, InstallJob>();

                foreach (KeyValuePair <int, InstallJob> pair in OrderedInstall)
                {
                    serOrderedInstall.Add(pair.Key.ToString(), pair.Value);
                }

                // After each install job, update response.
                Session.Response = jsonSer.Serialize(serOrderedInstall);
                dc.Update(Session);
            }

            // Done.
            Session.Status = SessionStatus.Complete;
            dc.Update(Session);
        }
Exemplo n.º 15
0
        public List <Catalogo> ListadoCatAccionesPLD()
        {
            List <Catalogo> result = null;

            try
            {
                result = (new CatalogosLogic()).ListadoCatAccionesPLD();
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en CatalogoServices.ListadoCatAccionesPLD: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en CatalogoServices.ListadoCatAccionesPLD: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Obtiene los datos de la persona
        /// </summary>
        /// <param name="intEmpresaID"></param>
        /// <param name="sintTipoEmpresaID"></param>
        /// <returns></returns>
        public List <Empresa> ListarDatosPersona(Int32 @intEmpresaID, Int16 @sintTipoEmpresaID)
        {
            List <Empresa> result = new List <Empresa>();

            try
            {
                result = (new EmpresaLogic()).ListarDatosPersona(@intEmpresaID, @sintTipoEmpresaID);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en EmpresaServices.ListarDatosPersona: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en EmpresaServices.ListarDatosPersona: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Permite realizar el alta, modificación y baja de la empresa
        /// </summary>
        /// <param name="empresa"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setEmpresa(Empresa empresa, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                result = (new EmpresaLogic()).setEmpresa(empresa, tinOpcion);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en EmpresaServices.setEmpresa: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en EmpresaServices.setEmpresa: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Permite realizar el alta, modificación o baja de los datos de domicilio
        /// </summary>
        /// <param name="direccion"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDomicilio(Direccion direccion, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                result = (new DireccionLogic()).setDomicilio(direccion, tinOpcion);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en DireccionServices.setDomicilio: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en DireccionServices.setDomicilio: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 19
0
        public VerificadorPLD ServicioVerificadorPLD(BitacoraPLD parametros)
        {
            VerificadorPLD result = null;

            try
            {
                result = (new VerificadorPLDLogic()).ServicioVerificadorPLD(parametros);
            }
            catch (Exception ex)
            {
                #if (DEBUG)
                Console.WriteLine("Error en VerificadorPLDServices.ServicioVerificadorPLD: " + ex.Message);
                #else
                EventLogManager.LogErrorEntry("Error en VerificadorPLDServices.ServicioVerificadorPLD: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
                #endif
            }
            return(result);
        }
Exemplo n.º 20
0
        public List <BitacoraPLD> ListadoBusquedaBitacoraPLD(string vchUsuario, int?intSistema)
        {
            List <BitacoraPLD> result = null;

            try
            {
                result = (new BitacoraLogic()).ListadoBusquedaBitacoraPLD(vchUsuario, intSistema);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en BitacoraPLDServices.ListadoBusquedaBitacoraPLD: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en BitacoraPLDServices.ListadoBusquedaBitacoraPLD: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 21
0
        public void Start()
        {
            if (!IsEnabled)
            {
                EventLogManager.WriteEntry(string.Format("Service {0} is disabled.", this.GetType().Name),
                                           EventLogEntryType.Information);

                return;
            }
            else
            {
                EventLogManager.WriteEntry(string.Format("Service {0} is starting.", this.GetType().Name),
                                           EventLogEntryType.Information);
            }

            mThread      = new Thread(ThreadProc);
            mThread.Name = this.GetType().Name;
            mThread.Start(this);
        }
Exemplo n.º 22
0
        public List <Catalogo> ListaBusquedaInteligenteTipoTipificacion(string strDatos)
        {
            List <Catalogo> result = null;

            try
            {
                result = (new CatalogosLogic()).ListaBusquedaInteligenteTipoTipificacion(strDatos);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en CatalogoServices.ListaBusquedaInteligenteTipoTipificacion: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en CatalogoServices.ListaBusquedaInteligenteTipoTipificacion: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Devuelve la lista de datos de personas
        /// </summary>
        /// <param name="intDireccionID"></param>
        /// <param name="intMunicipioID"></param>
        /// <param name="intEstadoID"></param>
        /// <param name="intLocalidadID"></param>
        /// <param name="intTipoDomicilioID"></param>
        /// <returns></returns>
        public List <Direccion> ListarDatosPersona(Int32 @intDireccionID, Int32 @intMunicipioID, Int32 @intEstadoID, Int32 @intLocalidadID, Int32 @intTipoDomicilioID)
        {
            List <Direccion> result = new List <Direccion>();

            try
            {
                result = (new DireccionLogic()).ListarDatosPersona(@intDireccionID, @intMunicipioID, @intEstadoID, @intLocalidadID, @intTipoDomicilioID);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en DireccionServices.ListarDatosPersona: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en DireccionServices.ListarDatosPersona: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 24
0
        public List <TipoLista> ListarTipoListaPLD()
        {
            List <TipoLista> result = null;

            try
            {
                result = (new ListaNegraLogic()).ListarTipoListaPLD();
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en ListaNegraServices.ListarTipoListaPLD: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en ListaNegraServices.ListarTipoListaPLD: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 25
0
 protected override void OnStart(string[] args)
 {
     EventLogManager.WriteMessage(new Message()
     {
         Description = "Service Start", Type = "Service", Time = DateTime.Now
     }, EventType.Test);
     try
     {
         syncTestThread = new SyncThread();
         syncTestThread.Run();
     }
     catch (Exception e)
     {
         EventLogManager.WriteMessage(new Message()
         {
             Description = "On Start Method: " + e.Message.ToString(), Type = "Service", Time = DateTime.Now
         }, EventType.Test);
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// Obitiene la lista de la relación de dirección y empresa
        /// </summary>
        /// <param name="intPersonaDomEmpreID"></param>
        /// <param name="intPersonaID"></param>
        /// <param name="intDireccionID"></param>
        /// <param name="intEmpresaID"></param>
        /// <returns></returns>
        public List <Persona> ListarRelPersonaDireccionEmpresa(Int32 @intPersonaDomEmpreID, Int32 @intPersonaID, Int32 @intDireccionID, Int32 @intEmpresaID)
        {
            List <Persona> result = new List <Persona>();

            try
            {
                result = (new PersonaLogic()).ListarRelPersonaDireccionEmpresa(@intPersonaDomEmpreID, @intPersonaID, @intDireccionID, @intEmpresaID);
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en PersonaServices.ListarRelPersonaDireccionEmpresa: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en EmpresaServices.ListarRelPersonaDireccionEmpresa: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 27
0
 public void Delete(Form subject)
 {
     try {
         var db   = new ApplicationDbContext();
         var form = db.Forms.Where(s => s.FormID == subject.FormID).SingleOrDefault();
         db.Forms.Remove(form);
         db.SaveChanges();
         ErrorLabel.Text = String.Empty;
     }
     catch (DbEntityValidationException ex)
     {
         ErrorLabel.Visible = true;
         ErrorLabel.Text    = EventLogManager.LogError(ex);
     }
     catch (Exception exp) {
         ErrorLabel.Visible = false;
         ErrorLabel.Text    = exp.Message;
     }
 }
Exemplo n.º 28
0
        public List <SistemasPLD> ListarSistemasPLD()
        {
            List <SistemasPLD> result = null;

            try
            {
                result = (new ListaNegraLogic()).ListarSistemasPLD();
            }
            catch (Exception ex)
            {
#if (DEBUG)
                Console.WriteLine("Error en ListaNegraServices.ListarSistemasPLD: " + ex.Message);
#else
                EventLogManager.LogErrorEntry("Error en BitacoraInterfacesService.ListaRelCatTipoListNegAccion: " + ex.Message);
                //TODO: Codificar envío de notificación de error al EventLog
#endif
            }
            return(result);
        }
Exemplo n.º 29
0
 private static void TmrObsoleteLicenses_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (AvailableLicenses != null)
     {
         lock (AvailableLicenses)
         {
             foreach (var availableLicense in AvailableLicenses)
             {
                 for (var activityIndex = availableLicense.Activities.Count - 1; activityIndex >= 0; activityIndex--)
                 {
                     if (availableLicense.Activities[activityIndex].EndsOn < DateTime.Now)
                     {
                         EventLogManager.WriteToEventLog("Removed obsolete license activity", availableLicense.LicenseType.ToString() + ":" + availableLicense.Activities[activityIndex].Computername);
                         availableLicense.Activities.RemoveAt(activityIndex);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 30
0
 public void Delete(WorkflowStateTransition subject)
 {
     try {
         var db = new ApplicationDbContext();
         var workflowStateTransition = db.WorkflowStateTransitions.Where(s => s.WorkflowStateTransitionID == subject.WorkflowStateTransitionID).SingleOrDefault();
         db.WorkflowStateTransitions.Remove(workflowStateTransition);
         db.SaveChanges();
         ErrorLabel.Text = String.Empty;
     }
     catch (DbEntityValidationException ex)
     {
         ErrorLabel.Visible = true;
         ErrorLabel.Text    = EventLogManager.LogError(ex);
     }
     catch (Exception exp)
     {
         ErrorLabel.Visible = true;
         ErrorLabel.Text    = exp.Message;
     }
 }