C# .NET - Give code - Asked By Jahir on 23-Jun-14 01:38 PM

Earn up to 50 extra points for answering this tough question.
How to write code  to bring output like this: http://staging.ticketgoose.com/bookbustickets/services/TGSWS?wsdl
table name is getTripListV2


i have written code is error... it is webservice...
protected void Button1_Click(object sender, EventArgs e)

{


TGTravelServiceService ts = new TGTravelServiceService();

var data = ts.getTripDetailsV2("userid", "pwd", "71", "72", "10/06/2012", "OSB8R843444");

GridView1.DataSource = data.tripDetails.busLayoutList;

GridView1.DataBind();

}

Vikram Singh Saini replied to Jahir on 23-Jun-14 01:38 PM
Hello Amit,

I'm too testing the same web service from many days. But still not got solution. Here is the code part:

protected void btnGetStationList_Click(object sender, EventArgs e)
  {
    // Get station list
    TGTravelServiceService ts = new TGTravelServiceService();
 
    //var data = ts.getFromToStationIdList("vs00saini@gmail.com", "saini2186");
    //var data = ts.getFromToStationIdList("maddyrafi@gmail.com", "samerafi");
    // var trip = ts.getTripList("vs00saini@gmail.com", "sarita", "295", "84", "16/05/2012");
    var data = ts.getTripDetailsV2("vs00saini@gmail.com", "sarita", "71", "72", "10/06/2012", "OSB8R843444");
    //var data = ts.getStationList("maddyrafi@gmail.com", "samerafi");
 
    // Get station list displayed in gridview
    if (data.tripDetails != null)
    {
    grdStation.DataSource = data.tripDetails;
    grdStation.DataBind();
    }
    else
    {
    lblInfo.Text = "Received null response.";
    }   
  }

But I'm always getting any type of data as null.

However I have noticed in your code part that you are not getting null. Could you please share how you have done or anything. Might it helps us to discover solution with working code so far.
Jitendra Faye replied to Jahir on 26-May-12 12:45 AM
I have tried with that web service but the problem is that it is not returning any value.

And in your code you need to do following changes-

TGTravelServiceService ts = new TGTravelServiceService();

var data = ts.getTripDetailsV2("userid", "pwd", "71", "72", "10/06/2012", "OSB8R843444");

if(data!=null)
{
  GridView1.DataSource = data.tripDetails.busLayoutList;

  GridView1.DataBind();

}

Otherwise it will give error.

I am also getting null object, see this image-




It may be possible that the search criteria which you are giving based on that it is not returning any value.
Jahir replied to Jitendra Faye on 26-May-12 01:00 AM
put this userid and pwd and try again

javaapitest", "testing"

Jitendra Faye replied to Jahir on 26-May-12 01:20 AM
GOt it,

Change your code like this-

protected void Button2_Click(object sender, EventArgs e)
    {
      TGTravelServiceService ts = new TGTravelServiceService();
      var data = ts.getTripDetailsV2("javaapitest", "testing", "71", "72", "10/06/2012", "OSB8R843444");
       if(data!=null)
     {
       GridView1.DataSource = data.tripDetails.busLayoutList.ToList();
         GridView1.DataBind();
      }

    }

GridView Code-

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns ="true">
</asp:GridView>



Just include ToList() after getting result.

Result-



Jahir replied to Jitendra Faye on 26-May-12 01:22 AM
yes its comes output like that only but i want to display seat layout how ?
http://staging.ticketgoose.com/bookbustickets/services/TGSWS?wsdl# <complexType name="SeatDetailsDTO">
http://staging.ticketgoose.com/bookbustickets/services/TGSWS?wsdl# <sequence>
  <element name="cellType" nillable="true" type="soapenc:string" />
  <element name="columnNbr" type="xsd:int" />
  <element name="rowNbr" type="xsd:int" />
  <element name="seatNbr" nillable="true" type="soapenc:string" />
  </sequence>

this is the output from that how will i bring that pls tel me pls
Jahir replied to Jitendra Faye on 26-May-12 01:24 AM
pls Vickey F tel me how to bring bus seat layout kindly tel me pa... i am waiting....
Jahir replied to Jitendra Faye on 26-May-12 01:34 AM
r u busy ? vickey F. pls tel me how to bring image bus seat layout .... kindly help me i am tried this from 1week....
I hope you ...
Thanks Dear...
Chintan Vaghela replied to Jahir on 26-May-12 02:18 AM

Hello,

 

Can you send me Detail of SeatDetailsDTO[40] value?

   

     

    

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 23-Jun-14 01:38 PM
it has 39 only it doesit have 40, see this...

Jahir replied to Chintan Vaghela on 26-May-12 02:24 AM
SeatDetailsDTO[40] has no value here... it has only 39 see the previous list
Chintan Vaghela replied to Jahir on 26-May-12 02:39 AM
can you send me other screen shot linke 38,39 screen shot?
Jitendra Faye replied to Jahir on 26-May-12 03:27 AM
Actullay busLayoutList has 2 records

for each record we have record related to seatDetailsList.

If you want to show record of first busLayoutList  then use this code-


 protected void Button2_Click(object sender, EventArgs e)
    {
      TGTravelServiceService ts = new TGTravelServiceService();
      var data = ts.getTripDetailsV2("javaapitest", "testing", "71", "72", "10/06/2012", "OSB8R843444");
      GridView1.DataSource = data.tripDetails.busLayoutList[0].seatDetailsList.ToList();
      GridView1.DataBind();

    }

