示例#1
0
        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            XmlDocument  xdoc = XmlDataSource2.GetXmlDocument();
            XmlNodeList  list = xdoc.GetElementsByTagName("User");
            XmlElement   feed;
            XmlElement   game  = null;
            XmlAttribute name  = null;
            XmlAttribute score = null;
            XmlElement   game1;

            if (Idplayer == "")
            {
                feed       = xdoc.CreateElement("User");
                name       = xdoc.CreateAttribute("id");
                name.Value = HttpContext.Current.User.Identity.Name.ToString();
                feed.Attributes.Append(name);

                game  = xdoc.CreateElement("Rating");
                name  = xdoc.CreateAttribute("idJogo");
                score = xdoc.CreateAttribute("Rating");

                name.Value = Request.QueryString["id"];
                TextBox textBox = sender as TextBox;
                score.Value = textBox.Text;
                game.Attributes.Append(name);
                game.Attributes.Append(score);
                feed.AppendChild(game);
            }
            else
            {
                feed = xdoc.SelectSingleNode("Ratings/User[@id='" + Idplayer + "']") as XmlElement;
                if (gameReviewed == false)
                {
                    game  = xdoc.CreateElement("Rating");
                    name  = xdoc.CreateAttribute("idJogo");
                    score = xdoc.CreateAttribute("Rating");

                    name.Value = Request.QueryString["id"];
                    TextBox textBox = sender as TextBox;
                    score.Value = textBox.Text;
                    game.Attributes.Append(name);
                    game.Attributes.Append(score);
                    feed.AppendChild(game);
                }
                else
                {
                    game1 = xdoc.SelectSingleNode("Ratings/User[@id='" + Idplayer + "']/Rating[@idJogo='" + Request.QueryString["id"] + "']") as XmlElement;
                    TextBox textBox = sender as TextBox;
                    game1.Attributes[1].Value = textBox.Text;
                    game1.Attributes[0].Value = Request.QueryString["id"];
                    feed.AppendChild(game1);
                }
            }



            xdoc.DocumentElement.AppendChild(feed);

            XmlDataSource2.Save();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument xdoc = XmlDataSource2.GetXmlDocument();

            var feedList = xdoc.DocumentElement.SelectNodes("feed");


            XmlDocument all    = new XmlDocument();
            XmlElement  parent = all.CreateElement("all");

            all.AppendChild(parent);
            foreach (XmlNode node in feedList)
            {
                XmlDocument feed = new XmlDocument();
                feed.Load(node.Attributes["url"].Value);
                var nodes = feed.SelectNodes("rss/channel/item");

                foreach (XmlNode innerNode in nodes)
                {
                    var author = all.CreateElement("author");
                    author.InnerText = feed.SelectSingleNode("rss/channel/title").InnerText;
                    var importNode = all.ImportNode(innerNode, true);
                    importNode.AppendChild(author);
                    all.DocumentElement.AppendChild(importNode);
                }
            }

            list(order(all));
        }
示例#3
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            XmlDataSource4.DataFile = "~/" + DropDownList1.SelectedValue + "_feed.xml";
            XmlDataSource3.DataFile = "~/" + DropDownList1.SelectedValue + "_feed.xml";
            XmlDataSource2.DataFile = "~/" + DropDownList1.SelectedValue + "_feed.xml";

            XmlDocument xdoc     = XmlDataSource2.GetXmlDocument();
            XmlNodeList elemList = xdoc.GetElementsByTagName("channel");
        }
示例#4
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            XmlDocument xdoc = XmlDataSource3.GetXmlDocument();

            XmlElement  root  = xdoc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("/properties/property"); // You can also use XPath here
            int         land_register_number = 0;

            foreach (XmlNode node in nodes)
            {
                int ld_register = Int32.Parse(node.Attributes[0].Value);
                if (land_register_number < ld_register)
                {
                    land_register_number = ld_register;
                }
            }

            land_register_number++;

            XmlElement   properties     = xdoc.SelectSingleNode("properties") as XmlElement;
            XmlElement   property       = xdoc.CreateElement("property");
            XmlElement   land_register  = xdoc.CreateElement("land_register");
            XmlElement   address        = xdoc.CreateElement("address");
            XmlElement   city           = xdoc.CreateElement("city");
            XmlElement   street         = xdoc.CreateElement("street");
            XmlElement   port_number    = xdoc.CreateElement("port_number");
            XmlElement   value          = xdoc.CreateElement("value");
            XmlElement   owners         = xdoc.CreateElement("owners");
            XmlAttribute aland_register = xdoc.CreateAttribute("land_register");

            aland_register.InnerText = (land_register_number).ToString();
            land_register.InnerText  = (land_register_number).ToString();
            city.InnerText           = ((TextBox)GridView1.FooterRow.FindControl("txtcity")).Text;
            street.InnerText         = ((TextBox)GridView1.FooterRow.FindControl("txtstreet")).Text;
            port_number.InnerText    = ((TextBox)GridView1.FooterRow.FindControl("txtport")).Text;
            value.InnerText          = ((TextBox)GridView1.FooterRow.FindControl("txtvalue")).Text;

            property.Attributes.Append(aland_register);
            property.AppendChild(land_register);
            property.AppendChild(address);
            address.AppendChild(city);
            address.AppendChild(street);
            address.AppendChild(port_number);
            property.AppendChild(value);
            property.AppendChild(owners);
            properties.AppendChild(property);

            XmlDataSource3.Save();
            XmlDataSource1.DataBind();
            XmlDataSource2.DataBind();

            GridView1.ShowFooter = false;
            Response.Redirect(Request.RawUrl);
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["P"] != null && !IsPostBack)
     {
         XmlDocument xmlDoc  = XmlDataSource2.GetXmlDocument();
         XmlNodeList xmlNode = xmlDoc.SelectNodes("/AdminPost/Post[@id='" + Request.QueryString["P"] + "']");
         txtEditTitle.Text    = xmlNode[0].ChildNodes[0].InnerText;
         txtEditLoc.Text      = xmlNode[0].ChildNodes[1].InnerText;
         txtDescription.Value = xmlNode[0].ChildNodes[4].InnerText;
         txtEditTag.Text      = xmlNode[0].ChildNodes[5].InnerText;
     }
 }
    protected void deleteApprove_Click(object sender, EventArgs e)
    {
        fileId = Session["fileId"].ToString();
        XmlNode node = myFiles.SelectSingleNode("/files//file[@id='" + fileId + "']");

        node.ParentNode.RemoveChild(node);
        myFiles.Save(Server.MapPath("myTrees/TempFiles.xml"));
        XmlDataSource2.Save();
        Repeater1.DataBind();
        disableDiv2.Visible  = false;
        deleteFalert.Visible = false;
    }
