示例#1
0
        protected void DetailsView1_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
        {
            XmlDataSource1.TransformFile = "";
            XmlDocument xdoc = XmlDataSource1.GetXmlDocument();

            XmlElement feed = xdoc.SelectSingleNode("/listaDeRSS/feed[name='" + e.Values["name"].ToString() + "']") as XmlElement;

            xdoc.DocumentElement.RemoveChild(feed);

            XmlDataSource1.Save();
            XmlDataSource1.DataBind();
            XmlDataSource1.TransformFile = "~/bla.xslt";
            e.Cancel = true;

            DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);

            string      path   = HttpContext.Current.Server.MapPath("~/App_Data/public_feeds.xml");
            XmlDocument source = new XmlDocument();

            source.Load(path);
            XmlElement toRemove = source.SelectSingleNode("/channels/channel[@name='" + e.Values["name"].ToString() + "']") as XmlElement;

            source.DocumentElement.RemoveChild(toRemove);
            source.Save(path);
        }
示例#2
0
        protected void ownersItemUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row           = GridView1.Rows[e.RowIndex];
            TextBox     tax           = (TextBox)row.FindControl("TextBox2");
            string      land_register = Request.QueryString["ID"];
            XmlDocument xdoc          = XmlDataSource1.GetXmlDocument();

            XmlElement owner = xdoc.SelectSingleNode("properties/property[@land_register='" + land_register + "']/owners/owner[@tax_number='" + tax.Text + "']") as XmlElement;

            owner.Attributes["name"].Value          = e.NewValues["name"].ToString();
            owner.Attributes["tax_number"].Value    = e.NewValues["tax_number"].ToString();
            owner.Attributes["date_purchase"].Value = e.NewValues["date_purchase"].ToString();
            if (e.NewValues["data_sale"] != null)
            {
                owner.Attributes["data_sale"].Value = e.NewValues["data_sale"].ToString();
            }
            else
            {
                owner.Attributes["data_sale"].Value = "";
            }

            XmlDataSource1.Save();
            XmlDataSource1.DataBind();

            e.Cancel            = true;
            GridView1.EditIndex = -1;
        }
    public string CheckIfCanPublish(object Chekid) //בדיקה האם ניתן לפרסם או לא
    {
        string      id     = Convert.ToString(Chekid);
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();                                             //טעינה של העץ
        XmlNode     myGame = xmlDoc.SelectSingleNode("quizTree/topic[@id='" + id + "']/@NumOfQuestions"); //מס השאלות במשחק

        bool   canPublish = false;
        string disCalss   = ""; //משתנה ל class

        int NumOfQuestions = Convert.ToInt16(myGame.InnerXml);

        if (NumOfQuestions >= 10)
        {
            canPublish = true;
            disCalss   = "enabledd"; //הוספת קלאס של מאופשר
        }

        if (canPublish == false) //במידה ולא ניתן לפרסם
        {
            XmlNode GameId = xmlDoc.SelectSingleNode("quizTree/topic[@id='" + id + "']");
            GameId.Attributes["isPublish"].InnerText = "false"; //הגדרה בעץ isPublish=false
            XmlDataSource1.Save();
            disCalss = "disabled";                              //הוספת קלאס של לא מאופשר
        }
        return(disCalss);
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            switch (Request.Params["Mode"])

            {
            case "DataEntry":
                MvPurchase.SetActiveView(MvPurchase.Views[0]);
                FvPurchase.ChangeMode(FormViewMode.Insert);
                break;

            case "Verify":
                MvPurchase.SetActiveView(MvPurchase.Views[1]);
                break;
            }
            Session["Mode"] = Request.Params["Mode"];
        }
        if (FvPurchase.CurrentMode == FormViewMode.Insert)
        {
            XmlDataSource1.Data = (string)ConfigAdapter.GetConfigByModule("PUR", "PackType");
            XmlDataSource1.DataBind();
        }
        if (FvPurchase.CurrentMode == FormViewMode.Edit)
        {
            XmlDataSource1.Data = (string)ConfigAdapter.GetConfigByModule("PUR", "PackType");
            XmlDataSource1.DataBind();
        }
    }