and If you want to show record of second busLayoutList  then use this code-

 protected void Button2_Click(object sender, EventArgs e)
    {
      TGTravelServiceService ts = new TGTravelServiceService();
      var data = ts.getTripDetailsV2("javaapitest", "testing", "71", "72", "10/06/2012", "OSB8R843444");
      GridView1.DataSource = data.tripDetails.busLayoutList[1].seatDetailsList.ToList();
      GridView1.DataBind();

    }

See result-




TRy this and let em know.

Jitendra Faye replied to Jahir on 26-May-12 04:25 AM
Hi Amit,

has your problem is solved?

Because I have Tested  here it is working fine.
Chintan Vaghela replied to Jahir on 26-May-12 05:14 AM

Hello,

Made two image for Display Assigned Seat and Reamain Seat.

-      img_selectedseat.gif

-      img_greenseat.gif

 

Now for loop in SeatDeatilDTO to Assign SeatNo, Status of Seat etc.

int Rows = 4; // Assign value of NoOfRowFields from your webServices BusLayoutList

    int Columns = 10;// Assign value of NoOfColumnsFields from your webServices BusLayoutList

 

    private void BindSheetDetail()

    {

    

      placeHolder.Controls.Clear();

      int tblRows = Rows;

      int tblCols = Columns;

      Table tbl = new Table();

      tbl.CellPadding = 0;

      tbl.CellSpacing = 5;

      placeHolder.Controls.Add(tbl);

      int imageCount = 1;

      int intValue = 0;

      for (int i = 0; i < tblRows; i++)

      {

        TableRow tr = new TableRow();

        for (int j = 0; j < tblCols; j++)

        {

 

          TableCell tc = new TableCell();

          tc.Height = Unit.Pixel(30);

          Table tblInner = new Table();

          tblInner.CellPadding = 0;

          tblInner.CellSpacing = 0;

          tblInner.Height = Unit.Pixel(15);

          tblInner.Width = Unit.Pixel(15);

          TableRow trInner = new TableRow();

          TableCell tcInner = new TableCell();

          Image img = new Image();

          // Check value for Assigned or not assigned (Based on this value assign image

          //Here set 3 for disply assigned image

          if (j == 3)

          {

            img.ImageUrl = "~/Images/img_selectedseat.gif";

          }

          else

          {

            img.ImageUrl = "~/Images/img_greenseat.gif";

          }

          img.ToolTip = "Seat No"; // Assgin value uisn .SeatDeatilDTO[intValue]["SeatNbr"].ToString();

          tcInner.Controls.Add(img);

          trInner.Cells.Add(tcInner);

          tblInner.Rows.Add(trInner);

          tc.Controls.Add(tblInner);

          tr.Cells.Add(tc);

          imageCount++;

          intValue++;

 

        }

        tbl.Rows.Add(tr);

      }

      ViewState["dynamictable"] = true;

    }

     

    

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 12:45 AM
Hai RB where  will i add this code in my .cs page, pls tel this
public void GetData()

{


TGTravelServiceService ts = new TGTravelServiceService();


var schleidvalue= (Session["id"].ToString());

var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

GridView1.DataSource = data.tripDetails.busLayoutList[0].seatDetailsList;

//GridView1.DataSource = data.tripDetails.busLayoutList[0, 1].seatDetailsList;

GridView1.DataBind();

var level = data.tripDetails.busLayoutList.Count();

for (int i = 0; i < level; i++)

{

var row = data.tripDetails.busLayoutList[i].nbrOfRows;

var col = data.tripDetails.busLayoutList[i].nbrOfColumns;

this.Rows = row;

this.Columns = col;

CreateDynamicTable();

}

}

private void CreateDynamicTable()