示例#7
0
    protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        string  xpath = string.Format("//items/item[@id='{0}']", e.Parameter);
        XmlNode node  = XmlDataSource2.GetXmlDocument().SelectSingleNode(xpath);

        if (node != null)
        {
            LargeImage.ImageUrl      = "Images/" + node.Attributes["FileName"].Value;
            LargeImage.AlternateText = node.Attributes["Text"].Value;
            LargeImageText.Text      = node.Attributes["Text"].Value;
        }
        e.Result = ASPxCallback.GetRenderResult(ImagePanel);
    }
示例#8
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "delete")
     {
         XmlDocument xmlDoc   = XmlDataSource2.GetXmlDocument();
         XmlNodeList xmlNodel = xmlDoc.SelectNodes("/AdminPost/Post[@id='" + Request.QueryString["P"] + "']");
         XmlNode     xmlNode  = xmlNodel[0];
         XmlNode     xParent  = xmlNode.ParentNode;
         xParent.RemoveChild(xmlNode);
         //Save File
         xmlDoc.Save(Server.MapPath("~/App_Data/AdminPost.xml"));
         Response.Redirect("ManagePost.aspx");
     }
 }
示例#9
0
        protected void UpdateBtn_Click(object sender, EventArgs e)
        {
            XmlDocument xmlDoc  = XmlDataSource2.GetXmlDocument();
            XmlNodeList xmlNode = xmlDoc.SelectNodes("/AdminPost/Post[@id='" + Request.QueryString["P"] + "']");

            //Update Title
            xmlNode[0].ChildNodes[0].InnerText = txtEditTitle.Text;
            //Update Location
            xmlNode[0].ChildNodes[1].InnerText = txtEditLoc.Text;
            //Update desc
            xmlNode[0].ChildNodes[4].InnerText = txtDescription.Value;


            xmlDoc.Save(Server.MapPath("~/App_Data/AdminPost.xml"));

            Response.Redirect("ManagePost.aspx");
        }
示例#10
0
        private void getTop()
        {
            string link = "http://localhost:49486/RSS/top";

            XmlReader   reader = XmlReader.Create(link);
            XmlDocument doc    = new XmlDocument();

            doc.Load(reader);
            reader.Close();

            XmlDataSource3.Data = doc.OuterXml;
            XmlDataSource3.DataBind();
            XmlDataSource3.XPath = "/rss/channel";

            XmlDataSource2.Data = doc.OuterXml;
            XmlDataSource2.DataBind();
            XmlDataSource2.XPath = "/channel";

            XmlDocument xdoc1    = XmlDataSource3.GetXmlDocument();
            XmlDocument xdoc2    = XmlDataSource2.GetXmlDocument();
            XmlNodeList channel  = xdoc1.SelectNodes("//channel");
            XmlNode     info     = channel[0];
            XmlNodeList noticias = xdoc2.SelectNodes("//item");

            top.InnerHtml = "<ul>";

            foreach (XmlNode i in noticias)
            {
                top.InnerHtml += "" +
                                 "<li>" +
                                 "<a href = \"/Movie?ID=" + i.Attributes["id"].Value + "\" >" +
                                 "<div class=\"thumb\">" +
                                 "<div class=\"img\" style=\"background-image: url('" + i.Attributes["poster"].Value + "');\"></div>" +
                                 "</div>" +
                                 "<div class=\"info\">" +
                                 "<div class=\"title\">" + i.Attributes["title"].Value + "</div>" +
                                 "<div class=\"infos\">" +
                                 "<div class=\"year\">" + i.Attributes["year"].Value + "</div>" +
                                 "<div class=\"imdb\">TMDB: " + i.Attributes["rating"].Value + "</div>" +
                                 "</div>" +
                                 "</div>" +
                                 "</a>" +
                                 "</li>";
            }
            top.InnerHtml += "</ul>";
        }
