Beispiel #1
0
    void set_seatLayout()
    {
        Table objtable = new Table();

        objtable.CellPadding = 0;
        objtable.CellSpacing = 0;
        TableRow  objtr = new TableRow();
        TableCell objtd = new TableCell();

        string[] seat_val = new string[8];
        bool     isfilled = false;

        if (Session_value != null)
        {
            if (Session_value != "")
            {
                seat_val = Session_value.Split(',');
                isfilled = false;
            }
            else
            {
                Session.Abandon();
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                                                   " the transaction again');window.location.href='Default.aspx';</script>");
            }
            if (seat_val.Length < 6)
            {
                throw new Exception("Seat Layout cannot be done as session value is no valid Session: " + (isfilled ? Session_value : Session_value));
            }

            String filmCode = seat_val[0];
            String audiNo   = seat_val[3];
            cat     = seat_val[4];
            seatreq = seat_val[5];


            DataTable dtrows = GTICKV.SelectRow_AudiWise(filmCode);
            System.Diagnostics.Trace.Assert((dtrows == null), "Rows could not be fetched for selected Audi");

            int maxCol  = GTICKV.maxColumns(filmCode);
            int maxRows = GTICKV.maxRows(filmCode);

            DataTable dtseatlayout = GTICKV.AllSeats(audiNo);
            System.Diagnostics.Trace.Assert(dtseatlayout == null, "Rows could not be fetched for selected Audi");

            int temptablecellcount = 0, tablecell = 0;
            if (dtseatlayout.Rows.Count > 0 && dtrows.Rows.Count > 0)
            {
                //for each row up until maximum
                for (int tablerow = 0; tablerow < maxRows; tablerow++)
                {
                    DataRow drseats = dtrows.Rows[tablerow];
                    objtr = new TableRow();
                    objtable.Rows.Add(objtr);
                    objtd      = new TableCell();
                    objtd.Text = drseats[5].ToString();
                    objtr.Cells.Add(objtd);
                    for (tablecell = 0 + temptablecellcount; tablecell < maxCol + temptablecellcount; tablecell++)
                    {
                        DataRow drrow = dtseatlayout.Rows[tablecell];
                        objtd = new TableCell();
                        objtd.Attributes.Add("class", "pad");
                        if (drrow[3].ToString() == "1")
                        {
                            if (drrow[9].ToString() == "1" || drrow[11].ToString() == "1" || drrow[12].ToString() == "1")
                            {
                                objtd.Text = "<img src='Images/R_chair.gif'   />";
                            }
                            else if (drrow[10].ToString() == "1")
                            {
                                objtd.Text = "<img src='Images/Gy_chair.gif'   />";
                            }
                            else
                            {
                                if (drrow[6].ToString().ToLower() == seat_val[4].ToLower())
                                {
                                    objtd.Text = "<img src='Images/W_Chair.gif' alt='" + drrow[7] + " - " + drrow[13] + "' title='" + drrow[7] + " - " + drrow[13] + ", Price : " + String.Format("{0:#.##}", decimal.Parse(drrow[8].ToString())) + " INR'  />";
                                    objtd.ID   = "Seat_" + drrow[6] + "_" + drrow[2] + "_" + drrow[7].ToString() + "_" + drrow[0].ToString();
                                }
                                else
                                {
                                    objtd.Text = "<img src='Images/Gy_Chair.gif'    />";
                                }
                            }
                        }
                        objtr.Cells.Add(objtd);
                    }
                    objtd      = new TableCell();
                    objtd.Text = drseats[5].ToString();
                    objtr.Cells.Add(objtd);
                    temptablecellcount = tablecell;
                }
            }
            myform.Controls.Add(objtable);
        }
        else
        {
            Session.Abandon();
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                                               " the transaction again');window.location.href='Default.aspx';</script>");
        }
    }