{
can i add here your code//

....... pls tel me

Chintan Vaghela replied to Jahir on 28-May-12 01:58 AM

Hello,

 

As per your requirement you want only display Layout for Seat then no need take GridView

 

You need to just Create seat layout dynamic

 

Take BusLayout[0] or  BusLayout[1] as per your requirement

 

Your logic become as following way

 

public void GetData()

    {

 

      TGTravelServiceService ts = new TGTravelServiceService();

 

      var schleidvalue = (Session["id"].ToString());

 

      var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

 

 

      var level = data.tripDetails.busLayoutList.Count();

      var row = data.tripDetails.busLayoutList[0].nbrOfRows;

      var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

      this.Rows = row;

      this.Columns = col;

      CreateDynamicTable();

 

    }

    private void CreateDynamicTable()

    {

      // Here Logic for Seat Layout

    }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 02:48 AM
Hai RB i need to display busLayoutList[1] also

 var row = data.tripDetails.busLayoutList[0].nbrOfRows;

    var col = data.tripDetails.busLayoutList[0].nbrOfColumns;


var row = data.tripDetails.busLayoutList[1].nbrOfRows;
var
col = data.tripDetails.busLayoutList[1].nbrOfColumns;

i want to display if the level 1 it has means it also i want to display if it has only level 0 means it is correct... but for level 1 how will i do it here R B ?
Jahir replied to Chintan Vaghela on 28-May-12 02:52 AM
i give you full code then change and give me how to apply buslayout 0 and buslayout 1, if i have output buslayout 0 this code want to execute then i have also buslayout 0 and buslayout 1 means the 2 lower upper 2 levels buslayout also i want to display here kindly giv clear code, what i want to change in this code....
 this is my full code:
public void GetData()

{


TGTravelServiceService ts = new TGTravelServiceService();

var schleidvalue= (Session["id"].ToString());

var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

var level = data.tripDetails.busLayoutList.Count();

for (int i = 0; i < level; i++)

{

var row = data.tripDetails.busLayoutList[i].nbrOfRows;

var col = data.tripDetails.busLayoutList[i].nbrOfColumns;

this.Rows = row;

this.Columns = col;

CreateDynamicTable();

}

}

private void CreateDynamicTable()

{

PlaceHolder1.Controls.Clear();


int tblRows = Rows;


int tblCols = Columns;


Table tbl = new Table();

tbl.CellPadding = 0;

tbl.CellSpacing = 5;

PlaceHolder1.Controls.Add(tbl);


int imageCount = 1;


int intValue = 0;


for (int i = 0; i < tblRows; i++)

{


TableRow tr = new TableRow();


for (int j = 0; j < tblCols; j++)

{


TableCell tc = new TableCell();

tc.Height =

Unit.Pixel(30);


Table tblInner = new Table();

tblInner.CellPadding = 0;

tblInner.CellSpacing = 0;

tblInner.Height =

Unit.Pixel(15);

tblInner.Width =

Unit.Pixel(15);


TableRow trInner = new TableRow();


TableCell tcInner = new TableCell();


Image img = new Image();


if (j == 3)

{

img.ImageUrl =

"img_selectedseat.gif";

}


else


{

img.ImageUrl =

"img_greenseat.gif";

}

img.ToolTip =

"Seat No"; // Assgin value uisn .SeatDeatilDTO[intValue]["SeatNbr"].ToString();


tcInner.Controls.Add(img);

trInner.Cells.Add(tcInner);

tblInner.Rows.Add(trInner);

tc.Controls.Add(tblInner);

tr.Cells.Add(tc);

imageCount++;

intValue++;

}

tbl.Rows.Add(tr);

}

ViewState[

"dynamictable"] = true;

}

Jahir replied to Chintan Vaghela on 28-May-12 03:10 AM
R B can you pls provide me details more.... pls.... i want to display buslayout[1] and buslayout[0] also, if it has buslayout[1] means it want to create that else it has onlt buslayout[0] means then it will give this output ...
pls provide me clear

public void GetData()

    {

 

    TGTravelServiceService ts = new TGTravelServiceService();

 

    var schleidvalue = (Session["id"].ToString());

 

    var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

 

 

    var level = data.tripDetails.busLayoutList.Count();

    var row = data.tripDetails.busLayoutList[0].nbrOfRows;

    var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

    this.Rows = row;

      this.Columns = col;

    CreateDynamicTable();

 

    }


private void CreateDynamicTable()
{
give clear code here to this function pls...
}

Chintan Vaghela replied to Jahir on 28-May-12 03:24 AM

Hello,

 

Create two Place Holder

 

  • One for Upper Level
  • One for Second Level

After then Check count of Level.

 

If Count greater then 1 it means there is two Level

 

Make your logic as following way

 

public void GetData()

    {

 

      TGTravelServiceService ts = new TGTravelServiceService();

      var schleidvalue = (Session["id"].ToString());

 

      var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

      var level = data.tripDetails.busLayoutList.Count();

      var row = data.tripDetails.busLayoutList[0].nbrOfRows;

      var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

      CreateDynamicTable(placeHolderLower);

      if (level > 1)

      {

        row = data.tripDetails.busLayoutList[1].nbrOfRows;

        col = data.tripDetails.busLayoutList[1].nbrOfColumns;

        CreateDynamicTable(placeHolderUpper);

      }

     

    }

 

Pass PlaceHolder as argument in CreateDynamic Function

 

private void CreateDynamicTable(PlaceHolder placeHolder)

    {

      placeHolder.Controls.Clear();

 

      int tblRows = Rows;

 

      int tblCols = Columns;

 

      Table tbl = new Table();

      tbl.CellPadding = 0;

      tbl.CellSpacing = 5;

      placeHolder.Controls.Add(tbl);

 

      int imageCount = 1;

 

    ::::::::::::::

    ::::::::::::::::::::::::

::::::::::::::

 

}

 

 

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 03:45 AM
I have error still
Error 1 The name 'placeHolderLower' does not exist in the current context
Error 2 The name 'placeHolderUpper' does not exist in the current context
 
here i am not using placeholder2 in my coding ?

public void GetData()

{


TGTravelServiceService ts = new TGTravelServiceService();

var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

var level = data.tripDetails.busLayoutList.Count();

var row = data.tripDetails.busLayoutList[0].nbrOfRows;

var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

CreateDynamicTable(placeHolderLower);

if (level > 1)

{

row = data.tripDetails.busLayoutList[1].nbrOfRows;

col = data.tripDetails.busLayoutList[1].nbrOfColumns;

CreateDynamicTable(placeHolderUpper);

}

}


private void CreateDynamicTable(PlaceHolder placeHolder)

{

PlaceHolder1.Controls.Clear();

int tblRows = Rows;

int tblCols = Columns;

Table tbl = new Table();

tbl.CellPadding = 0;

tbl.CellSpacing = 5;

PlaceHolder1.Controls.Add(tbl);


int imageCount = 1;

int intValue = 0;

for (int i = 0; i < tblRows; i++)

{

TableRow tr = new TableRow();

for (int j = 0; j < tblCols; j++)

{

TableCell tc = new TableCell();

tc.Height =

Unit.Pixel(30);

Table tblInner = new Table();

tblInner.CellPadding = 0;

tblInner.CellSpacing = 0;

tblInner.Height =

Unit.Pixel(15);

tblInner.Width = Unit.Pixel(15);

TableRow trInner = new TableRow();

TableCell tcInner = new TableCell();

Image img = new Image();

if (j == 3)

{

img.ImageUrl =

"img_selectedseat.gif";

}

else

{

img.ImageUrl = "img_greenseat.gif";

}

img.ToolTip =

"Seat No"; // Assgin value uisn .SeatDeatilDTO[intValue]["SeatNbr"].ToString();

tcInner.Controls.Add(img);

trInner.Cells.Add(tcInner);

tblInner.Rows.Add(trInner);

tc.Controls.Add(tblInner);

tr.Cells.Add(tc);

imageCount++;

intValue++;

}

tbl.Rows.Add(tr);

}

ViewState["dynamictable"] = true;

}

Jahir replied to Chintan Vaghela on 28-May-12 03:58 AM
see my previous code once clear RB is it enough code for my process...

see my code once fully  and tel me the error... pls, i got error here... i make placeholdelower as placeholder1 and  placeholdeupper as placeholder2 but still i am not getting the bus seat layout kindly see my code tel me what error....
pls i am waiting here....
Chintan Vaghela replied to Jahir on 28-May-12 03:59 AM

Hello,

 

Added Two PlaceHolder  or Change your PlaceHolder Name

 

<asp:PlaceHolder ID="placeHolderLower" runat="server"></asp:PlaceHolder>

 

<asp:PlaceHolder ID="placeHolderUpper" runat="server"></asp:PlaceHolder>

 

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 04:08 AM

previously i give my full code it is enough for my process or i need to to put this code anywhere here...

var level = data.tripDetails.busLayoutList.Count();


// for (int i = 0; i < level; i++)

// {

// var row = data.tripDetails.busLayoutList[i].nbrOfRows;

// var col = data.tripDetails.busLayoutList[i].nbrOfColumns;

// this.Rows = row;

// this.Columns = col;

// CreateDynamicTable();

// }


kindly see my code and tel me it is enough code to my requirement.... i have chenge placeholdername as placeholder1 and 2
Jahir replied to Chintan Vaghela on 28-May-12 04:09 AM
ok wait RB i check and tel me if the output comes or not for me ? here webservice error... wait i give you status.... keep online....
Jahir replied to Chintan Vaghela on 28-May-12 06:36 AM

How to display the seatnbr. in tooltip here...

img.ToolTip = "Seat No"; // Assgin value uisn .SeatDeatilDTO[intValue]["SeatNbr"].ToString();

Chintan Vaghela replied to Jahir on 28-May-12 06:59 AM

Hello,

Use busLayout.seatDetailsList[intValue].seatNbr.ToString();

 

Assing CreateDynamicTable function as following way

 

 

var level = data.tripDetails.busLayoutList.Count();

 

      var row = data.tripDetails.busLayoutList[0].nbrOfRows;

      var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

      CreateDynamicTable(placeHolderLower, data.tripDetails.busLayoutList[0]);

      if (level > 1)

      {

        row = data.tripDetails.busLayoutList[1].nbrOfRows;

        col = data.tripDetails.busLayoutList[1].nbrOfColumns;

        CreateDynamicTable(placeHolderUpper, data.tripDetails.busLayoutList[1]);

      }

 

Applied BusLayoutDTO in CreateDynamicTable Argument

 

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout)

    {

   .......................

   .......................

   .......................

img.ToolTip = busLayout.seatDetailsList[intValue].seatNbr.ToString();

   .......................

   .......................

   .......................

   .......................

    }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 07:41 AM
