/*
    /// <summary>
    /// Summary description for Data
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Data : System.Web.Services.WebService
    {
        [WebMethod]
        public bool GetDataFromClient(string clientName, System.Data.DataSet dsFromClient)
        {
            try
            {
                if (!System.IO.File.Exists(System.Configuration.ConfigurationManager.AppSettings["ProjectPath"] + System.Configuration.ConfigurationManager.AppSettings["DataFileName"]))
                {
                    XmlTextWriter textWritter = new XmlTextWriter(System.Configuration.ConfigurationManager.AppSettings["ProjectPath"] + System.Configuration.ConfigurationManager.AppSettings["DataFileName"], null);
                    textWritter.WriteStartDocument();
                    textWritter.WriteStartElement("Data");
                    textWritter.WriteEndElement();
                    textWritter.Close();
                }

                XmlDocument xmlDoc = new XmlDocument();

                xmlDoc.Load(System.Configuration.ConfigurationManager.AppSettings["ProjectPath"] + System.Configuration.ConfigurationManager.AppSettings["DataFileName"]);

                XmlElement subRoot = xmlDoc.CreateElement("Table");

                //Client
                XmlElement appendedElementClient = xmlDoc.CreateElement("Client");
                XmlText xmlTextClient = xmlDoc.CreateTextNode(clientName);
                appendedElementClient.AppendChild(xmlTextClient);
                subRoot.AppendChild(appendedElementClient);
                xmlDoc.DocumentElement.AppendChild(subRoot);

                //Property
                XmlElement appendedElementProperty = xmlDoc.CreateElement("Property");
                XmlText xmlTextProperty = xmlDoc.CreateTextNode(dsFromClient.Tables[0].TableName);
                appendedElementProperty.AppendChild(xmlTextProperty);
                subRoot.AppendChild(appendedElementProperty);
                xmlDoc.DocumentElement.AppendChild(subRoot);

                //Rows
                XmlElement appendedElementRows = xmlDoc.CreateElement("Rows");

                foreach (DataRow dr in dsFromClient.Tables[0].Rows)
                {
                    XmlElement appendedElementNewRow = xmlDoc.CreateElement("Element");
                    //Index
                    XmlElement appendedElementIndex = xmlDoc.CreateElement("Index");
                    XmlText xmlTextIndex = xmlDoc.CreateTextNode(dr[0].ToString());
                    appendedElementIndex.AppendChild(xmlTextIndex);
                    appendedElementNewRow.AppendChild(appendedElementIndex);
                    //Value
                    XmlElement appendedElementValue = xmlDoc.CreateElement("Value");
                    XmlText xmlTextValue = xmlDoc.CreateTextNode(dr[1].ToString());
                    appendedElementValue.AppendChild(xmlTextValue);
                    appendedElementNewRow.AppendChild(appendedElementValue);
                    appendedElementRows.AppendChild(appendedElementNewRow);
                }
                subRoot.AppendChild(appendedElementRows);
                xmlDoc.DocumentElement.AppendChild(subRoot);

                xmlDoc.Save(System.Configuration.ConfigurationManager.AppSettings["ProjectPath"] + System.Configuration.ConfigurationManager.AppSettings["DataFileName"]);


                //string sss = "";
                //XPathDocument document = new XPathDocument(System.Configuration.ConfigurationManager.AppSettings["ProjectPath"] + System.Configuration.ConfigurationManager.AppSettings["DataFileName"]);
                //XPathNavigator nav = document.CreateNavigator();

                //// Compile a standard XPath expression
                //XPathExpression expr;
                ////expr = nav.Compile("*/Rows/Element[*/Client=\"Tansel\" and */Property=\"X\"]");
                //expr = nav.Compile("*/Rows/Element[/Data/Client=\"" + "Tansel" + "\" and /Data/Property=\"" + "X" + "\"]");
                //XPathNodeIterator iterator = nav.Select(expr);

                //while (iterator.MoveNext())
                //{
                //    XPathNavigator nav2 = iterator.Current.Clone();
                //    sss = sss + "-" + nav2.Value;
                //}

                //return true;


                return true;
            }
            catch
            {
                return false;
            }            
        }
        */
