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 } }
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); }
//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 } }
//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; }