Exemple #1
0
        static void Main(string[] args)
        {
            System.Xml.Serialization.XmlSerializer sr = new System.Xml.Serialization.XmlSerializer(typeof(Config));
            if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config.xml"))
            {
                Config config = new Config() {id=1, WirelessComPort = "Com14", TouhPanelComPort = "Com18",IOComPort="Com12" };
            
                sr.Serialize(System.IO.File.Create(AppDomain.CurrentDomain.BaseDirectory + "config.xml"), config);
                Console.WriteLine("please modify the config.xml");
             //   Console.ReadKey();
                Environment.Exit(-1);
            }
            else
            {
                config = sr.Deserialize(System.IO.File.OpenRead(AppDomain.CurrentDomain.BaseDirectory + "config.xml")) as Config;

                if (config == null)
                {
                    Console.WriteLine("config.xml  reading error!");
                    Environment.Exit(-1);
                }
            }
            controller = new Controller(config.id,config.WirelessComPort,config.TouhPanelComPort,config.IOComPort);

            
        }
Exemple #2
0
        public static string setbackgroup()
        {
            var _configs = new Config().Config_meta();

            if (_configs != null && _configs.ToList().Count > 0 && !string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FIELD1))
            {
                return "background: url(" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FIELD1 + ") center center;";
            }
            return "background: url(/Resources/images/bg-default.jpg) center center;";
        }
 public static string regis_mail(string email)
 {
     Register_email rg = new Register_email();
     Config cf = new Config();
     SendMail semail = new SendMail();
     if (rg.Add_email(email))
     {
         string _sMailBody = string.Empty;
         string _sEmailCC = string.Empty;
         _sMailBody += "Cám ơn bạn đã đặt đăng ký nhận tin từ email với chúng tôi.";
         var _ccMail = cf.Getemail(2);
         if (_ccMail.ToList().Count > 0)
         {
             _sEmailCC = _ccMail.ToList()[0].EMAIL_TO;
         }
         semail.SendEmailSMTP("Thông báo: Bạn đã đăng ký nhận tin thành công", email, _sEmailCC, "", _sMailBody, true, false);
         return "success";
     }
     else return "errors";
 }