示例#11
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("dqwdqwdqw");
            XmlReader   reader = XmlReader.Create("http://www.omdbapi.com/?i=" + idInput.Value.ToString() + "&plot=full&r=xml");
            XmlDocument doc    = new XmlDocument();

            doc.Load(reader);
            reader.Close();

            XmlDataSource2.Data = doc.OuterXml;

            XmlDataSource2.DataBind();
            XmlDataSource2.XPath = "/root/movie";


            XmlDocument xdoc1 = XmlDataSource2.GetXmlDocument();
            XmlNode     info  = xdoc1.SelectSingleNode("/root/movie");

            String query = "INSERT INTO dbo.Movies (id,rating,year,poster,title) VALUES (@id,@rating, @year, @poster, @title)";

            using (SqlConnection connection = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=MoviesBS;Integrated Security=True;Pooling=False"))
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    //a shorter syntax to adding parameters
                    command.Parameters.Add("@id", SqlDbType.NChar).Value = idInput.Value.ToString();

                    command.Parameters.Add("@rating", SqlDbType.NChar).Value = info.Attributes["imdbRating"].Value;

                    command.Parameters.Add("@year", SqlDbType.NChar).Value = info.Attributes["year"].Value;

                    command.Parameters.Add("@poster", SqlDbType.NChar).Value = info.Attributes["poster"].Value;

                    command.Parameters.Add("@title", SqlDbType.NChar).Value = info.Attributes["title"].Value;

                    //make sure you open and close(after executing) the connection
                    connection.Open();
                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch { }
                    connection.Close();
                }
            stats();
        }
示例#12
0
        protected void propertyItemUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row   = GridView1.Rows[e.RowIndex];
            HyperLink   hyper = (HyperLink)row.FindControl("HyperLink1");
            XmlDocument xdoc  = XmlDataSource3.GetXmlDocument();

            XmlElement property = xdoc.SelectSingleNode("properties/property[@land_register='" + hyper.Text + "']") as XmlElement;
            XmlNode    address  = property.SelectSingleNode("address");

            address.SelectSingleNode("city").InnerText        = e.NewValues["city"].ToString();
            address.SelectSingleNode("street").InnerText      = e.NewValues["street"].ToString();
            address.SelectSingleNode("port_number").InnerText = e.NewValues["port_number"].ToString();
            property.SelectSingleNode("value").InnerText      = e.NewValues["value"].ToString();

            XmlDataSource3.Save();
            XmlDataSource1.DataBind();
            XmlDataSource2.DataBind();

            e.Cancel            = true;
            GridView1.EditIndex = -1;
            Response.Redirect(Request.RawUrl);
        }
示例#13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //מנקה את קובץ האקס-אמ-אל המיועד לעריכת שאלות
        xmlFakeDoc = XmlDataSource2.GetXmlDocument();
        xmlFakeDoc.SelectSingleNode("/tree").InnerXml = "";

        xmlRealDoc = XmlDataSource1.GetXmlDocument();
        xmlRealDoc.Load(Server.MapPath("tree/games.xml"));

        string path = (Server.MapPath("/uploadedFiles"));

        string[] files = Directory.GetFiles(path);

        foreach (string x in files)
        {
            string imageName = x.Substring((x.Length - x.LastIndexOf("'\'") + 2));

            if (xmlRealDoc.InnerText.Contains(Server.UrlEncode(imageName)) == false)
            {
                File.Delete(Server.MapPath("/uploadedFiles/" + imageName));
            }
        }
    }
示例#14
0
        protected void CommentBtn_Click(object sender, EventArgs e)
        {
            XmlDocument doc      = XmlDataSource2.GetXmlDocument();
            XmlNodeList nodelist = doc.SelectNodes("//Response[last()]");

            String oldFeedbackID = nodelist[0].Attributes[0].Value.ToString();
            int    feedback      = int.Parse(oldFeedbackID.Substring(1));

            feedback++;
            String newFeedbackID = "F" + feedback;

            XmlNode node    = doc.SelectNodes("/Feedback/Response")[0];
            XmlNode newnode = node.CloneNode(true);

            // update element values for the new node
            newnode.Attributes[0].Value = newFeedbackID;
            newnode.Attributes[1].Value = Request.QueryString["P"];
            newnode.SelectSingleNode("Name").InnerText    = txtNameFeedback.Text;
            newnode.SelectSingleNode("Message").InnerText = txtMessageFeedback.Text;

            // append the new node to the document
            doc.DocumentElement.AppendChild(newnode);
            doc.Save(Server.MapPath("~/App_Data/Feedback.xml"));
        }
