RadCoverFlow

8 posts, 1 answers
  1. noman nadeem
    noman nadeem avatar
    27 posts
    Member since:
    Aug 2009

    Posted 17 Aug 2009 Link to this post

    Hi!
    i am using RadCoverflow i want to used a Stack panel in converflowitem and in stack panel i want to used telerik grid or telerik tree control please help :



    some code are below in which using textblock in stackpanel (There is no error but no textblock or stackpanel shown in output)

    please provide me sample code or application thanks a lot.
    Take care




     <telerikNavigation:RadCoverFlow x:Name="coverFlow" ItemMaxHeight="160"
                    ReflectionStartAlpha="{Binding ReflectionStartAlpha, Mode=OneWay}"
                    ReflectionRelativeHeight="{Binding ReflectionRelativeHeight, Mode=OneWay}"
                    CameraY="{Binding CameraY, Mode=OneWay}" VerticalAlignment="Center"
                    SelectedIndex="10" CenterOffsetY="{Binding CenterOffsetY, Mode=OneWay}"
                    NavigationPanelVisibility="{Binding NavigationPanelVisibility, Mode=OneWay}">
                <telerikNavigation:RadCoverFlow.ItemsPanel>
                    <ItemsPanelTemplate>
                        <telerikNavigation:AutoCenterPanel x:Name="Container" CenterOffsetX="0"
                                CenterOffsetY="{TemplateBinding CenterOffsetY}">
                            <telerikNavigation:AutoCenterPanel.ArrangeStrategy>
                                <telerikNavigation:PositionsBasedArrangeStrategy>
                                    <telerikNavigation:PositionsBasedArrangeStrategy.PositionDefinitions>
                                        <telerikNavigation:RelativeWidthPositionDefinition
                                                PositionRelativeWidth="1.1" />
                                        <telerikNavigation:RelativeWidthPositionDefinition
                                                PositionRelativeWidth="0.3" />
                                    </telerikNavigation:PositionsBasedArrangeStrategy.PositionDefinitions>
                                </telerikNavigation:PositionsBasedArrangeStrategy>
                            </telerikNavigation:AutoCenterPanel.ArrangeStrategy>
                            <telerikNavigation:AutoCenterPanel.SlideAnimation>
                                <Storyboard Storyboard.TargetName="Container"
                                        Storyboard.TargetProperty="SlideProgress">
                                    <DoubleAnimation Duration="0:0:0.300" To="100" />
                                </Storyboard>
                            </telerikNavigation:AutoCenterPanel.SlideAnimation>
                        </telerikNavigation:AutoCenterPanel>
                    </ItemsPanelTemplate>
                </telerikNavigation:RadCoverFlow.ItemsPanel>

                <StackPanel Background="#D9D7B9"  Width="360" Height="360" >

                    <TextBlock Text="Education" FontSize="20" Foreground="Brown"  ></TextBlock>

                  
                </StackPanel>


                <Image Source= "App_Themes/images/01.jpg" />
                <Image Source="App_Themes/images/02.jpg" />
                <Image Source="App_Themes/images/03.jpg" />
                <Image Source="App_Themes/images/04.jpg" />
                <Image Source="App_Themes/images/05.jpg" />
                <Image Source="App_Themes/images/06.jpg" />
                <Image Source="App_Themes/images/07.jpg" />
                <Image Source="App_Themes/images/08.jpg" />
                <Image Source="App_Themes/images/09.jpg" />
                <Image Source="/CoverFlow/Images/nature10.png" />
                <Image Source="/CoverFlow/Images/nature11.png" />
                <Image Source="/CoverFlow/Images/nature12.png" />
                <Image Source="/CoverFlow/Images/nature13.png" />
                <Image Source="/CoverFlow/Images/nature14.png" />
                <Image Source="/CoverFlow/Images/nature15.png" />
                <Image Source="/CoverFlow/Images/nature16.png" />
                <Image Source="/CoverFlow/Images/nature17.png" />
                <Image Source="/CoverFlow/Images/nature18.png" />
                <Image Source="/CoverFlow/Images/nature19.png" />
                <Image Source="/CoverFlow/Images/nature20.png" />
                <Image Source="/CoverFlow/Images/nature21.png" />
            </telerikNavigation:RadCoverFlow>
  2. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 17 Aug 2009 Link to this post

    I believe the current SF, only shows images and not other elements to interact with!
  3. DevCraft banner
  4. noman nadeem
    noman nadeem avatar
    27 posts
    Member since:
    Aug 2009

    Posted 17 Aug 2009 Link to this post

    Hi Ben
    There is any control which i can use like this as cover control i want to show data in that style
    please tell me if we can so how
    there is any sample project
    thanks

  5. Answer
    Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 19 Aug 2009 Link to this post

    After checking with one of the PMs, looks like Telerik is on it's way to provide a more comprehensive CF that can accomodate for UIElement controls. If you can wait, this would be a good solution.
  6. noman nadeem
    noman nadeem avatar
    27 posts
    Member since:
    Aug 2009

    Posted 20 Aug 2009 Link to this post

    Hi Ben ,
    can u help me please
    i am using webservice in silverlight application its running fantastic in local machine but when i upload the site in the hosting server
    the data is not showing at all , i dont understand that its a issue of services or what


    Detail
    i used session in services for showing current user data and now i fixed the userid in queury but still data is not showing after uploading
    i just publish my site and upload it , its automatically include the silverlight project in it and also a xap file in client bin but i am not understand that how the service is run on server and why its not running
    please help or suggest me how to upload and where i am wrong
    thanks in  advance

    Take Care

    Regards
    noman
  7. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 20 Aug 2009 Link to this post

    Noman, I think you would get a more direct response if you post it in the MS WCF section than the third party forum. Secondly, that's not the area that I'm very knowledgable. Sorry!
  8. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 21 Aug 2009 Link to this post

    Noman:

    You might want to look up the ClientAccessPolicy.Xml for your web services. I initially had a similar problem, which was hard to diagnosis because Silverlight has a catch all exception handler that can hide problems with calling the web services.

    For testing on the deployment server, you can add a line like the following to the Application_UnhandledException to make sure that you aren't missing anything.

     
                    System.Windows.Browser.HtmlPage.Window.Alert (e.ExceptionObject.Message); 
  9. noman nadeem
    noman nadeem avatar
    27 posts
    Member since:
    Aug 2009

    Posted 22 Aug 2009 Link to this post

    Hi Dennis!
    Thanks a lot i will try this definitely,  dennis  this  time  i am stuck on telerik tree can you help me , i am fetching data from dataserice but i am not able to make data source that is assign to telerk tree to make it dynamic , hierarchical tree.
    i am attaching my project with database please help me how to make dynamic hierarchal tree using web service , in back  i am using mysql. waiting for your favorable response .
    you can response on my id as well nomanforu@gmail.com thanks a lot in advance .ooooops i cant attached my project here can you give me your address this time i am sending you code down there .
    my problem is that i am not able to make make datasource.
    i am sending you my page.xaml.cs or page.xaml or my webservice


    Page.xaml
      
        <UserControl x:Class="T1.Page"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
           xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
           xmlns:local="clr-namespace:T1" Width="400" Height="300">
        <UserControl.Resources>
            <local:SectionsDataSource  x:Key="MyList" />
            <DataTemplate x:Key="section82">
                <TextBlock Text="{Binding Name}" />
            </DataTemplate>
            <telerik:HierarchicalDataTemplate x:Key="section81" ItemTemplate="{StaticResource section82}"
                   ItemsSource="{Binding section82s}">
                <TextBlock Text="{Binding Name}" />
            </telerik:HierarchicalDataTemplate>
            <telerik:HierarchicalDataTemplate x:Key="section8" ItemTemplate="{StaticResource section81}"
                   ItemsSource="{Binding section81s}">
                <TextBlock Text="{Binding Name}" />
            </telerik:HierarchicalDataTemplate>
        </UserControl.Resources>
        <Grid>
            <telerikNavigation:RadTreeView Height="300" Width="300"
                   ItemsSource="{Binding Source={StaticResource MyList}}"
                   ItemTemplate="{StaticResource section8}" />
        </Grid>
    </UserControl>








    Page.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    using System.ServiceModel;
    using System.Xml.Schema;
    using System.Xml.Linq;


    using System.Collections;
    using System.Windows.Threading;
    using System.ComponentModel;
    using Telerik.Windows.Controls;
    using Telerik.Windows.Controls.GridView;
    using Telerik.Windows;
    using Telerik.Windows.Data;
    using System.Collections.ObjectModel;

    namespace T1
    {
        public partial class Page : UserControl
        {
            public Page()
            {

                InitializeComponent();

                SectionsDataSource sd = new SectionsDataSource();
              
                Loaded += new RoutedEventHandler(sd.UserControl_Loaded);

              
              
                
     
            }
        }



        public class section8
        {
            //public string headingid { get; set; }
            public string headingname { get; set; }
            public section8(string name)
            {
                _name = name;
                _section81 = new List<section81>();
            }

            string _name;
            public string Name { get { return _name; } }
            List<section81> _section81;
            public List<section81> section81s { get { return _section81; } }

        }

        public class section81
        {
            //public string sub_heading_id1 { get; set; }
            public string heading_id1 { get; set; }
            public string sub_heading_name1 { get; set; }

            public section81(string name)
            {
                _name = name;
                _section82 = new List<section82>();
            }
            string _name;
            public string Name { get { return _name; } }
            List<section82> _section82;
            public List<section82> section82s { get { return _section82; } }


        }

        public class section82
        {
            //public string detail_id2 { get; set; }
            public string sub_heading_id2 { get; set; }
            public string Heading_id2 { get; set; }
            public string detail_text2 { get; set; }
            public section82(string name)
            {
                _name = name;
            }
            string _name;
            public string Name { get { return _name; } }


        }
        public class SectionsDataSource : List<section8>
        {
            List<Asection8> sectionList = new List<Asection8>();
            List<Asection81> sectionList1 = new List<Asection81>();
            List<Asection82> sectionList2 = new List<Asection82>();

            public class Asection8
            {
                public string headingid { get; set; }
                public string headingname { get; set; }

            }

            public class Asection81
            {
                public string sub_heading_id1 { get; set; }
                public string heading_id1 { get; set; }
                public string sub_heading_name1 { get; set; }



            }

            public class Asection82
            {
                public string detail_id2 { get; set; }
                public string sub_heading_id2 { get; set; }
                public string Heading_id2 { get; set; }
                public string detail_text2 { get; set; }


            }


            public void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                BasicHttpBinding bind = new BasicHttpBinding();

                bind.MaxReceivedMessageSize = 2147483647;
                bind.MaxBufferSize = 2147483647;

                //EndpointAddress endpoint = new EndpointAddress("http://localhost:51103/serviceTest_Web/myService.asmx");theSercice.myServiceSoapClient textureSoapClient = new serviceTest.theSercice.myServiceSoapClient(bind, endpoint);
                //textureSoapClient.RetrieveTextureAsync();

                //EndpointAddress endpoint = new EndpointAddress("http://localhost:51103/serviceTest_Web/myService.asmx"); theSercice.myServiceSoapClient textureSoapClient = new serviceTest.theSercice.myServiceSoapClient(bind, endpoint);

                //textureSoapClient.RetrieveTextureAsync();
                //textureSoapClient.RetrieveTextureCompleted +=  new EventHandler(textureSoapClient_RetrieveTextureCompleted);





                EndpointAddress endpoint = new EndpointAddress("http://localhost:1287/T1/WebService.asmx");
                //http://www.emmaculate.com/CareerM/
                //EndpointAddress endpoint = new EndpointAddress("http://www.emmaculate.com/CareerM/Profile.asmx");

                ServiceReference1.WebServiceSoapClient textureSoapClient = new ServiceReference1.WebServiceSoapClient(bind, endpoint);


                textureSoapClient.RetrieveTreeAsync();
                //.RetrieveTextureAsync();
                textureSoapClient.RetrieveTreeCompleted +=
                new EventHandler<ServiceReference1.RetrieveTreeCompletedEventArgs>(textureSoapClient_RetrieveTreeCompleted);



                //textureSoapClient.RetrieveTextureCompleted +=
                //new EventHandler<serviceTest.theSercice.RetrieveTextureCompletedEventArgs>(textureSoapClient_RetrieveTextureCompleted);

            }

            void textureSoapClient_RetrieveTreeCompleted(object sender, ServiceReference1.RetrieveTreeCompletedEventArgs e)
            {
                if (e.Error == null)

                    displayData(e.Result);

            }
            void displayData(string xmlContent)
            {

                try
                {
                    if (xmlContent != string.Empty)
                    {
                        XDocument xmlSections = XDocument.Parse(xmlContent);

                        // #region 0
                        var sections = from section8 in xmlSections.Descendants("section8")

                                       select new

                                       {
                                           headingid = (string)section8.Element("headingid").Value.PadLeft(10, '0'),
                                           headingname = (string)section8.Element("headingname").Value.PadLeft(10, '0')


                                       };





                        var sections1 = from section81 in xmlSections.Descendants("section81")

                                        select new

                                        {
                                            sub_heading_id1 = (string)section81.Element("sub_heading_id1").Value.PadLeft(10, '0'),
                                            heading_id1 = (string)section81.Element("headingid1").Value.PadLeft(10, '0'),
                                            subheadingname1 = (string)section81.Element("sub_heading_name1").Value.PadLeft(10, '0'),


                                            //txPath = (string)"http://www.texturearchive.com/thumbs/" + texture.Element("class1").Value + "/" + texture.Element("class2").Value + "/" + texture.Element("item").Value.PadLeft(10, '0') + "_" + texture.Element("Artist").Value.PadLeft(10, '0') + "_tn.jpg",

                                            // detailtext1 = (string)section81.Element("detailtext1").Value.PadLeft(10, '0')







                                        };



                        var sections2 = from section82 in xmlSections.Descendants("section82")

                                        select new

                                        {
                                            detailid2 = (string)section82.Element("detail_id2").Value.PadLeft(10, '0'),
                                            sub_heading_id2 = (string)section82.Element("sub_heading_id2").Value.PadLeft(10, '0'),
                                            heading_id2 = (string)section82.Element("Heading_id2").Value.PadLeft(10, '0'),
                                            //subheadingname2 = (string)section82.Element("subheadingname2").Value.PadLeft(10, '0'),

                                            detailtext2 = (string)section82.Element("detail_text2").Value.PadLeft(10, '0')







                                        };




                        //Bug: http://silverlight.net/forums/t/11147.aspx
                        //List<Asection8> sectionList = new List<Asection8>();
                        foreach (var t in sections)
                        {
                            Asection8 pdt = new Asection8 { headingid = t.headingid, headingname = t.headingname };


                            sectionList.Add(pdt);

                        }

                        //List<Asection81> sectionList1 = new List<Asection81>();
                        foreach (var t in sections1)
                        {
                            Asection81 pdt1 = new Asection81 { heading_id1 = t.heading_id1, sub_heading_id1 = t.sub_heading_id1, sub_heading_name1 = t.subheadingname1 };


                            sectionList1.Add(pdt1);

                        }

                        // List<Asection82> sectionList2 = new List<Asection82>();
                        foreach (var t in sections2)
                        {
                            Asection82 pdt2 = new Asection82 { Heading_id2 = t.heading_id2, sub_heading_id2 = t.sub_heading_id2, detail_id2 = t.detailid2, detail_text2 = t.detailtext2 };


                            sectionList2.Add(pdt2);

                        }


                        string text = "";
                        for (int a = 0; a < int.Parse(sectionList.Count.ToString()); a++)
                        {
                            for (int b = 0; b < int.Parse(sectionList1.Count.ToString()); b++)
                            {

                                for (int c = 0; c < int.Parse(sectionList2.Count.ToString()); c++)
                                {
                                    section8 l;
                                    section81 d;
                                    Add(l = new section8(sectionList1[0].ToString()));
                                    l.section81s.Add((d = new section81(sectionList2[0].ToString())));
                                    d.section82s.Add(new section82(sectionList[0].ToString()));
                                }

                            }

                        }
     
     
                        //string text="";
                        //for (int a=0;a<= int.Parse(sectionList.Count.ToString()) ; a++)
                        //{
                        //    for (int b=0;b<= int.Parse(sectionList1.Count.ToString()) ; b++)
                        //    {

                        //      for (int c=0;c<= int.Parse(sectionList2.Count.ToString()) ; c++)
                        //      {
                        //            section8 l;
                        //            section81 d;
                        //            Add(l = new section8(sectionList1[0].ToString() ));
                        //            l.section81s.Add((d = new section81(sectionList2[0].ToString())));
                        //           d.section82s.Add(new section82(sectionList[0].ToString()));
                        //      }

                        //    }

                        //}



                        //#endregion



                        // texturesDataGrid.ItemsSource = texturesList;
                        //CustomersGrid.ItemsSource = profilesList;

                        //RadTreeViewItem item = new RadTreeViewItem();
                        //                    item.ItemsSource = sectionList;
                        //item.DataContext = sectionList;
                        //RadTreeView rd = new RadTreeView();
                        //rd.DataContext = sectionList;



                    }

                    else
                    {

                        //errMessage.Visibility = Visibility.Visible;
                        //texturesDataGrid.ItemsSource = null;
                        //CustomersGrid.ItemsSource = null;
                    }

                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message);

                }

            }

            public SectionsDataSource()
            {


                //PropertyChangedEventHandler pe;
                //pe.Method = UserControl_Loaded;
     
                //EventHandler  Loaded ;
                //Loaded += PropertyChangedEventHandler(UserControl_Loaded);

                ////textureSoapClient.RetrieveTextureCompleted +=
                //new EventHandler<serviceTest.theSercice.RetrieveTextureCompletedEventArgs>(textureSoapClient_RetrieveTextureCompleted);

                //        RoutedEventHandler Loaded;
                //        Loaded +=new RoutedEventHandler(UserControl_Loaded);

                //////         RoutedEventHandler += new RoutedEventHandler(UserControl_Loaded);
                // UserControl_Loaded();

                //UserControl_Loaded(

                string text = "";
                for (int a = 0; a < int.Parse(sectionList.Count.ToString()); a++)
                {
                    for (int b = 0; b < int.Parse(sectionList1.Count.ToString()); b++)
                    {

                        for (int c = 0; c < int.Parse(sectionList2.Count.ToString()); c++)
                        {
                            section8 l;
                            section81 d;
                            Add(l = new section8(sectionList1[0].ToString()));
                            l.section81s.Add((d = new section81(sectionList2[0].ToString())));
                            d.section82s.Add(new section82(sectionList[0].ToString()));
                        }

                    }

                }



                //section8 l;
                //section81 d;
                //Add(l = new section8("1"));
                //l.section81s.Add((d = new section81("1")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));
                //d.section82s.Add(new section82("4"));
                //d.section82s.Add(new section82("5"));
                //l.section81s.Add((d = new section81("2")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));
                //d.section82s.Add(new section82("4"));
                //d.section82s.Add(new section82("5"));
                //l.section81s.Add((d = new section81("3")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));
                //d.section82s.Add(new section82("4"));
                //Add(l = new section8("2"));
                //l.section81s.Add((d = new section81("1")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));
                //l.section81s.Add((d = new section81("2")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));
                //d.section82s.Add(new section82("4"));
                //l.section81s.Add((d = new section81("3")));
                //d.section82s.Add(new section82("1"));
                //d.section82s.Add(new section82("2"));
                //d.section82s.Add(new section82("3"));

            }


        }





        public class League
        {
            public League(string name)
            {
                _name = name;
                _divisions = new List<Division>();
            }

            string _name;
            public string Name { get { return _name; } }
            List<Division> _divisions;
            public List<Division> Divisions { get { return _divisions; } }
        }
        public class Division
        {
            public Division(string name)
            {
                _name = name;
                _teams = new List<Team>();
            }
            string _name;
            public string Name { get { return _name; } }
            List<Team> _teams;
            public List<Team> Teams { get { return _teams; } }
        }
        public class Team
        {
            public Team(string name)
            {
                _name = name;
            }
            string _name;
            public string Name { get { return _name; } }
        }
        public class LeaguesDataSource : List<League>
        {
            public LeaguesDataSource()
            {
                League l;
                Division d;
                Add(l = new League("League A"));
                l.Divisions.Add((d = new Division("Division A")));
                d.Teams.Add(new Team("Team I"));
                d.Teams.Add(new Team("Team II"));
                d.Teams.Add(new Team("Team III"));
                d.Teams.Add(new Team("Team IV"));
                d.Teams.Add(new Team("Team V"));
                l.Divisions.Add((d = new Division("Division B")));
                d.Teams.Add(new Team("Team Blue"));
                d.Teams.Add(new Team("Team Red"));
                d.Teams.Add(new Team("Team Yellow"));
                d.Teams.Add(new Team("Team Green"));
                d.Teams.Add(new Team("Team Orange"));
                l.Divisions.Add((d = new Division("Division C")));
                d.Teams.Add(new Team("Team East"));
                d.Teams.Add(new Team("Team West"));
                d.Teams.Add(new Team("Team North"));
                d.Teams.Add(new Team("Team South"));
                Add(l = new League("League B"));
                l.Divisions.Add((d = new Division("Division A")));
                d.Teams.Add(new Team("Team 1"));
                d.Teams.Add(new Team("Team 2"));
                d.Teams.Add(new Team("Team 3"));
                d.Teams.Add(new Team("Team 4"));
                d.Teams.Add(new Team("Team 5"));
                l.Divisions.Add((d = new Division("Division B")));
                d.Teams.Add(new Team("Team Diamond"));
                d.Teams.Add(new Team("Team Heart"));
                d.Teams.Add(new Team("Team Club"));
                d.Teams.Add(new Team("Team Spade"));
                l.Divisions.Add((d = new Division("Division C")));
                d.Teams.Add(new Team("Team Alpha"));
                d.Teams.Add(new Team("Team Beta"));
                d.Teams.Add(new Team("Team Gamma"));
                d.Teams.Add(new Team("Team Delta"));
                d.Teams.Add(new Team("Team Epsilon"));
            }
        }



    }



    webservice.cs



    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Data;
    using MySql.Data;
    using MySql;
    using MySql.Data.MySqlClient;
    using System.Text;

    using System.ServiceModel.Configuration;
    using System.ServiceModel.Activation;
    using System.Security.Principal;
    using System.Web.Configuration;

    using System.Configuration;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;

    /// <summary>
    /// Summary description for WebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {

        public WebService()
        {

            //Uncomment the following line if using designed components
            //InitializeComponent();
        }

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }



        [WebMethod(EnableSession = true)]
        public string RetrieveTree()
        {

            try
            {
                MySqlConnection _mysqlConnection = new MySqlConnection();
                _mysqlConnection.ConnectionString = ConfigurationManager.ConnectionStrings["CMMysql"].ToString();
                _mysqlConnection.Open();
                // //8education
                string userid = "1";
                string profileid = "5";
                //if (HttpContext.Current.Session["Userid"].ToString() == "" || HttpContext.Current.Session["Userid"].ToString() == null)
                //    userid = "1";
                //else
                //    userid = HttpContext.Current.Session["Userid"].ToString();


                //if (HttpContext.Current.Session["Profileid"].ToString() == "" || HttpContext.Current.Session["Profileid"].ToString() == null)
                //    profileid = "4";
                //else
                //    profileid = HttpContext.Current.Session["Profileid"].ToString();

                //8//education
                MySqlDataAdapter da = new MySqlDataAdapter();
                //da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=8 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                da.SelectCommand = new MySqlCommand("select * from tbl_heading where section_id=8 and user_id = " + userid + " and profile_id=" + profileid, _mysqlConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
               
                string hid= ds.Tables[0].Rows[0]["heading_id"].ToString();
     

                //8//education
                MySqlDataAdapter da1 = new MySqlDataAdapter();
                //da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=8 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                da1.SelectCommand = new MySqlCommand("select * from tbl_sub_heading where heading_id="+hid , _mysqlConnection);

                DataSet ds1 = new DataSet();
                da1.Fill(ds1);

                string shid = ds1.Tables[0].Rows[0]["sub_heading_id"].ToString();


                //8//education
                MySqlDataAdapter da2 = new MySqlDataAdapter();
                //da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=8 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                da2.SelectCommand = new MySqlCommand("select * from tbl_heading_details where heading_id="+hid + " and sub_heading_id="+shid , _mysqlConnection);

                DataSet ds2 = new DataSet();
                da2.Fill(ds2);



                ////1//7experience
                //MySqlDataAdapter da1 = new MySqlDataAdapter();
                ////da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da1.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=7 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                //DataSet ds1 = new DataSet();
                //da1.Fill(ds1);

                ////2//4Achievement
                ////3//9recomendation
                ////4//10links
                ////5 //3careerhighlights


                ////2//4Achievement
                //MySqlDataAdapter da2 = new MySqlDataAdapter();
                ////da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da2.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=4 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                //DataSet ds2 = new DataSet();
                //da2.Fill(ds2);



                ////3//9recomendation
                //MySqlDataAdapter da3 = new MySqlDataAdapter();
                ////da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da3.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=9 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                //DataSet ds3 = new DataSet();
                //da3.Fill(ds3);


                ////4//10links
                //MySqlDataAdapter da4 = new MySqlDataAdapter();
                ////da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da4.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=10 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                //DataSet ds4 = new DataSet();
                //da4.Fill(ds4);


                ////5 //3careerhighlights
                //MySqlDataAdapter da5 = new MySqlDataAdapter();
                ////da.SelectCommand = new MySqlCommand("SELECT t.itemId,t.Artist,t.class1,t.class2,t.Path,c.colorid,c.itemid,c.colorname,c.price FROM Texture t,texturecolor c where t.itemId=c.itemid LIMIT 0, 20", _mysqlConnection);
                //da5.SelectCommand = new MySqlCommand("select thd.detail_id,thd.sub_heading_id,thd.heading_id,thd.detail_text,thd.detail_html , th.heading_id,th.heading_name ,th.user_id,tsh.sub_heading_id,tsh.sub_heading_name , tsh.heading_id  from tbl_heading_details thd , tbl_heading th , tbl_sub_heading tsh where thd.heading_id = th.heading_id and thd.sub_heading_id = tsh.sub_heading_id and th.section_id=3 and th.user_id = " + userid + " and profile_id= " + profileid, _mysqlConnection);
                //DataSet ds5 = new DataSet();
                //da5.Fill(ds5);






                StringBuilder sb = new StringBuilder();
                sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

                sb.Append("<sections>");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    sb.Append("<section8>");

                    sb.Append("<headingid>");

                    sb.Append(dr[0].ToString());

                    sb.Append("</headingid>");


                    sb.Append("<headingname>");

                    sb.Append(dr[1].ToString());

                    sb.Append("</headingname>");



                    sb.Append("</section8>");

                }


                foreach (DataRow dr1 in ds1.Tables[0].Rows)
                {
                    sb.Append("<section81>");



                    sb.Append("<sub_heading_id1>");

                    sb.Append(dr1[0].ToString());

                    sb.Append("</sub_heading_id1>");


                    sb.Append("<headingid1>");

                    sb.Append(dr1[1].ToString());

                    sb.Append("</headingid1>");


                    sb.Append("<sub_heading_name1>");

                    sb.Append(dr1[2].ToString());

                    sb.Append("</sub_heading_name1>");



                    sb.Append("</section81>");

                }



                foreach (DataRow dr2 in ds2.Tables[0].Rows)
                {
                    sb.Append("<section82>");



                    sb.Append("<detail_id2>");

                    sb.Append(dr2[0].ToString());

                    sb.Append("</detail_id2>");


                    sb.Append("<sub_heading_id2>");

                    sb.Append(dr2[1].ToString());

                    sb.Append("</sub_heading_id2>");


                    sb.Append("<Heading_id2>");

                    sb.Append(dr2[2].ToString());

                    sb.Append("</Heading_id2>");


                    sb.Append("<detail_text2>");

                    sb.Append(dr2[4].ToString());

                    sb.Append("</detail_text2>");


                    sb.Append("</section82>");

                }

                #region unused code
                //foreach (DataRow dr1 in ds1.Tables[0].Rows)
                //{
                //    sb.Append("<profile1>");
                //    sb.Append("<headingname1>");

                //    sb.Append(dr1[6].ToString());

                //    sb.Append("</headingname1>");

                //    sb.Append("<subheadingname1>");

                //    sb.Append(dr1[9].ToString());

                //    sb.Append("</subheadingname1>");


                //    sb.Append("<detailtext1>");

                //    sb.Append(dr1[3].ToString());

                //    sb.Append("</detailtext1>");


                //    sb.Append("</profile1>");

                //}






                //foreach (DataRow dr2 in ds2.Tables[0].Rows)
                //{
                //    sb.Append("<profile2>");
                //    sb.Append("<headingname2>");

                //    sb.Append(dr2[6].ToString());

                //    sb.Append("</headingname2>");

                //    sb.Append("<subheadingname2>");

                //    sb.Append(dr2[9].ToString());

                //    sb.Append("</subheadingname2>");


                //    sb.Append("<detailtext2>");

                //    sb.Append(dr2[3].ToString());

                //    sb.Append("</detailtext2>");


                //    sb.Append("</profile2>");

                //}





                //foreach (DataRow dr3 in ds3.Tables[0].Rows)
                //{
                //    sb.Append("<profile3>");
                //    sb.Append("<headingname3>");

                //    sb.Append(dr3[6].ToString());

                //    sb.Append("</headingname3>");

                //    sb.Append("<subheadingname3>");

                //    sb.Append(dr3[9].ToString());

                //    sb.Append("</subheadingname3>");


                //    sb.Append("<detailtext3>");

                //    sb.Append(dr3[3].ToString());

                //    sb.Append("</detailtext3>");


                //    sb.Append("</profile3>");

                //}




                //foreach (DataRow dr4 in ds4.Tables[0].Rows)
                //{
                //    sb.Append("<profile4>");
                //    sb.Append("<headingname4>");

                //    sb.Append(dr4[6].ToString());

                //    sb.Append("</headingname4>");

                //    sb.Append("<subheadingname4>");

                //    sb.Append(dr4[9].ToString());

                //    sb.Append("</subheadingname4>");


                //    sb.Append("<detailtext4>");

                //    sb.Append(dr4[3].ToString());

                //    sb.Append("</detailtext4>");


                //    sb.Append("</profile4>");

                //}



                //foreach (DataRow dr5 in ds5.Tables[0].Rows)
                //{
                //    sb.Append("<profile5>");
                //    sb.Append("<headingname5>");

                //    sb.Append(dr5[6].ToString());

                //    sb.Append("</headingname5>");

                //    sb.Append("<subheadingname5>");

                //    sb.Append(dr5[9].ToString());

                //    sb.Append("</subheadingname5>");


                //    sb.Append("<detailtext5>");

                //    sb.Append(dr5[3].ToString());

                //    sb.Append("</detailtext5>");


                //    sb.Append("</profile5>");

                //}

                #endregion



                sb.Append("</sections>");

                _mysqlConnection.Close();
                return sb.ToString();

            }
            catch (Exception ex)
            {
                return string.Empty;

            }



        }


    }





    Please tell me why its not getting datasource and generate hierarichal tree
    thanks in advance


    Regards
    noman
Back to Top
DevCraft banner