Error 4 No overload for method 'CreateDynamicTable' takes '2' arguments 
Error 5 No overload for method 'CreateDynamicTable' takes '2' arguments
Error 6 The name 'busLayout' does not exist in the current context

CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0]);

CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1]);


img.ToolTip = busLayout.seatDetailsList[intValue].seatNbr.ToString();

RB i am so much of  confuse in code... pls can you provide me proper code from first pls....

pls R B tel me code from first and clear give me full code from first.... pls.................

Jahir replied to Chintan Vaghela on 28-May-12 07:46 AM
can you pls provide me code from first and clear.... pls..........

i am confuse of the code... so pls....
Chintan Vaghela replied to Jahir on 28-May-12 07:59 AM

Hello,

 

Make your GetData and CreateDynamicTable Display Code

public void GetData()

    {

      TGTravelServiceService ts = new TGTravelServiceService();

      var schleidvalue = (Session["id"].ToString());

      var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

      var level = data.tripDetails.busLayoutList.Count();

      var row = data.tripDetails.busLayoutList[0].nbrOfRows;

      var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

      CreateDynamicTable(placeHolderLower, data.tripDetails.busLayoutList[0]);

      if (level > 1)

      {

        row = data.tripDetails.busLayoutList[1].nbrOfRows;

        col = data.tripDetails.busLayoutList[1].nbrOfColumns;

        CreateDynamicTable(placeHolderUpper, data.tripDetails.busLayoutList[1]);

      }

 

    }

 

 

 

    private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout)

    {

      placeHolder.Controls.Clear();

      int tblRows = Rows;

      int tblCols = Columns;

      Table tbl = new Table();

      tbl.CellPadding = 0;

      tbl.CellSpacing = 5;

      placeHolder.Controls.Add(tbl);

      int imageCount = 1;

      int intValue = 0;

      for (int i = 0; i < tblRows; i++)

      {

        TableRow tr = new TableRow();

        for (int j = 0; j < tblCols; j++)

        {

          TableCell tc = new TableCell();

          tc.Height = Unit.Pixel(30);

          Table tblInner = new Table();

          tblInner.CellPadding = 0;

          tblInner.CellSpacing = 0;

          tblInner.Height = Unit.Pixel(15);

          tblInner.Width = Unit.Pixel(15);

          TableRow trInner = new TableRow();

          TableCell tcInner = new TableCell();

          Image img = new Image();

          if (j == 3)

          {

            img.ImageUrl = "img_selectedseat.gif";

          }

          else

          {

            img.ImageUrl = "img_greenseat.gif";

          }

          img.ToolTip = busLayout.seatDetailsList[intValue].seatNbr.ToString();

          tcInner.Controls.Add(img);

          trInner.Cells.Add(tcInner);

          tblInner.Rows.Add(trInner);

          tc.Controls.Add(tblInner);

          tr.Cells.Add(tc);

          imageCount++;

          intValue++;

        }

        tbl.Rows.Add(tr);

      }

      ViewState["dynamictable"] = true;

 

    }

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 28-May-12 08:04 AM
Thank you RB... your code is always helpfull for me...
 here webservice is tempravary unavailable error... after its working i will workout this and inform you the status...
