Example #1
0
        //methor ghi du lieu len xml
        public void ghidulieu(CauHinhServerBE cauhinh, string strpath)
        {
            doc = new XmlDocument();

            root = doc.CreateElement("CAUHINH");

            XmlElement Name = root.OwnerDocument.CreateElement("name");

            Name.InnerText = cauhinh.Namer1;
            XmlElement Data = root.OwnerDocument.CreateElement("data");

            Data.InnerText = cauhinh.Data1;
            XmlElement User = root.OwnerDocument.CreateElement("id");

            User.InnerText = cauhinh.User1;
            XmlElement Pass = root.OwnerDocument.CreateElement("pw");

            Pass.InnerText = cauhinh.Pass1;
            doc.AppendChild(root);
            root.AppendChild(Name);
            root.AppendChild(Data);
            root.AppendChild(User);
            root.AppendChild(Pass);
            doc.Save(strpath);
        }
Example #2
0
        public static SqlConnection hamketnoisqlhtkh2015()
        {
            CauHinhServerBE server     = new CauHinhServerBE();
            CauHinhServerBL serverxuly = new CauHinhServerBL();

            server = serverxuly.docdulieu(Environment.CurrentDirectory + "/CauHinhServerHTKH2015.xml");
            return(new SqlConnection("server=" + server.Namer1 + ";database=" + server.Data1 + ";user id=" + server.User1 + ";password="******""));
        }
Example #3
0
        public static void sqlDependency()
        {
            CauHinhServerBE server     = new CauHinhServerBE();
            CauHinhServerBL serverxuly = new CauHinhServerBL();

            server = serverxuly.docdulieu(Environment.CurrentDirectory + "/CauHinhServer.xml");
            string m_connect = "server=" + server.Namer1 + ";database=" + server.Data1 + ";user id=" + server.User1 + ";password="******"";

            try
            {
                SqlClientPermission ss = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
                ss.Demand();
            }
            catch (Exception)
            {
                throw;
            }
            SqlDependency.Stop(m_connect);
            SqlDependency.Start(m_connect);
        }
Example #4
0
        public CauHinhServerBE docdulieu(string strpath)
        {  //khoi tao bien va load tai lieu xml
            CauHinhServerBE cauhinh = new CauHinhServerBE();

            doc = new XmlDocument();

            doc.Load(strpath);
            //duyet den cac nut cua xml
            root = doc.DocumentElement;
            string Name = root.SelectSingleNode("name").InnerText;
            string Data = root.SelectSingleNode("data").InnerText;
            string User = root.SelectSingleNode("id").InnerText;
            string Pass = root.SelectSingleNode("pw").InnerText;

            //gan cac nut cua xml vao bien khoi tao trong bo luu tru
            cauhinh.Namer1 = Name;
            cauhinh.Data1  = Data;
            cauhinh.User1  = User;
            cauhinh.Pass1  = Pass;
            return(cauhinh);
        }