Ejemplo n.º 1
0
        public static bool SetCOMConfig(string timer, string pathftp, string pathlocal, string pathdefault)
        {
            bool flag = true;

            try
            {
                setconfig("timer", timer);
                _timer = timer;
                setconfig("pathftp", pathftp);
                _pathftp = pathftp;
                setconfig("pathfilelocal", pathlocal);
                _pathfilelocal = pathlocal;
                setconfig("default", pathdefault);
                _pathdefault = pathdefault;

                return(true);
            }
            catch (Exception exception)
            {
                CTLError.WriteError("SetCOMConfig ", exception.Message);
                return(false);

                throw;
            }
            return(flag);
        }
Ejemplo n.º 2
0
        //public static string _HourChange = "00";

        public static void GetConfiguration()
        {
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(Application.StartupPath + @"\Config.xml");
                _timer         = document.SelectSingleNode("//timer").Attributes["Value"].Value;
                _user          = document.SelectSingleNode("//user").Attributes["Value"].Value;
                _pass          = document.SelectSingleNode("//pass").Attributes["Value"].Value;
                _pathftp       = document.SelectSingleNode("//pathftp").Attributes["Value"].Value;
                _pathfilelocal = document.SelectSingleNode("//pathfilelocal").Attributes["Value"].Value;
                _pathdefault   = document.SelectSingleNode("//default").Attributes["Value"].Value;
                _HourUpDefault = document.SelectSingleNode("//hourupdefault").Attributes["Value"].Value;
                _HourUpRan     = document.SelectSingleNode("//hourupran").Attributes["Value"].Value;
                string genfilename = document.SelectSingleNode("//GenFileName").Attributes["Value"].Value;
                string gentypead   = document.SelectSingleNode("//GenTypeAd").Attributes["Value"].Value;
                string genad       = document.SelectSingleNode("//GenAd").Attributes["Value"].Value;
                _GenFilenameUpload = new List <string>();
                _Gentypead         = new List <string>();
                _GenAd             = new List <string>();
                foreach (string s in genfilename.Split(';'))
                {
                    if (s != string.Empty)
                    {
                        _GenFilenameUpload.Add(s);
                    }
                }
                foreach (string s in gentypead.Split(';'))
                {
                    if (s != string.Empty)
                    {
                        _Gentypead.Add(s);
                    }
                }
                foreach (string s in genad.Split(';'))
                {
                    if (s != string.Empty)
                    {
                        _GenAd.Add(s);
                    }
                }
                _CheckGen = Convert.ToBoolean(document.SelectSingleNode("//CheckGen").Attributes["Value"].Value);
                //_HourChange = document.SelectSingleNode("//HourChange").Attributes["Value"].Value;
            }
            catch (Exception exception)
            {
                CTLError.WriteError("CTLConfig getconfig ", exception.Message);
                return;

                throw new Exception(exception.Message);
            }
        }
Ejemplo n.º 3
0
 public static void XoaErrorlog()
 {
     try
     {
         DirectoryInfo d = new DirectoryInfo(Application.StartupPath);
         foreach (FileInfo fileerr in d.GetFiles("ErrorLogConfigBank*"))
         {
             DateTime ngayxoa = DateTime.Now.AddDays(-7);
             if (fileerr.LastWriteTime < ngayxoa)
             {
                 fileerr.Delete();
             }
         }
     }
     catch (Exception ex)
     {
         CTLError.WriteError("Loi Xoa ErrorLogConfigBank", ex.Message);
         return;
     }
 }
Ejemplo n.º 4
0
        public static bool setconfig(string keyName, string value)
        {
            bool flag = true;

            try
            {
                XmlDocument document = new XmlDocument();
                document.Load(Application.StartupPath + @"\Config.xml");

                document.SelectSingleNode("//" + keyName).Attributes["Value"].Value = value;

                document.Save(Application.StartupPath + @"\Config.xml");

                return(true);
            }
            catch (Exception exception)
            {
                CTLError.WriteError("set config value " + keyName, exception.Message);
                return(false);

                throw;
            }
            return(flag);
        }
Ejemplo n.º 5
0
        public static void GetConfiguration()
        {
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(Application.StartupPath + @"\Config.xml");
                _timer         = document.SelectSingleNode("//timer").Attributes["Value"].Value;
                _user          = document.SelectSingleNode("//user").Attributes["Value"].Value;
                _pass          = document.SelectSingleNode("//pass").Attributes["Value"].Value;
                _pathftp       = document.SelectSingleNode("//pathftp").Attributes["Value"].Value;
                _pathfilelocal = document.SelectSingleNode("//pathfilelocal").Attributes["Value"].Value;
                _pathdefault   = document.SelectSingleNode("//default").Attributes["Value"].Value;
                _HourUpDefault = document.SelectSingleNode("//hourupdefault").Attributes["Value"].Value;
                _HourUpRan     = document.SelectSingleNode("//hourupran").Attributes["Value"].Value;
            }
            catch (Exception exception)
            {
                CTLError.WriteError("CTLConfig getconfig ", exception.Message);
                return;

                throw new Exception(exception.Message);
            }
        }