示例#5
0
    protected void confirmDeleteBtn_Click(object sender, EventArgs e)
    {
        // removing question node
        XmlDocument xmlDoc    = XmlDataSource1.GetXmlDocument();
        XmlNode     selectedQ = xmlDoc.SelectNodes("/project/game[@gameCode=" + Session["theItemIdSession"] + "]/questions/question")[Convert.ToInt16(confirmDeleteBtn.Attributes["data-id"])];

        selectedQ.ParentNode.RemoveChild(selectedQ);

        // updating questionsNumber attribute
        int questionsNumber = Convert.ToInt16(xmlDoc.SelectSingleNode("/project/game[@gameCode=" + Session["theItemIdSession"] + "]").Attributes["questionsNumber"].InnerText);

        questionsNumber--;
        string newQuestionsNumber = questionsNumber.ToString();

        XmlNode game = xmlDoc.SelectSingleNode("/project/game[@gameCode=" + Session["theItemIdSession"] + "]");

        game.Attributes["questionsNumber"].InnerText = newQuestionsNumber;

        // saving changes to XML file
        XmlDataSource1.Save();
        GridView1.DataBind();

        deleteQPopup.Style.Add("display", "none");
        modalBackdrop.Style.Add("display", "none");

        Response.Redirect("Edit.aspx");
    }
        protected void submit_Click(object sender, EventArgs e)
        {
            cancel.Visible = true;
            cancel.Enabled = true;
            string script = "<script language=\"javascript\">\n" + "alert (\"Ambos os campos têm de ser preenchidos\");\n" + "</script>";

            if (descr.Text.Length == 0 || url_textbox.Text.Length == 0)
            {
                ClientScript.RegisterStartupScript(script.GetType(), "Error", script);
            }
            else
            {
                XmlDocument  xdoc      = XmlDataSource1.GetXmlDocument();
                XmlElement   rss       = xdoc.CreateElement("feed");
                XmlAttribute descricao = xdoc.CreateAttribute("description");
                XmlAttribute url_xml   = xdoc.CreateAttribute("url");

                descricao.Value = descr.Text;
                url_xml.Value   = url_textbox.Text;

                rss.Attributes.Append(descricao);
                rss.Attributes.Append(url_xml);
                xdoc.DocumentElement.AppendChild(rss);

                XmlDataSource1.Save();

                Response.Redirect("edit_rss.aspx");
            }
        }
示例#7
0
        private void BindLeftAccordion()
        {
            XmlDocument xmlDoc   = XmlDataSource1.GetXmlDocument();
            XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");

            foreach (XmlNode xmlNode in xmlNodes)
            {
                if (xmlNode.HasChildNodes)
                {
                    AccordionPane accordionPane = new AccordionPane();
                    accordionPane.Title       = xmlNode.Attributes["Text"].Value;
                    accordionPane.Layout      = Layout.Fit;
                    accordionPane.ShowBorder  = false;
                    accordionPane.BodyPadding = "2px 0 0 0";
                    leftAccordion.Items.Add(accordionPane);

                    Tree innerTree = new Tree();
                    innerTree.ShowBorder  = false;
                    innerTree.ShowHeader  = false;
                    innerTree.EnableIcons = true;
                    innerTree.AutoScroll  = true;
                    accordionPane.Items.Add(innerTree);

                    XmlDocument innerXmlDoc = new XmlDocument();
                    innerXmlDoc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));

                    // 绑定AccordionPane内部的树控件
                    innerTree.DataSource = innerXmlDoc;
                    innerTree.DataBind();
                }
            }
        }
示例#8
0
    void updateQuestion(int RowIndex)
    {
        // loading XML file
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();

        // getting selected question
        XmlNode editedQ = xmlDoc.SelectNodes("/project/game[@gameCode=" + Session["theItemIdSession"] + "]/questions/question")[RowIndex];

        editedQ["questionText"].InnerXml = Server.UrlEncode(qText.Text);
        editedQ["img"].InnerXml          = uploadImage(qImageFileUpload, "qImg");

        // option 1
        updateAnswerOption(option1Text, option1ImgUpload, option1Img, editedQ, "option1", 0);

        // option 2
        updateAnswerOption(option2Text, option2ImgUpload, option2Img, editedQ, "option2", 1);

        // option 3
        updateAnswerOption(option3Text, option3ImgUpload, option3Img, editedQ, "option3", 2);

        // option 4
        updateAnswerOption(option4Text, option4ImgUpload, option4Img, editedQ, "option4", 3);

        XmlDataSource1.Save();
        GridView1.DataBind();
    }
        private string getSpeciesBandCode()
        {
            string      bandcodeout = "bandcode";
            XmlDocument doc         = new XmlDocument();

            doc = XmlDataSource1.GetXmlDocument();

            XmlNode node;
            XmlNode bandcode;
            XmlNode root           = doc.DocumentElement;
            string  xmlspeciesname = string.Empty;

            if (speciesName.Contains("'"))
            {
                xmlspeciesname = buildXPathString(speciesName);
            }
            else
            {
                xmlspeciesname = "'" + speciesName + "'";
            }

            node     = root.SelectSingleNode(string.Format("Species[@EnglishName ={0}]", xmlspeciesname));
            bandcode = node.Attributes.GetNamedItem("BandCode");
            //Get the BandCode
            bandcodeout = bandcode.InnerText;
            return(bandcodeout);
        }
