コード例 #1
0
ファイル: UserOldTest.aspx.cs プロジェクト: DasunSL/Uppgift_4
        private void SendUserXmlToDb() //Request.QueryString["userName"]
        {
            DatabaseConnection db       = new DatabaseConnection();
            string             userName = Request.QueryString["userName"];
            string             id       = db.GetUserId("stare"); //will be userName later, not "stare"
            List <string>      userXmls = db.RetrieveXmlDocument(id, DateTime.Today);

            if (userXmls.Count < 1)
            {
                string    fileName = GetUserXmlFileName();
                XDocument xDoc     = XDocument.Load(Server.MapPath(fileName));
                db.SaveUserXml(id, xDoc, DateTime.Today);
            }
            else
            {
                //person has already done a test today
            }
        }
コード例 #2
0
ファイル: testPage.aspx.cs プロジェクト: DasunSL/Uppgift_4
        private XDocument GetUserXmlFromDb() //Request.QueryString["userName"]
        {
            DatabaseConnection db       = new DatabaseConnection();
            string             userName = Request.QueryString["userName"];
            string             id       = db.GetUserId(userName);
            List <string>      userXmls = db.RetrieveXmlDocument(id, DateTime.Today);

            XDocument    xDoc = XDocument.Parse(userXmls[0]);
            XDeclaration xDec = xDoc.Declaration; //for some reason postgres changes encoding to utf-16, changing it back!

            xDec.Encoding = "utf-8";

            string fileName = GetUserXmlFileName();

            xDoc.Save(Server.MapPath(fileName));

            return(xDoc);
        }
コード例 #3
0
ファイル: testPage.aspx.cs プロジェクト: DasunSL/Uppgift_4
        //Request.QueryString["userName"]
        private void SendUserXmlToDb()
        {
            DatabaseConnection db = new DatabaseConnection();
            string userName = Request.QueryString["userName"];
            string id = db.GetUserId(userName);
            List<string> userXmls = db.RetrieveXmlDocument(id, DateTime.Today);

            if (userXmls.Count < 1)
            {
                string fileName = GetUserXmlFileName();
                XDocument xDoc = XDocument.Load(Server.MapPath(fileName));
                db.SaveUserXml(id, xDoc, DateTime.Today);
            }
            else
            {
                //person has already done a test today
            }
        }
コード例 #4
0
ファイル: testPage.aspx.cs プロジェクト: DasunSL/Uppgift_4
        //Request.QueryString["userName"]
        private XDocument GetUserXmlFromDb()
        {
            DatabaseConnection db = new DatabaseConnection();
            string userName = Request.QueryString["userName"];
            string id = db.GetUserId(userName);
            List<string> userXmls = db.RetrieveXmlDocument(id, DateTime.Today);

            XDocument xDoc = XDocument.Parse(userXmls[0]);
            XDeclaration xDec = xDoc.Declaration; //for some reason postgres changes encoding to utf-16, changing it back!
            xDec.Encoding = "utf-8";

            string fileName = GetUserXmlFileName();
            xDoc.Save(Server.MapPath(fileName));

            return xDoc;
        }