示例#15
0
        protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            //verificar se os campos estao todos preenchidos
            DateTime datavelha = DateTime.Now;
            string   script    = "<script language=\"javascript\">\n" + "alert (\"Preencha todos os campos\");\n" + "</script>";

            if (e.Values["nif"].ToString().Length == 0 || e.Values["fname"].ToString().Length == 0 || e.Values["lname"].ToString().Length == 0 || e.Values["pdate"].ToString().Length == 0)
            {
                ClientScript.RegisterStartupScript(script.GetType(), "Error", script);
                e.Cancel = true;
            }
            else
            {
                //verificar se o nif foi corretamente preenchido
                UInt32 n;
                if (UInt32.TryParse(e.Values["nif"].ToString(), out n) && e.Values["nif"].ToString().Length == 9)
                {
                    //verificar se a data e valida
                    DateTime d;
                    if (DateTime.TryParse(e.Values["pdate"].ToString(), out d))
                    {
                        XmlDocument xdoc = XmlDataSource2.GetXmlDocument();
                        //verificar se a propriedade selecionada ja possui dono
                        XmlElement propSelecionada = xdoc.SelectSingleNode("properties/property[@id='" + DropDownList1.SelectedValue + "']") as XmlElement;
                        XmlElement dono            = propSelecionada.SelectSingleNode("owner") as XmlElement;
                        if (dono == null)
                        {
                            dono = xdoc.CreateElement("owner");

                            XmlAttribute nif   = xdoc.CreateAttribute("nif");
                            XmlAttribute fname = xdoc.CreateAttribute("fname");
                            XmlAttribute lname = xdoc.CreateAttribute("lname");
                            XmlAttribute pdate = xdoc.CreateAttribute("pdate");

                            nif.Value   = e.Values["nif"].ToString();
                            fname.Value = e.Values["fname"].ToString();
                            lname.Value = e.Values["lname"].ToString();
                            pdate.Value = e.Values["pdate"].ToString();

                            dono.Attributes.Append(nif);
                            dono.Attributes.Append(fname);
                            dono.Attributes.Append(lname);
                            dono.Attributes.Append(pdate);

                            propSelecionada.AppendChild(dono);

                            XmlDataSource2.Save();
                            e.Cancel = true;

                            script = "<script language=\"javascript\">\n" + "alert (\"Criação de dono bem sucedida!\");\n" + "</script>";
                            ClientScript.RegisterStartupScript(script.GetType(), "Success", script);

                            Response.Redirect("Owners.aspx");
                        }
                        else
                        {
                            datavelha = Convert.ToDateTime(dono.GetAttribute("pdate").ToString());


                            if (datavelha < d)
                            {
                                dono.RemoveAllAttributes();
                                XmlAttribute nif   = xdoc.CreateAttribute("nif");
                                XmlAttribute fname = xdoc.CreateAttribute("fname");
                                XmlAttribute lname = xdoc.CreateAttribute("lname");
                                XmlAttribute pdate = xdoc.CreateAttribute("pdate");

                                nif.Value   = e.Values["nif"].ToString();
                                fname.Value = e.Values["fname"].ToString();
                                lname.Value = e.Values["lname"].ToString();
                                pdate.Value = e.Values["pdate"].ToString();

                                dono.Attributes.Append(nif);
                                dono.Attributes.Append(fname);
                                dono.Attributes.Append(lname);
                                dono.Attributes.Append(pdate);

                                propSelecionada.AppendChild(dono);
                                XmlDataSource2.Save();
                                e.Cancel = true;

                                script = "<script language=\"javascript\">\n" + "alert (\"Alteração de dono bem sucedida!\");\n" + "</script>";
                                ClientScript.RegisterStartupScript(script.GetType(), "Success", script);

                                Response.Redirect("propriedades.aspx");
                            }
                            else
                            {
                                script = "<script language=\"javascript\">\n" + "alert (\"a data de compra nao pode ser mais antiga que a do dono anterior\");\n" + "</script>";
                                ClientScript.RegisterStartupScript(script.GetType(), "Error", script);
                                e.Cancel = true;
                            }
                        }
                    }
                    else
                    {
                        script = "<script language=\"javascript\">\n" + "alert (\"a data não é válida\");\n" + "</script>";
                        ClientScript.RegisterStartupScript(script.GetType(), "Error", script);
                        e.Cancel = true;
                    }
                }
                else
                {
                    script = "<script language=\"javascript\">\n" + "alert (\"O nif nao foi bem preenchido\");\n" + "</script>";
                    ClientScript.RegisterStartupScript(script.GetType(), "Error", script);
                    e.Cancel = true;
                }
            }
        }