ok pls tel me how can i mark this is an answer... and it is more helpfull post in this forum.... i flag this post after that what i do ? how can i mark this for your points...
Chintan Vaghela replied to Jahir on 28-May-12 08:38 AM

If my post is helpful then reply back me like done, thank you etc. so I know my post is helpful you.

For point system leave it for Moderator.

 

Jahir replied to Chintan Vaghela on 28-May-12 08:44 AM
ok brother i will do it always.... and after if i use your code means it will get bus seat layout with image ?
here webservice problem so i cnt check it that now... i try that after that webservice error clear ....

if i use your code means it will get bus seat layout with image ?
Jahir replied to Chintan Vaghela on 28-May-12 09:05 AM
Hello brother webservice is working fine now...
 i check with your code... but its not displaying any output here ?
what i do brother ?
Jahir replied to Chintan Vaghela on 28-May-12 09:05 AM
i check with your code... but its not displaying any output here ?
Jahir replied to Chintan Vaghela on 28-May-12 09:06 AM
Hello brother your code is not working... its not giving any output here ?

i check with your code... but its not displaying any output here ?
Jahir replied to Chintan Vaghela on 28-May-12 09:15 AM
RB i am not getting any output here from your code RB ....

no output given here ....

what happen ............................ ?
Jahir replied to Chintan Vaghela on 28-May-12 09:48 AM
R B i didn't get any output of your code RB... kindly tel me anything....
i didnt get the seat layout of your code.... no output it comes of your code....
guide me dear.... i have only hope its you....
Chintan Vaghela replied to Jahir on 29-May-12 01:04 AM
Did you get any value in BusDetialLayout ?
Jahir replied to Chintan Vaghela on 29-May-12 01:25 AM
i didnt get output here... buslayout i am getting value i have above told...
i am not displaying the output ?
Chintan Vaghela replied to Jahir on 29-May-12 01:40 AM
Which output you display

 private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout)
    {

}

here busLayout?
Jahir replied to Chintan Vaghela on 29-May-12 01:46 AM
i am getting buslayout value but in output its not giving any layout image... and also i want to display tooltip seatno also... brother
Chintan Vaghela replied to Jahir on 29-May-12 02:23 AM
Check your Image Path....

WHere is your image for assing to Image?
Jahir replied to Chintan Vaghela on 29-May-12 02:40 AM
i am giving correct image path here...
i give my full code:
here in if (level > 1) it has replacing the placeholder... but i want to add the placeholder2 i want to display level 1 and level 2 also... kindly give me correct one...if it has level 2 means it also want to display in placeholder it has not level2 means it want to display only level1 its enough pls give me correct one for this...

public void GetData()

{


TGTravelServiceService ts = new TGTravelServiceService();

var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

if (data.tripDetails != null)

{

var level = data.tripDetails.busLayoutList.Count();

var row = data.tripDetails.busLayoutList[0].nbrOfRows;

var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

if (level > 1)

{

row = data.tripDetails.busLayoutList[1].nbrOfRows;

col = data.tripDetails.busLayoutList[1].nbrOfColumns;

CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[1], row, col);

}

GridView1.DataSource = data.tripDetails.busLayoutList[0].seatDetailsList;

GridView1.DataBind();

}

}

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout, int row, int col)