示例#10
0
    protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
    {
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
        int         myId   = Convert.ToInt16(xmlDoc.SelectSingleNode("//idCounter").InnerXml);

        myId++;
        string myNewId = myId.ToString();

        xmlDoc.SelectSingleNode("//idCounter").InnerXml = myNewId;

        XmlElement myNewGameNode = xmlDoc.CreateElement("game");

        myNewGameNode.SetAttribute("id", myNewId);
        myNewGameNode.SetAttribute("isPub", "false");
        myNewGameNode.SetAttribute("time", "30");
        //myNewGameNode.SetAttribute("name", Server.UrlEncode(TextBox1.Text));

        XmlElement mynameNode = xmlDoc.CreateElement("name");

        mynameNode.InnerXml = Server.UrlEncode(TextBox1.Text);
        myNewGameNode.AppendChild(mynameNode);
        XmlElement myquestionNode = xmlDoc.CreateElement("question");

        myNewGameNode.AppendChild(myquestionNode);

        XmlNode FirstGame = xmlDoc.SelectNodes("/games/game").Item(0);

        xmlDoc.SelectSingleNode("/games").InsertBefore(myNewGameNode, FirstGame);
        XmlDataSource1.Save();
        GridView1.DataBind();
        //ניקוי תיבת טקסט
        TextBox1.Text = "";
    }
    protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        throw new InvalidOperationException("Data modifications are not allowed in online demos");

        ASPxGridView grid = (ASPxGridView)sender;

        int categoryID = int.Parse(e.Keys["CategoryID"].ToString());

        XmlNode node = XmlDataSource1.GetXmlDocument().SelectSingleNode(string.Format("Categories/Category[@CategoryID='{0}']", categoryID));

        if (node != null)
        {
            foreach (DictionaryEntry entry in e.NewValues)
            {
                node.Attributes[entry.Key.ToString()].Value = entry.Value.ToString();
            }

            SaveXml(XmlDataSource1);
        }
        else
        {
            grid.JSProperties["cpException"] = string.Format("The DataRow with keyValue = '{0}' was deleted by another user.", categoryID);
        }

        e.Cancel = true;

        grid.CancelEdit();
    }
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        throw new InvalidOperationException("Data modifications are not allowed in online demos");

        int maxCategoryID = 0;

        foreach (XmlNode selectedNode in XmlDataSource1.GetXmlDocument().SelectNodes("Categories/Category"))
        {
            int categoryID = int.Parse(selectedNode.Attributes["CategoryID"].Value);
            if (categoryID > maxCategoryID)
            {
                maxCategoryID = categoryID;
            }
        }

        e.NewValues.Insert(0, "CategoryID", maxCategoryID + 1);

        XmlNode node = XmlDataSource1.GetXmlDocument().CreateElement("Category");

        foreach (DictionaryEntry entry in e.NewValues)
        {
            XmlAttribute attribute = XmlDataSource1.GetXmlDocument().CreateAttribute(entry.Key.ToString());
            attribute.Value = GetValue(entry.Value);
            node.Attributes.Append(attribute);
        }
        XmlDataSource1.GetXmlDocument().SelectSingleNode("Categories").AppendChild(node);
        SaveXml(XmlDataSource1);

        e.Cancel = true;

        ASPxGridView grid = (ASPxGridView)sender;

        grid.CancelEdit();
    }