示例#16
0
    protected void uploadApprove_Click(object sender, EventArgs e)
    {
        XmlNode filesCounterNode = myFiles.SelectSingleNode("/files/filesCounter");
        int     newFileId        = Convert.ToInt16(filesCounterNode.InnerXml);

        newFileId++;
        filesCounterNode.InnerXml = newFileId.ToString();

        if (((RadioButtonList)FindControl("RadioButtonList1")).SelectedValue == "URL")
        {
            string urlTitleLabel = urlTitle.Text;
            string urlLinkLabel  = urlLink.Text;

            XmlElement NewLessonURLNode = myFiles.CreateElement("file");
            NewLessonURLNode.SetAttribute("id", filesCounterNode.InnerXml.ToString());

            XmlElement NewLessonURLNameNode = myFiles.CreateElement("fileName");
            NewLessonURLNameNode.InnerText = urlTitleLabel;
            NewLessonURLNode.AppendChild(NewLessonURLNameNode);

            XmlElement NewLessonURLFormatNode = myFiles.CreateElement("fileFormat");
            NewLessonURLFormatNode.InnerText = "url";
            NewLessonURLNode.AppendChild(NewLessonURLFormatNode);

            XmlElement NewLessonURLLinkNode = myFiles.CreateElement("fileLink");
            NewLessonURLLinkNode.InnerText = urlLinkLabel;
            NewLessonURLNode.AppendChild(NewLessonURLLinkNode);



            XmlNode LessonNode = myFiles.SelectSingleNode("/files");
            LessonNode.AppendChild(NewLessonURLNode);

            urlTitle.Text = "";
            urlLink.Text  = "";
            myFiles.Save(Server.MapPath("myTrees/TempFiles.xml"));
            XmlDataSource2.Save();
            Repeater1.DataBind();
        }
        else
        {
            string fileName      = FileUpload1.PostedFile.FileName;
            string endOfFileName = fileName.Substring(fileName.LastIndexOf("."));
            string myTime        = DateTime.Now.ToString("dd_MM_yy-HH_mm_ss");
            string newFileName   = fileName + "_" + myTime;
            FileUpload1.PostedFile.SaveAs(Server.MapPath("UploadedFiles") + "//" + newFileName);

            XmlElement NewLessonFileNode = myFiles.CreateElement("file");
            NewLessonFileNode.SetAttribute("id", filesCounterNode.InnerXml.ToString());

            XmlElement NewLessonFileNameNode = myFiles.CreateElement("fileName");
            NewLessonFileNameNode.InnerText = newFileName;
            NewLessonFileNode.AppendChild(NewLessonFileNameNode);

            XmlElement NewLessonFileFormatNode = myFiles.CreateElement("fileFormat");
            NewLessonFileFormatNode.InnerText = endOfFileName;
            NewLessonFileNode.AppendChild(NewLessonFileFormatNode);

            XmlNode LessonNode = myFiles.SelectSingleNode("/files");
            LessonNode.AppendChild(NewLessonFileNode);

            myFiles.Save(Server.MapPath("myTrees/TempFiles.xml"));
            XmlDataSource2.Save();
            Repeater1.DataBind();
        }
    }