{

placeHolder.Controls.Clear();


int tblRows = row;

int tblCols = col;

Table tbl = new Table();

tbl.CellPadding = 0;

tbl.CellSpacing = 5;

int imageCount = 1;

int intValue = 0;

for (int i = 0; i < tblRows; i++)

{


TableRow tr = new TableRow();

for (int j = 0; j < tblCols; j++)

{


TableCell tc = new TableCell();

tc.Height = Unit.Pixel(30);

Table tblInner = new Table();

tblInner.CellPadding = 0;

tblInner.CellSpacing = 0;

tblInner.Height = Unit.Pixel(15);

tblInner.Width =

Unit.Pixel(15);

TableRow trInner = new TableRow();

TableCell tcInner = new TableCell();

Image img = new Image();

if (j == 3)

{

img.ImageUrl = "img_selectedseat.gif";

}


else

{

img.ImageUrl = "img_greenseat.gif";

}

img.ToolTip =

"Seat No:" + Convert.ToString(busLayout.seatDetailsList[intValue].seatNbr);

tcInner.Controls.Add(img);

trInner.Cells.Add(tcInner);

tblInner.Rows.Add(trInner);

tc.Controls.Add(tblInner);

tr.Cells.Add(tc);

imageCount++;

intValue++;

}

tbl.Rows.Add(tr);

}

placeHolder.Controls.Add(tbl);

ViewState["dynamictable"] = true;

}

Chintan Vaghela replied to Jahir on 29-May-12 02:47 AM

Hello,

You need to Call CreateDynamicTable Two Time

First time you need to Pass PlaceHolder1 for Level1

After then second time you need to Pass PlaceHolder2 for Level2

 

Change your GetData function as following way

 

public void GetData()

    {

 

      TGTravelServiceService ts = new TGTravelServiceService();

      var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

 

      if (data.tripDetails != null)

      {

        var level = data.tripDetails.busLayoutList.Count();

 

        var row = data.tripDetails.busLayoutList[0].nbrOfRows;

        var col = data.tripDetails.busLayoutList[0].nbrOfColumns;

        CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0], row, col);

        if (level > 1)

        {

          row = data.tripDetails.busLayoutList[1].nbrOfRows;

          col = data.tripDetails.busLayoutList[1].nbrOfColumns;

          CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1], row, col);

        }

        GridView1.DataSource = data.tripDetails.busLayoutList[0].seatDetailsList;

        GridView1.DataBind();

      }

    }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 02:56 AM
Perfect RB... Thank You... now i want

img.ToolTip =

"Seat No:" + Convert.ToString(busLayout.seatDetailsList[intValue].seatNbr);

if it is null in my code it wwill not display the image... then how will i change in my code ?

if it is null in my code it wwill not display the image... then how will i change in my code ?
Chintan Vaghela replied to Jahir on 29-May-12 03:17 AM

Hello,

Pass TripDetailsDTO to your Dynemic DataTable as following way

 

You need to take TripDetailsDTO. seatDetailList[intValue].seatNbr for Dispaly Seat Number

 

private void CreateDynamicTable(PlaceHolder placeHolder, TripDetailsDTO TripDetail, int row, int col)

    {

 

img.ToolTip = TripDetail.seatDetailList[intValue].seatNbr;

 

}

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 03:21 AM
Where i want to write this code ?

i write out of the createdynamictable function means it shows error...

Error 4 The name 'img' does not exist in the current context D:\maddy\online\getTripDetailsV2.aspx.cs 377 9 D:\maddy\online\
Error 5 The name 'intValue' does not exist in the current context D:\maddy\online\getTripDetailsV2.aspx.cs 377 49 D:\maddy\online\

createdynamictable ()function code//
placeHolder.Controls.Add(tbl);

ViewState["dynamictable"] = true;

}


private void CreateDynamicTable(PlaceHolder placeHolder, TripDetailsDTO TripDetail, int row, int col)

{

img.ToolTip = TripDetail.seatDetailList[intValue].seatNbr;

}

Chintan Vaghela replied to Jahir on 29-May-12 03:21 AM
Pass row as column


Column as Row following way

    var row = data.tripDetails.busLayoutList[0].nbrOfColumns;
        var col = data.tripDetails.busLayoutList[0].nbrOfRows;
Chintan Vaghela replied to Jahir on 29-May-12 03:25 AM

Hello, Added Code as following way

   private void CreateDynamicTable(PlaceHolder placeHolder, TripDetailsDTO TripDetail, int row, int col)

    {

      placeHolder.Controls.Clear();

      int tblRows = row;

      int tblCols = col;

      Table tbl = new Table();

      tbl.CellPadding = 0;

      tbl.CellSpacing = 5;

      placeHolder.Controls.Add(tbl);

      int imageCount = 1;

      int intValue = 0;

      for (int i = 0; i < tblRows; i++)

      {

        TableRow tr = new TableRow();

        for (int j = 0; j < tblCols; j++)

        {

          TableCell tc = new TableCell();

          tc.Height = Unit.Pixel(30);

          Table tblInner = new Table();

          tblInner.CellPadding = 0;

          tblInner.CellSpacing = 0;

          tblInner.Height = Unit.Pixel(15);

          tblInner.Width = Unit.Pixel(15);

          TableRow trInner = new TableRow();

          TableCell tcInner = new TableCell();

          Image img = new Image();

          if (j == 3)

          {

            img.ImageUrl = "img_selectedseat.gif";

          }

          else

          {

            img.ImageUrl = "img_greenseat.gif";

          }

          img.ToolTip = TripDetail.seatDetailList[intValue].seatNbr;

          tcInner.Controls.Add(img);

          trInner.Cells.Add(tcInner);

          tblInner.Rows.Add(trInner);

          tc.Controls.Add(tblInner);

          tr.Cells.Add(tc);

          imageCount++;

          intValue++;

        }

        tbl.Rows.Add(tr);

      }

      ViewState["dynamictable"] = true;

 

    }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 03:37 AM