示例#13
0
 protected void AddButton_Click(object sender, EventArgs e)
 {
     if ((!string.IsNullOrEmpty(TitleTextBox.Text)) && (!string.IsNullOrEmpty(TextBox.Text)))
     {
         if (AddButton.Text.Equals(GetLocalResourceObject("AddButton").ToString()))
         {
             Notice notice = new Notice();
             notice.Title = TitleTextBox.Text;
             notice.Text  = TextBox.Text;
             NewsDB.Insert(notice);
             NewsDB.SortByDate();
             TitleTextBox.Text = null;
             TextBox.Text      = null;
             XmlDataSource1.DataBind();
             NewsRepeater.DataBind();
             Response.Redirect("News.aspx");
         }
         else
         {
             Notice notice = NewsDB.Get(Int32.Parse(Session["tempId"].ToString()));
             notice.Title = TitleTextBox.Text;
             notice.Text  = TextBox.Text;
             NewsDB.Update(notice);
             TitleTextBox.Text = null;
             TextBox.Text      = null;
             AddButton.Text    = GetLocalResourceObject("AddButton").ToString();
             XmlDataSource1.DataBind();
             NewsRepeater.DataBind();
             Response.Redirect("News.aspx");
         }
     }
 }
示例#14
0
    protected void isPublish_CheckedChanged(object sender, EventArgs e)
    {
        //בדיקה האם הסטודנט עבר או לא/ המשחק פורסם או לא.
        //לוקח את הערך העדכני של מה שיש בגריד. אם זה לא מסומן אז הוא פולס ואם לוחצים עליו ניתן לראות בעץ שהערך ישתנה לטרו
        //אם הערך מסומן ואני לוחצת כדי לבטל את הסימון אנצ'קט אז הערך העץ ישתנה לפולס
        // טעינה של העץ
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();

        // תחילה אנו מבררים מהו ה -אי די- של הפריט בעץ ה אקס אם אל
        CheckBox myCheckBox = (CheckBox)sender;

        // מושכים את האי די של הפריט באמצעות המאפיין שהוספנו באופן ידני לתיבה
        string theId = myCheckBox.Attributes["theItemId"];

        //שאילתא למציאת הסטודנט שברצוננו לעדכן
        XmlNode theStudents = xmlDoc.SelectSingleNode("/RootTree/game[@GameCode='" + theId + "']");

        //קבלת הערך החדש של התיבה לאחר הלחיצה
        bool NewIsPass = myCheckBox.Checked;

        //עדכון של המאפיין בעץ
        theStudents.Attributes["isPublish"].InnerText = NewIsPass.ToString();

        //שמירה בעץ והצגה
        XmlDataSource1.Save();
        GridView1.DataBind();

        if (theStudents.Attributes["isPublish"].InnerText == "True")
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "X", "showmodel2()", true);
            Label3.Text = Server.UrlDecode(xmlDoc.SelectSingleNode("/RootTree/game[@GameCode='" + theId + "']/GameSubject").InnerText.ToString());
            Label4.Text = theId;
        }
    }
示例#15
0
    protected void OkGame_Click(object sender, EventArgs e)//מחיקת משחק
    {
        //הסרת ענף של משחק קיים באמצעות זיהוי האיי דיי שניתן לו על ידי לחיצה עליו מתוך הטבלה
        //שמירה ועדכון לתוך העץ ולגריד ויו
        XmlDocument Document = XmlDataSource1.GetXmlDocument();
        XmlNode     node     = Document.SelectSingleNode("/Hayarid/Game[@id='" + (string)ViewState["gameN"] + "']");
        XmlNodeList myGame   = Document.SelectNodes("//Game");

        node.ParentNode.RemoveChild(node);
        XmlDataSource1.Save();
        GridView1.DataBind();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("PublishLabel");
            if (myGame.Item(i).Attributes["published"].Value == "False")
            {
                chk.Enabled = false;
            }
            else
            {
                if (myGame.Item(i).Attributes["NoPublished"].Value == "True")
                {
                    chk.Checked = true;
                }
                else
                {
                    chk.Enabled = true;
                }
            }
        }
    }