Beispiel #2
0
    void set_seatLayout()
    {
        Table objtable = new Table();

        objtable.CellPadding = 0;
        objtable.CellSpacing = 0;
        TableRow  objtr = new TableRow();
        TableCell objtd = new TableCell();

        string[] seat_val = new string[4];
        bool     isfilled = false;

        if (Session_value != null)
        {
            if (Session_value != "")
            {
                seat_val = Session_value.Split(',');
                isfilled = false;
            }
            else
            {
                Session.Abandon();
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                                                   " the transaction again');window.location.href='Default.aspx';</script>");
            }

            if (seat_val.Length < 4)
            {
                throw new Exception("Seat Layout cannot be done as session value is no valid Session: " + (isfilled ? Session_value : Session_value));
            }


            String filmCode = seat_val[0];
            String audiNo   = seat_val[1];

            DataTable dtrows = GTICKV.SelectRow_AudiWise(filmCode);
            System.Diagnostics.Trace.Assert((dtrows == null), "Rows could not be fetched for selected Audi");

            int maxCol  = GTICKV.maxColumns(filmCode);
            int maxRows = GTICKV.maxRows(filmCode);

            // DataTable dtseatlayout = GTICKV.AllSeats(audiNo);
            DataTable dtseatlayout = GTICKV.Audit_AllSeats(audiNo);
            // DataTable dtseatlayout = GTICKV.AuditAllSeats(audiNo);
            System.Diagnostics.Trace.Assert(dtseatlayout == null, "Rows could not be fetched for selected Audi");

            int temptablecellcount = 0, tablecell = 0;
            if (dtseatlayout.Rows.Count > 0 && dtrows.Rows.Count > 0)
            {
                for (int tablerow = 0; tablerow < maxRows; tablerow++)
                {
                    DataRow drseats = dtrows.Rows[tablerow];
                    objtr = new TableRow();
                    objtable.Rows.Add(objtr);
                    objtd      = new TableCell();
                    objtd.Text = drseats[5].ToString();
                    objtr.Cells.Add(objtd);
                    for (tablecell = 0 + temptablecellcount; tablecell < maxCol + temptablecellcount; tablecell++)
                    {
                        DataRow drrow = dtseatlayout.Rows[tablecell];
                        objtd = new TableCell();
                        objtd.Attributes.Add("class", "pad");
                        if (drrow[3].ToString() == "1")
                        {
                            if (drrow[14].ToString() != "" && drrow[14].ToString() != null && int.Parse(drrow[15].ToString()) == 0)
                            {
                                Url = "Images/Unpaid_seat.gif";
                                //  if (drrow[6].ToString().ToLower() == seat_val[4].ToLower())
                                // {
                                objtd.Text = "<img src='" + Url + "' alt='" + drrow[7] + " - " + drrow[13] + "'  OnClick='myFunction1(this)' id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",U" + "'  />";
                                objtd.ID   = "Seat_" + drrow[6] + "_" + drrow[2] + "_" + drrow[7].ToString() + "_" + drrow[0].ToString();
                                otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",U" + "" + "~";
                            }
                            else if (drrow[9].ToString() == "1" || drrow[11].ToString() == "1" || drrow[12].ToString() == "1")
                            {
                                Url = "Images/W_Chair.gif";
                                //  if (drrow[6].ToString().ToLower() == seat_val[4].ToLower())
                                // {
                                objtd.Text = "<img src='" + Url + "' alt='" + drrow[7] + " - " + drrow[13] + "'  OnClick='myFunction1(this)' id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",B" + "'  />";
                                objtd.ID   = "Seat_" + drrow[6] + "_" + drrow[2] + "_" + drrow[7].ToString() + "_" + drrow[0].ToString();
                                otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",B" + "" + "~";
                            }
                            else
                            {
                                if (drrow[6].ToString() == "GLY")
                                {
                                    objtd.Text = "<img src='Images/Gallery_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "' />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "CO")
                                {
                                    objtd.Text = "<img src='Images/Copper_chair.gif' OnClick='myFunction1(this)' id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "'  />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "PL")
                                {
                                    objtd.Text = "<img src='Images/Platinum_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "'  />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "BZ")
                                {
                                    objtd.Text = "<img src='Images/Brown_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "'  />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "SL")
                                {
                                    objtd.Text = "<img src='Images/Silver_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "'  />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "DM")
                                {
                                    objtd.Text = "<img src='Images/Diamond_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "' />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                else if (drrow[6].ToString() == "GL")
                                {
                                    objtd.Text = "<img src='Images/Gold_chair.gif' OnClick='myFunction1(this)'  id='" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "' />";
                                    otu        = otu + "" + drrow[7] + "-" + drrow[13] + "," + DateTime.Now.ToString("dd/MM/yyyy") + "," + seat_val[2].ToString() + ",V" + "" + "~";
                                }
                                //  }
                                //else
                                //    objtd.Text = "<img src='../Images/Gy_Chair.gif' OnClick='myFunction(this)' id='" + drrow[7] + " - " + drrow[13] + ", Price : " + String.Format("{0:#.##}", decimal.Parse(drrow[8].ToString())) + " INR'   />";
                            }
                        }
                        objtr.Cells.Add(objtd);
                    }
                    objtd      = new TableCell();
                    objtd.Text = drseats[5].ToString();
                    objtr.Cells.Add(objtd);
                    temptablecellcount = tablecell;
                }
            }
            myform.Controls.Add(objtable);
        }
        else
        {
            Session.Abandon();
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                                               " the transaction again');window.location.href='Default.aspx';</script>");
        }
    }