Error RB...

Index was outside the bounds of the array.

i select mdu chennai 30/05/2012, fare 450,570.00 in that i will select check that

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout,TripDetailsDTO TripDetail, int row, int col)

{

placeHolder.Controls.Clear();


int tblRows = row;

int tblCols = col;

Table tbl = new Table();

tbl.CellPadding = 0;

tbl.CellSpacing = 5;

int imageCount = 1;

int intValue = 0;

for (int i = 0; i < tblRows; i++)

{


TableRow tr = new TableRow();

for (int j = 0; j < tblCols; j++)

{


TableCell tc = new TableCell();

tc.Height = Unit.Pixel(30);

Table tblInner = new Table();

tblInner.CellPadding = 0;

tblInner.CellSpacing = 0;

tblInner.Height = Unit.Pixel(15);

tblInner.Width =

Unit.Pixel(15);

TableRow trInner = new TableRow();

TableCell tcInner = new TableCell();

Image img = new Image();

if (j == 3)

{

img.ImageUrl = "img_selectedseat.gif";

}


else

{

img.ImageUrl = "img_greenseat.gif";

}


img.ToolTip = TripDetail.seatDetailList[intValue].seatNbr;

tcInner.Controls.Add(img);

trInner.Cells.Add(tcInner);

tblInner.Rows.Add(trInner);

tc.Controls.Add(tblInner);

tr.Cells.Add(tc);

imageCount++;

intValue++;

}

tbl.Rows.Add(tr);

}

placeHolder.Controls.Add(tbl);

ViewState["dynamictable"] = true;

}

Chintan Vaghela replied to Jahir on 29-May-12 03:49 AM
Can you send me TripDetail.seatDetailList  screen shot?
Jahir replied to Chintan Vaghela on 23-Jun-14 01:40 PM

data.tripDetails.seatDetailList.ToList();

Jahir replied to Chintan Vaghela on 29-May-12 04:10 AM
i want to put this or this ?

private void CreateDynamicTable(PlaceHolder placeHolder, TripDetailsDTO TripDetail, int row, int col)

or this


private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout, TripDetailsDTO TripDetail,int row, int col)


CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0],data.tripDetails, row, col);


if (level > 1)

{

col = data.tripDetails.busLayoutList[1].nbrOfRows;

row = data.tripDetails.busLayoutList[1].nbrOfColumns;

CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1], data.tripDetails, row, col);

}

Here want i to write tel me clearly pls....
and i want to display the placeholder center of the page but its displaying rightside corner....
Chintan Vaghela replied to Jahir on 29-May-12 04:30 AM

Hello,

 

Declare Place holder inside Table

 

<table width="100%">

      <tr>

        <td align="center">

          <asp:PlaceHolder ID="placeHolder1" runat="server"></asp:PlaceHolder>

        </td>

      </tr>

      <tr>

        <td align="center">

          <asp:PlaceHolder ID="placeHolder2" runat="server"></asp:PlaceHolder>

        </td>

      </tr>

    </table>

 

 

Use following

 

private void CreateDynamicTable(PlaceHolder placeHolder, TripDetailsDTO TripDetail, int row, intcol)

Give me Detail of TripDetail.seatDetailList  in CS page

 

 

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 05:40 AM
RB booked images are one image and available seats are another image i want to bring like that ...
but this code is not showing like that ... ?
Jahir replied to Chintan Vaghela on 29-May-12 05:54 AM
i want to complete this within 2days... kindly help me pls...
in your code this is not getting the correctly the available seats and booked seats....
i want to display that correctly... booked seat means one image and available seat means another image i want to display here....

Image img = new Image();

if (j == 3)

{

img.ImageUrl = "img_selectedseat.gif";

}


else

{

img.ImageUrl = "img_greenseat.gif";

}

Jahir replied to Chintan Vaghela on 29-May-12 06:24 AM
RB......................

pls i want to display the booked seats are one image and available seats are another image....
This is my full code:

public void GetData()

{


TGTravelServiceService ts = new TGTravelServiceService();

var data = ts.getTripDetailsV2("userid", "pwd", Session["origin"].ToString(), Session["destination"].ToString(), Session["date"].ToString(), Session["id"].ToString());

if (data.tripDetails != null)

{

var level = data.tripDetails.busLayoutList.Count();

var col = data.tripDetails.busLayoutList[0].nbrOfRows;

var row = data.tripDetails.busLayoutList[0].nbrOfColumns;

CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0],data.tripDetails, row, col);


if (level > 1)

{

col = data.tripDetails.busLayoutList[1].nbrOfRows;

row = data.tripDetails.busLayoutList[1].nbrOfColumns;

CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1], data.tripDetails, row, col);

} }

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout, TripDetailsDTO TripDetail,int row, int col)