示例#16
0
        protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            XmlDocument xdoc = XmlDataSource1.GetXmlDocument();

            XmlElement   aProperty  = xdoc.CreateElement("property");
            XmlAttribute theID      = xdoc.CreateAttribute("id");
            XmlAttribute theCity    = xdoc.CreateAttribute("city");
            XmlAttribute theStreet  = xdoc.CreateAttribute("Street");
            XmlAttribute thePnumber = xdoc.CreateAttribute("pnumber");
            XmlAttribute theValue   = xdoc.CreateAttribute("value");

            theID.Value      = e.Values["id"].ToString();
            theCity.Value    = e.Values["city"].ToString();
            theStreet.Value  = e.Values["Street"].ToString();
            thePnumber.Value = e.Values["pnumber"].ToString();
            theValue.Value   = e.Values["value"].ToString();

            aProperty.Attributes.Append(theID);
            aProperty.Attributes.Append(theCity);
            aProperty.Attributes.Append(theStreet);
            aProperty.Attributes.Append(thePnumber);
            aProperty.Attributes.Append(theValue);

            xdoc.DocumentElement.AppendChild(aProperty);
            XmlDataSource1.Save();
            e.Cancel = true;
            //---mostra o último elemento criado
            FormView1.PageIndex = xdoc.DocumentElement.ChildNodes.Count - 1;
            FormView1.ChangeMode(FormViewMode.ReadOnly);
            Response.Redirect("propriedades.aspx");
        }
示例#17
0
    protected void DeleteFinal_Click(object sender, EventArgs e)
    {
        string theItemId  = Session["theItemIdSession"].ToString();
        string editItemId = Session["ItemIdSessionEdit"].ToString();

        Button myDeleteBtn = (Button)sender;
        string ButtonID    = myDeleteBtn.ID;
        string PopUpID     = ButtonID.Substring(4);

        popUpWindow.Style.Add("display", "none");

        XmlDocument Document = XmlDataSource1.GetXmlDocument();
        XmlNode     node     = Document.SelectSingleNode("/games/game[@gid=" + theItemId + "]/question[@id=" + editItemId + "]");

        node.ParentNode.RemoveChild(node);

        counter--;
        Session["quesCount"] = counter;
        quesCounter.Text     = counter.ToString();
        XmlNode quesNum = Document.SelectSingleNode("/games/game[@gid=" + theItemId + "]");

        quesNum.Attributes["quesNum"].Value = counter.ToString();

        XmlDataSource1.Save();
        GridView1.DataBind();
    }
示例#18
0
    protected void isPublished_CheckedChanged(object sender, EventArgs e)
    {
        // loading XML file
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();

        // getting the relevant id
        CheckBox myCheckBox = (CheckBox)sender;
        string   theId      = myCheckBox.Attributes["theItemId"];

        // switching the checkbox value
        XmlNode theGame        = xmlDoc.SelectSingleNode("/project/game[@gameCode=" + theId + "]");
        bool    newIsPublished = myCheckBox.Checked;

        theGame.Attributes["isPublished"].InnerText = newIsPublished.ToString();

        // saving the XML file
        XmlDataSource1.Save();
        GridView1.DataBind();

        // showing modal
        if (newIsPublished)
        {
            publishGameModal_gameSubject.Text = Server.UrlDecode(xmlDoc.SelectNodes("/project/game[@gameCode=" + theGame.Attributes["gameCode"].InnerXml + "]/subject").Item(0).InnerText);
            publishGameModal_gameCode.Text    = Server.UrlDecode(theGame.Attributes["gameCode"].InnerXml);

            publishGameModal.Style.Add("display", "block");
            publishGameModal.Style.Add("display", "block");
            modalBackdrop.Style.Add("display", "block");
        }
    }
示例#19
0
 protected void XmlDataSource1_Load(object sender, EventArgs e)
 {
     if (XmlDataSource1.GetXmlDocument().DocumentElement.Attributes["guid"].Value == "")
     {
         Response.Redirect("~/Courses");
     }
 }
示例#20
0
    public bool CheckIfIsPublished(string gameCode)
    {
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
        XmlNode     myGame = xmlDoc.SelectSingleNode("/project/game[@gameCode=" + gameCode + "]");

        bool isPublished = myGame.Attributes["isPublished"].InnerXml == "True" ? true : false;

        return(isPublished);
    }
示例#21
0
    public bool CheckIfCanPublish(string gameCode)
    {
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
        XmlNode     myGame = xmlDoc.SelectSingleNode("/project/game[@gameCode=" + gameCode + "]");

        bool canPublish = Convert.ToInt16(myGame.Attributes["questionsNumber"].InnerXml) >= 10 ? true : false;

        return(canPublish);
    }