示例#17
0
        protected void doLoad()
        {
            System.Diagnostics.Debug.WriteLine("USER NOT AUTHENTICATED!!!");

            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                System.Diagnostics.Debug.WriteLine("USER NOT AUTHENTICATED!!!");
                Rating1.Visible      = false;
                RadioButton1.Visible = false;
                Label1.Visible       = false;
                Label3.Visible       = false;
                Label4.Visible       = true;
                Label2.Visible       = false;
                ola.Visible          = false;
                TextBox1.Visible     = false;
                Button1.Visible      = false;
            }
            else
            {
                Rating1.Visible      = true;
                RadioButton1.Visible = true;
                Label1.Visible       = true;
                Label3.Visible       = true;
                Label4.Visible       = false;
                Label2.Visible       = true;
                TextBox1.Visible     = true;
                Button1.Visible      = true;
                ola.Visible          = true;
            }

            Label2.Text = Auxiliar.GetAvgScore(Int32.Parse(Request.QueryString["id"])).ToString();

            int score = Auxiliar.GetScore(HttpContext.Current.User.Identity.Name.ToString(), Int32.Parse(Request.QueryString["id"]));

            System.Diagnostics.Debug.WriteLine(score);
            int playedTrue = Auxiliar.Playing(HttpContext.Current.User.Identity.Name.ToString(), Int32.Parse(Request.QueryString["id"]));

            RadioButton1.Checked = false;
            if (playedTrue == 1)
            {
                RadioButton1.Checked = true;
            }


            if (score != 0)
            {
                Rating1.CurrentRating = score;
            }

            if (RadioButton1.Checked == true)
            {
                Rating1.Visible  = true;
                TextBox1.Visible = true;
                Button1.Visible  = true;
            }
            else
            {
                Rating1.Visible  = false;
                TextBox1.Visible = false;
                Button1.Visible  = false;
            }

            Button1.Visible = true;

            XmlDocument asfvafaw      = new XmlDocument();
            String      xsltFileName1 = Server.MapPath("~/XML/Reviews.xml");

            asfvafaw.Load(xsltFileName1);

            XmlDataSource3.Data  = asfvafaw.OuterXml;
            GridView1.DataSource = XmlDataSource3;
            GridView1.DataBind();


            try
            {
                XmlDocument reviews = Auxiliar.getReviews(Int32.Parse(Request.QueryString["id"]));

                GridView1.DataSource = null;
                GridView1.DataBind();

                DataSet xmlData    = new DataSet();
                var     xmlReader1 = new XmlNodeReader(reviews);
                xmlData.ReadXml(xmlReader1);

                GridView1.DataSource = xmlData;
                GridView1.DataBind();
            }
            catch
            {
            }

            XmlDocument Games = Auxiliar.GamesInfoPush(Int32.Parse(Request.QueryString["id"]));
            //XmlDocument Games = Auxiliar.GamesInfo(Int32.Parse(Request.QueryString["id"]));
            var trans = new XslTransform();

            String xsltFileName = Server.MapPath("~/XSLT/infoGame.xslt");

            trans.Load(xsltFileName);

            var reader         = trans.Transform(Games, null, (XmlResolver)null);
            var transformedDoc = new XmlDocument();

            transformedDoc.Load(reader);
            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            var ds        = new DataSet();
            var xmlReader = new XmlNodeReader(transformedDoc);

            ds.ReadXml(xmlReader);
            SeriesDetailsView.DataSource = ds;
            SeriesDetailsView.FieldHeaderStyle.Font.Bold     = true;
            SeriesDetailsView.RowStyle.BackColor             = System.Drawing.Color.White;
            SeriesDetailsView.FieldHeaderStyle.BackColor     = System.Drawing.Color.LightGray;
            SeriesDetailsView.FieldHeaderStyle.BorderColor   = System.Drawing.Color.Black;
            SeriesDetailsView.FieldHeaderStyle.Width         = 90;
            SeriesDetailsView.FieldHeaderStyle.VerticalAlign = VerticalAlign.Middle;
            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            SeriesDetailsView.DataBind();

            System.Diagnostics.Debug.WriteLine("olaaaaaaaaaaaaaaaaaaaa");

            for (int i = 0; i < 4; i++)
            {
                SeriesDetailsView.Rows[i].Visible = false;
                System.Diagnostics.Debug.WriteLine(SeriesDetailsView.Rows[i].Visible);
            }

            SeriesDetailsView.Rows[0].Enabled = false;


            Image[]     image     = new Image[transformedDoc.SelectNodes("//Similar").Count];
            Label[]     label     = new Label[transformedDoc.SelectNodes("//Similar").Count];
            HyperLink[] hyperlink = new HyperLink[transformedDoc.SelectNodes("//Similar").Count];

            for (int i = 0; i < transformedDoc.SelectNodes("//Similar").Count; i++)
            {
                label[i] = new Label();

                image[i] = new Image();
                image[i].Attributes.Add("class", "img-responsive center-block");
                image[i].Attributes.Add("style", "height:200px");

                XmlDocument x = new XmlDocument();
                x.Load("http://thegamesdb.net/api/GetArt.php?id=" + transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);
                image[i].ImageUrl = "http://thegamesdb.net/banners/" + x.SelectNodes("//Images/boxart[@side='front']").Item(0).InnerText;

                HtmlGenericControl createDiv = new HtmlGenericControl("DIV");
                createDiv.Attributes.Add("class", "grid-item col-md-3 col-sm-8 sortable");
                createDiv.Attributes.Add("style", "margin-top: 20px;");

                this.SimilarGames.Controls.Add(createDiv);
                createDiv.Controls.Add(image[i]);
                label[i] = new Label();
                HtmlGenericControl createDivText = new HtmlGenericControl("DIV");
                createDivText.Attributes.Add("class", "titles");
                createDivText.Attributes.Add("style", "text-align: center; margin-top: 5px;");
                createDiv.Controls.Add(createDivText);
                hyperlink[i]             = new HyperLink();
                hyperlink[i].NavigateUrl = String.Format("videoGameInfo.aspx?id={0}", transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);

                x.Load("http://thegamesdb.net/api/GetGame.php?id=" + transformedDoc.SelectNodes("//Similar/@idJogo").Item(i).InnerText);
                hyperlink[i].Text = x.SelectNodes("//Game/GameTitle").Item(0).InnerText;

                label[i].Controls.Add(hyperlink[i]);
                createDivText.Controls.Add(label[i]);
            }


            Label1.Text = SeriesDetailsView.Rows[2].Cells[1].Text;
            //System.Diagnostics.Debug.WriteLine(SeriesDetailsView.Rows[9].Cells[0].Text);
            channelImage.Src = "http://thegamesdb.net/banners/" + SeriesDetailsView.Rows[7].Cells[1].Text;
            channelImage.DataBind();
            XmlDocument xdoc  = XmlDataSource2.GetXmlDocument();
            XmlNodeList list4 = xdoc.GetElementsByTagName("User");

            foreach (XmlNode x in list4)
            {
                if (x.Attributes["id"].Value == HttpContext.Current.User.Identity.Name.ToString())
                {
                    Idplayer = x.Attributes["id"].Value;
                    XmlNodeList list3 = x.ChildNodes;
                    foreach (XmlNode c in list3)
                    {
                        if (c.Attributes["idJogo"].Value == Request.QueryString["id"])
                        {
                            gameReviewed = true;
                        }
                    }
                }
            }
            lastVal = -1;
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument xdoc = XmlDataSource2.GetXmlDocument();

            XmlNodeList elemList = xdoc.GetElementsByTagName("feed");


            for (int i = 0; i < elemList.Count; i++)
            {
                if (elemList[i].Attributes["nome"].Value == DropDownList1.SelectedValue)
                {
                    string      attrVal = elemList[i].Attributes["url"].Value;
                    XmlReader   reader  = XmlReader.Create(attrVal);
                    XmlDocument doc     = new XmlDocument();
                    doc.Load(reader);
                    reader.Close();

                    doc.Save("C:/Users/JotaP/Desktop/UA/EDC/TP3/TP3/TP3/XML/" + elemList[i].Attributes["nome"].Value + "_feed.xml");
                    XmlDataSource6.DataFile = "~/XML/" + elemList[i].Attributes["nome"].Value + "_feed.xml";
                }
            }

            XmlDocument xdoc1 = XmlDataSource6.GetXmlDocument();

            elemList = xdoc1.GetElementsByTagName("url");
            if (elemList.Count > 0)
            {
                XmlNode x1 = elemList[0].ChildNodes.Item(0);
                Image2.Src = x1.InnerText;
            }
            else
            {
                Image2.Src = "default-placeholder.png";
            }


            XmlNodeList nodes_items = xdoc1.SelectNodes("rss/channel/item");
            XmlNode     nodeTitle   = xdoc1.SelectSingleNode("rss/channel/item/title");
            XmlNode     nodeCat     = xdoc1.SelectSingleNode("rss/channel/item/category");
            XmlNode     nodeDate    = xdoc1.SelectSingleNode("rss/channel/item/date");
            XmlNode     nodeDesc    = xdoc1.SelectSingleNode("rss/channel/item/description");
            XmlNode     nodeLink    = xdoc1.SelectSingleNode("rss/channel/item/link");


            String innerHtml = "";

            foreach (XmlNode node in nodes_items)
            {
                nodeTitle = node.SelectSingleNode("title");
                nodeCat   = node.SelectSingleNode("category");
                nodeDate  = node.SelectSingleNode("pubDate");
                nodeDesc  = node.SelectSingleNode("description");
                nodeLink  = node.SelectSingleNode("link");
                if (nodeCat == null)
                {
                    nodeCat           = nodeTitle.Clone();
                    nodeCat.InnerText = "";
                }
                //System.Diagnostics.Debug.WriteLine(elemList[0].InnerText);
                String node_html = "<div class=\"col-xs-12 col-md-6 col-lg-4\"> <div class=\"well\" style=\"min-height: 300px\"> <div class=\"media\"> <div class=\"media-body\"> <h4 class=\"media-heading\"><a target=\"_blank\" href=\"" + nodeLink.InnerText + "\">" + nodeTitle.InnerText + "</a></h4> <div class=\"row\"><div class=\"col-md-6\"><small><i class=\"fa fa-tag\"></i> " + nodeCat.InnerText + "</small></div><div class=\"col-md-6\" style=\"text-align: right\"><small><i class=\"fa fa-calendar - check - o\"></i> " + nodeDate.InnerText + "</small></div></div><p>" + nodeDesc.InnerText + "</p></div></div></div></div>";
                innerHtml += node_html;
            }

            news.InnerHtml = innerHtml;
        }