{

placeHolder.Controls.Clear();

int tblRows = row;

int tblCols = col;

Table tbl = new Table();

tbl.CellPadding = 10;

tbl.CellSpacing = 4;

int imageCount = 1;

int intValue = 0;

for (int i = 0; i < tblRows; i++)

{

TableRow tr = new TableRow();

for (int j = 0; j < tblCols; j++)

{

TableCell tc = new TableCell();

tc.Height = Unit.Pixel(30);

Table tblInner = new Table();

tblInner.CellPadding = 0;

tblInner.CellSpacing = 0;

tblInner.Height = Unit.Pixel(15);

tblInner.Width = Unit.Pixel(15);

TableRow trInner = new TableRow();

TableCell tcInner = new TableCell();

Image img = new Image();

if (j == 3)

{

img.ImageUrl = "img_selectedseat.gif";

}

else

{

img.ImageUrl = "img_greenseat.gif";

}

img.ToolTip = (busLayout.seatDetailsList[intValue] == null || busLayout.seatDetailsList[intValue].seatNbr == null) ? "" : "Seat No:" + (busLayout.seatDetailsList[intValue].seatNbr.ToString());

if (String.IsNullOrEmpty(img.ToolTip))

{

img.Visible = false;

}

tcInner.Controls.Add(img);

trInner.Cells.Add(tcInner);

tblInner.Rows.Add(trInner);

tc.Controls.Add(tblInner);

tr.Cells.Add(tc);

imageCount++;

intValue++;

}

tbl.Rows.Add(tr);

}

placeHolder.Controls.Add(tbl);

ViewState["dynamictable"] = true;

}

Chintan Vaghela replied to Jahir on 29-May-12 06:51 AM

Hello,

Check seatStatus as following way TripDetail.seatDetailList[0].seatStatus 

 

Instead of 0 pass int value

 

if (TripDetail.seatDetailList[0].seatStatus != "A")

          {

            img.ImageUrl = "img_selectedseat.gif";

          }

          else

          {

            img.ImageUrl = "img_greenseat.gif";

          }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 06:55 AM
Rb i have put code like above shown... but it is noy giving correct layout it is orderchanging seats....

see this what i want to modify here...
see this lines and tel me pa...
CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0],data.tripDetails, row, col);
CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1], data.tripDetails, row, col);

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout, TripDetailsDTO TripDetail,int row, int col)

see these lines and correct it... pls provide full clear code again....

with include of this....
TripDetail.seatDetailList[0].seatStatus 

 

Instead of 0 pass int value

 

if (TripDetail.seatDetailList[0].seatStatus != "A")

      {

        img.ImageUrl = "img_selectedseat.gif";

      }

      else

      {

        img.ImageUrl = "img_greenseat.gif";

      }

Jahir replied to Chintan Vaghela on 29-May-12 07:02 AM
here i want to display booked seats also want to display here... available seats are also want t odisplay here....
but

if(TripDetail.seatDetailList[0].seatStatus!="A")

{

img.ImageUrl = "img_selectedseat.gif";

}


else

{

img.ImageUrl = "img_greenseat.gif";//it will display only available seats here.... else condition only runs here but if cond. also want to run here.... RB... then how to do it ?

}

Jahir replied to Chintan Vaghela on 29-May-12 07:46 AM
R b pls provide me clear full code i have doubts in my code... so send me correct one full code again pls....
want i to put here i dont know...
Rb i have put code like above shown... but it is noy giving correct layout it is orderchanging seats....

see this what i want to modify here...
see this lines and tel me pa...
CreateDynamicTable(PlaceHolder1, data.tripDetails.busLayoutList[0],data.tripDetails, row, col);
CreateDynamicTable(PlaceHolder2, data.tripDetails.busLayoutList[1], data.tripDetails, row, col);

private void CreateDynamicTable(PlaceHolder placeHolder, BusLayoutDTO busLayout, TripDetailsDTO TripDetail,int row, int col)

so pls provide clear once again full code to this pls....

Chintan Vaghela replied to Jahir on 29-May-12 07:46 AM

Hello,

Check seatStatus as following way

 

 

if (TripDetail.seatDetailList[intValue].seatStatus != "A")

          {

            img.ImageUrl = "img_selectedseat.gif";

          }

          else

          {

            img.ImageUrl = "img_greenseat.gif";

          }

 

Hope this helpful!

Thanks

 

 

 

Jahir replied to Chintan Vaghela on 29-May-12 07:56 AM
i have put like this only... but it displaying available seats and booked seats 2 are same images here displaying here...
i want different images to show here....
Chintan Vaghela replied to Jahir on 29-May-12 08:01 AM
Can you send me screen shot for TripDetail.seatDetailList with Status ?
Jahir replied to Chintan Vaghela on 29-May-12 08:48 AM
R B tel this RB, i want to rotate this place holder pls tel me that only ya pls....
Jahir replied to Chintan Vaghela on 29-May-12 09:03 AM
i want to rotate the place holder pls tel me how will i do that here... row adn col change means it is not giving correctly pls provide details pls
Chintan Vaghela replied to Jahir on 30-May-12 02:31 AM

Hello,

Made one style class tablerotate

 

<style type="text/css">

      .tablerotate

      {

        -moz-transform: rotate(90deg); /* FF3.5+ */

        position: fixed;

        padding-top: 50px;

        left:200px;

        filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);

      }

    </style>

 

Applied your Place holder into div tag and assign class tablerotate as following way

 

 

<div class="tablerotate">

      <table>

        <tr>

          <td align="center">

            <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

          </td>

        </tr>

        <tr>

          <td align="center">

            <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>

          </td>

        </tr>

      </table>

    </div>

Hope this helpful!

Thanks