Beispiel #1
0
        public static bool StartAsyncProcess(DelegateAsyncMethod methodName, ProcessPriority threadPriority,
                                             object objState)
        {
            var objParameterizedThreadStart = new ParameterizedThreadStart(methodName);

            var objThread = new Thread(objParameterizedThreadStart, 0);

            objThread.Priority = (ThreadPriority)threadPriority;

            try
            {
                objThread.Start(objState);
                return(true);
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                return(false);
            }
        }
Beispiel #2
0
        public static string GetConfigurationParameterOld(string XmlTag, string Key)
        {
            string _strValue           = string.Empty;
            var    objXmlConfiguration = new XmlDocument();
            string strAssemblyPath     = GetAssemblyPath();

            _strValue = string.Empty;

            // Si el archivo XML de configuración no está en Cache, lo carga
            if (HttpRuntime.Cache[CONFIGURATION_CACHE] == null)
            {
                string strFile = strAssemblyPath + CONFIGURATION_FILE;
                try
                {
                    objXmlConfiguration.Load(strFile);
                }
                catch (FileNotFoundException)
                {
                    //ISException.RegisterExcepcion(ex);
                    return(string.Empty);
                }
                HttpRuntime.Cache.Insert(CONFIGURATION_CACHE, objXmlConfiguration.InnerXml, new CacheDependency(strFile),
                                         DateTime.MaxValue, TimeSpan.Zero);
            }
            else
            {
                objXmlConfiguration.LoadXml(HttpRuntime.Cache[CONFIGURATION_CACHE].ToString());
            }

            XmlNodeList objXmlNode = null;

            try
            {
                objXmlNode          = objXmlConfiguration.SelectNodes("//Configuration/" + XmlTag);
                objXmlConfiguration = null;

                if (objXmlNode.Count > 0)
                {
                    XmlElement childno;
                    for (int i = 0; i < objXmlNode[0].ChildNodes.Count; i++)
                    {
                        if (objXmlNode[0].ChildNodes[i].NodeType == XmlNodeType.Element)
                        {
                            childno = (XmlElement)objXmlNode[0].ChildNodes[i];
                            if (childno.Name == "add" && string.Compare(Key, childno.Attributes["key"].Value, true) == 0)
                            {
                                _strValue = childno.Attributes["value"].Value;
                                return(_strValue);
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("Entrada No Encontrada");
                }
            }
            catch (Exception ex)
            {
                _strValue = string.Empty;
                ISException.RegisterExcepcion(ex);
                return(string.Empty);
            }

            return(string.Empty);
        }