示例#19
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string totalQuest = "";
        string theId      = "";
        string rowNum     = "";
        string buttonId   = "";
        string myTextBox  = "";

        // תחילה אנו מבררים מהו ה -אי די- של הפריט בעץ ה אקס אם אל
        if (e.CommandSource.GetType() == typeof(ImageButton))
        {
            ImageButton i = (ImageButton)e.CommandSource;
            theId      = i.Attributes["theItemId"];
            buttonId   = i.ID;
            myTextBox  = i.Attributes["myTB"];
            rowNum     = buttonId.Substring(buttonId.Length - 1);
            totalQuest = i.Attributes["theItemTotalQuest"];
            Session["gameIDSession"] = i.Attributes["theItemId"];
        }
        else
        {
            if (e.CommandSource.GetType() == typeof(Button))
            {
                Button i = (Button)e.CommandSource;
                theId      = i.Attributes["theItemId"];
                totalQuest = i.Attributes["theItemTotalQuest"];
                Session["gameIDSession"] = i.Attributes["theItemId"];
            }
            Session["CorrectAnswer"] = "0";
        }
        // אנו מושכים את האי די של הפריט באמצעות מאפיין לא שמור במערכת שהוספנו באופן ידני לכפתור-תמונה
        if (totalQuest == "0")
        {
            Session["editQuestNum"] = "0";
        }
        else
        {
            Session["editQuestNum"] = "1";
        }

        // עלינו לברר איזו פקודה צריכה להתבצע - הפקודה רשומה בכל כפתור
        switch (e.CommandName)
        {
        //אם נלחץ על כפתור מחיקה יקרא לפונקציה של מחיקה
        case "deleteRow":
            deleteRow();
            break;

        case "editName":
            if (Session["edit"] != null && Session["edit"].ToString() == "true")
            {
                Session["edit"] = "false";
                XmlNode GameNameNode = xmlRealDoc.SelectSingleNode("/tree/game[@code=" + theId + "]/gameName");
                Session["gameIDSession"] = "";
                foreach (GridViewRow row in GridView1.Rows)
                {
                    string counter = ((Label)row.FindControl("gameIDLbl")).Text;
                    if (counter == theId)
                    {
                        xmlRealDoc.SelectSingleNode("/tree/game[@code='" + theId + "']/gameName").InnerText = Server.UrlEncode(((TextBox)row.FindControl("gameNameEditTextBox")).Text);
                    }
                }
                XmlDataSource1.Save();
                GridView1.DataBind();
            }
            else
            {
                Session["edit"] = "true";
                GridView1.DataBind();
            }
            break;

        case "editTime":
            Button  time       = (Button)e.CommandSource;
            string  y          = time.ID;
            string  x          = y.Substring(y.Length - 2);
            string  gameTimeId = time.Attributes["theItemId"].ToString();
            XmlNode node       = xmlRealDoc.SelectSingleNode("/tree/game[@code='" + gameTimeId + "']");
            node.Attributes["timePerQes"].Value = x;
            XmlDataSource1.Save();
            Session["gameIDSession"] = "";
            GridView1.DataBind();
            break;

        //אם נלחץ על כפתור עריכה (העפרון) נעבור לדף עריכה
        case "editRow":
            Session["saved"] = false;
            XmlNode    FakeGameXml = xmlFakeDoc.SelectSingleNode("tree");
            XmlElement myNewGame   = xmlFakeDoc.CreateElement("game");
            //  myNewGame.SetAttribute("published", "false");
            // myNewGame.SetAttribute("timePerQes", "30");
            myNewGame.SetAttribute("totalQes", totalQuest);
            myNewGame.SetAttribute("code", theId);
            FakeGameXml.AppendChild(myNewGame);
            myNewGame.InnerXml = xmlRealDoc.SelectSingleNode("/tree/game[@code=" + theId + "]").InnerXml;
            XmlDataSource2.Save();
            Response.Redirect("EditGame.aspx");
            break;
        }
    }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument xdoc = XmlDataSource2.GetXmlDocument();

            Image[]     image     = new Image[10];
            Label[]     label     = new Label[10];
            HyperLink[] hyperlink = new HyperLink[10];
            GridView1.Visible = false;
            int x4;

            if (GridView1.Rows.Count > 0)
            {
                if (GridView1.Rows.Count <= 9)
                {
                    x4 = GridView1.Rows.Count;
                }
                else
                {
                    x4 = 9;
                }
                for (int i = 1; i < x4; i++)
                {
                    label[i] = new Label();

                    image[i] = new Image();
                    image[i].Attributes.Add("height", "150px");

                    XmlDocument x = new XmlDocument();
                    x.Load("http://thegamesdb.net/api/GetArt.php?id=" + GridView1.Rows[i].Cells[0].Text);

                    image[i].ImageUrl = "http://thegamesdb.net/banners/" + x.SelectNodes("//Images/boxart[@side='front']").Item(0).InnerText;
                    HtmlGenericControl createDiv = new HtmlGenericControl("DIV");
                    createDiv.Attributes.Add("class", "grid-item col-md-5 col-sm-12 sortable");
                    createDiv.Attributes.Add("style", "margin-top: 30px;margin-left:30px;");

                    //Centrar image na div
                    image[i].Attributes.Add("class", "img-responsive center-block");
                    image[i].Attributes.Add("style", "height:250px");

                    this.SimilarGames.Controls.Add(createDiv);
                    createDiv.Controls.Add(image[i]);
                    label[i] = new Label();
                    HtmlGenericControl createDivText = new HtmlGenericControl("DIV");
                    createDivText.Attributes.Add("class", "titles");
                    createDivText.Attributes.Add("style", "text-align: center;");
                    createDiv.Controls.Add(createDivText);

                    hyperlink[i] = new HyperLink();
                    XmlDocument xml = new XmlDocument();
                    xml.Load("http://thegamesdb.net/api/GetGame.php?id=" + GridView1.Rows[i].Cells[0].Text);

                    hyperlink[i].Text        = xml.SelectNodes("//Game/GameTitle").Item(0).InnerText;
                    hyperlink[i].NavigateUrl = String.Format("videoGameInfo.aspx?id={0}", xml.SelectNodes("//Game/id").Item(0).InnerText);

                    label[i].Controls.Add(hyperlink[i]);
                    createDivText.Controls.Add(label[i]);
                }
            }

            var         feedList = xdoc.DocumentElement.SelectNodes("feed");
            XmlDocument all      = new XmlDocument();
            XmlElement  parent   = all.CreateElement("all");

            all.AppendChild(parent);
            foreach (XmlNode node in feedList)
            {
                XmlDocument feed = new XmlDocument();
                feed.Load(node.Attributes["url"].Value);
                var nodes = feed.SelectNodes("rss/channel/item");

                foreach (XmlNode innerNode in nodes)
                {
                    var author = all.CreateElement("author");
                    author.InnerText = feed.SelectSingleNode("rss/channel/title").InnerText;
                    var importNode = all.ImportNode(innerNode, true);
                    importNode.AppendChild(author);
                    all.DocumentElement.AppendChild(importNode);
                }
            }

            list(order(all));
        }