示例#22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (ViewState["grau"] != null && ViewState["local"] != null)
     {
         XmlDataSource1.XPath = $"/cursos/curso[@grau='{ViewState["grau"]}' and @local = '{ViewState["local"]}']";
         XmlDataSource1.DataBind();
         GridView1.DataBind();
     }
 }
示例#23
0
    void deleteGame(string theId)
    {
        XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();

        deletedGameName.Text = Server.UrlDecode(xmlDoc.SelectNodes("/project/game[@gameCode=" + Session["theItemIdSession"] + "]/subject").Item(0).InnerText);

        confirmDeleteBtn.Attributes["data-id"] = theId;
        deleteGamePopup.Style.Add("display", "block");
        modalBackdrop.Style.Add("display", "block");
    }
示例#24
0
        protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            XmlDocument xdoc = XmlDataSource1.GetXmlDocument();
            XmlElement  feed = xdoc.SelectSingleNode("feeds/feed[@nome='" + e.OldValues["nome"] + "']") as XmlElement;

            feed.Attributes["nome"].Value = e.NewValues["nome"].ToString();
            feed.Attributes["url"].Value  = e.NewValues["url"].ToString();

            XmlDataSource1.Save();
        }
示例#25
0
    public string[] EmailAddressLookup(string typecode)
    {
        // using the xml file, find the email address element for the selected code from the drop down list
        XmlDocument doc          = XmlDataSource1.GetXmlDocument();
        XmlElement  root         = doc.DocumentElement;
        XmlNodeList nodes        = root.SelectNodes("/types/type[@Code='" + typecode + "']/emailaddress");
        string      emailaddress = nodes[0].ChildNodes[0].Value;

        string[] emaillist = emailaddress.Split(',');
        return(emaillist);
    }
示例#26
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);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string xml = HtmlScraper.GetHtmlAsXml().OuterXml;

        XmlDataSource1.Data = xml;
        Trace.Write("INFO", xml);
        XmlDataSource1.DataBind();
        Trace.Write("Info", "PRE BIND: Repeater Item Count " + this.Repeater1.Items.Count);
        this.Repeater1.DataBind();
        Trace.Write("Info", "POST BIND: Repeater Item Count " + this.Repeater1.Items.Count);
    }
示例#28
0
    //מחיקת משחק
    void deleteRow(string theItemId)
    {
        //הסרת ענף של משחק קיים באמצעות זיהוי האיי דיי שניתן לו על ידי לחיצה עליו מתוך הטבלה
        //שמירה ועדכון לתוך העץ ולגריד ויו
        XmlDocument Document = XmlDataSource1.GetXmlDocument();
        XmlNode     node     = Document.SelectSingleNode("/games/game[@id='" + theItemId + "']");

        node.ParentNode.RemoveChild(node);
        XmlDataSource1.Save();
        GridView1.DataBind();
    }
示例#29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XmlDocument xmlDoc          = XmlDataSource1.GetXmlDocument();
        var         questionsNumber = Convert.ToInt16(Server.UrlDecode(xmlDoc.SelectSingleNode("/project/game[@gameCode=" + Session["theItemIdSession"] + "]").Attributes["questionsNumber"].InnerText));

        qNumber.Text     = questionsNumber.ToString();
        gameSubject.Text = Server.UrlDecode(xmlDoc.SelectSingleNode("/project/game[@gameCode=" + Session["theItemIdSession"] + "]/subject").InnerXml);

        ifCanPublishText.Text     = (questionsNumber >= 10) ? "ניתן לפרסם את המשחק" : "לפחות 10 שאלות לפרסום";
        ifCanPublishText.CssClass = (questionsNumber >= 10) ? "mr-4 text-success" : "mr-4 text-danger";
    }
        protected void Delete(object sender, GridViewDeleteEventArgs e)
        {
            GridView1.DataBind();
            XmlDocument xdoc = XmlDataSource1.GetXmlDocument();
            XmlElement  rss  = xdoc.SelectSingleNode("feedList/feed[@url='" + e.Values["url"] + "']") as XmlElement;

            xdoc.DocumentElement.RemoveChild(rss);
            XmlDataSource1.Save();

            Response.Redirect("edit_rss.aspx");
        }