Monday, 3 February 2014

Online movie ticket booking project In Asp Net with c# (or) free download online cinema movie ticket booking c# asp .net

Online movie ticket booking project In Asp Net with c#

This project is basically aimed to provide the customers facility to book the movie tickets online. The pain of standing in queue at cinema hall window will be gone with help of this facility of online movie tickets booking. It is an automatic system. The customers will get the extra benefit of selecting the seats of their choice from seats layout. The customers will be able to make a choice of their own by riding through the website. User friendliness of website will help attract more customers to multiplex. Extra features of website like discounts, offers, advertises , movie details etc will help people to know about different movies and they will be attracted to the multiplex by seeing such facilities. Along with customers the employees at window booking of the multiplex will get very user friendly and smooth ride for booking process.

Code : asp.net and c# 
 Datebase : SQL

List of pages :


Admin panel pages differs from the normal web page. 
Admin panels are for managing the entire site whcih consist of following modules
 
1. Users
2. Contents
3. Permission of various pages.
4. Transactions (If website is performing any transaction)
5. Sending Newsletter ( If website has the provision for users to subscribe news letter).
So basically admin panels are for managing the website. So build/arrange your modules based on your actual website/webapplication.

Admin Pages :

AdminHome.aspx
AdminLogin.aspx
Create ddHallLayout.aspx
CreateTheatre.aspx
creatycity.aspx
InsertMovieInformation.aspx
ListOfBookedTickets.aspx
ListOfCancelledTicketd.aspx
DeleteUser.aspx
ListOfRegCandidates.aspx
ModifyRegUsers.aspx

UserLoginPages :

Index.aspx
Provided Login.aspx
Registration
.aspx
Forgot password
.aspx
Contactus.aspx
Change password
.aspx
Update User Details..aspx
List of Posted Jobs
.aspx
PrintTicket.aspx
SearchMovies
.aspx
SelectedMovie.aspx
ListofBookedTickets.aspx
CancelTickets.aspx
Gateway.aspx
ConfirmationShow.aspx
Selected  Movie :
In this page user has to choose movie , city , theatre, date and submit to next page.


Hall Layout Screen
using System;
usingSystem.Collections;
usingSystem.Configuration;
usingSystem.Data;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
usingSystem.Xml.Linq;
usingSystem.Data.SqlClient;
usingSystem.Globalization;

namespaceBookFilmTickets
{
    public partial class Index : System.Web.UI.Page
    {
        SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
        protectedvoid Page_Load(objectsender, EventArgs e)
        {
            if(!IsPostBack)
            {
                stringstr = "select distinct  city from moviedata";
                SqlDataAdapteradp = new SqlDataAdapter(str, con);
                DataSetds = new DataSet();
                adp.Fill(ds);
                Ddlcity.DataSource = ds;
                Ddlcity.DataBind();
                Ddlcity.Items.Insert(0, new ListItem("--Select city--","0"));
                Ddlmovie.Items.Insert(0, new ListItem("--Select movie--", "0"));
                Ddltheatre.Items.Insert(0, new ListItem("--Select theatre--", "0"));
            }
        }

        protectedvoid Ddlcity_SelectedIndexChanged(object sender, EventArgse)
        {
            Ddlmovie.Items.Clear();
            stringct = Ddlcity.SelectedValue.ToString();
            stringstr = "select movie from moviedata where city= '" + ct + "' ";
            SqlDataAdapteradp = new SqlDataAdapter(str, con);
            DataSetds = new DataSet();
            adp.Fill(ds);
            Ddlmovie.DataSource = ds;
            Ddlmovie.DataBind();
            Ddlmovie.Items.Insert(0, new ListItem("--Select movie--", "0"));
        }

        protectedvoid Ddlmovie_SelectedIndexChanged(object sender, EventArgse)
        {
            Ddltheatre.Items.Clear();
            stringmv = Ddlmovie.SelectedValue.ToString();
            stringstr = "select theatre from moviedata where movie= '" + mv + "' ";
            SqlDataAdapteradp = new SqlDataAdapter(str, con);
            DataSetds = new DataSet();
            adp.Fill(ds);
            Ddltheatre.DataSource = ds;
            Ddltheatre.DataBind();
            Ddltheatre.Items.Insert(0, new ListItem("--Select Theatre--", "0"));
            DdlDATE.Items.Clear();
            ListItemlt = new ListItem();
            lt.Text = "--Select Date--";
            lt.Value = "0";
            DdlDATE.Items.Add(lt);          
            StringsDate = DateTime.UtcNow.ToString();
            DateTimedatevalue = (Convert.ToDateTime(sDate.ToString()));  
            stringpattern = CultureInfo.CurrentCulture.DateTimeFormat.MonthDayPattern;
            pattern = pattern.Replace("MMMM", "MMM");
            stringformatted = "Today, " + datevalue.ToString(pattern);
            stringformatted1 = "Tomorrow, " + datevalue.AddDays(1).ToString(pattern);
            stringformatted2 = datevalue.AddDays(2).ToString(pattern);
            DdlDATE.Items.Add(formatted);
            DdlDATE.Items.Add(formatted1);
            DdlDATE.Items.Add(formatted2);
        }

        protectedvoid Button1_Click(objectsender, EventArgs e)
        {
            stringcty = Ddlcity.SelectedValue.ToString();
            stringmve = Ddlmovie.SelectedValue.ToString();
            stringthr = Ddltheatre.SelectedValue.ToString();
            stringdte = DdlDATE.SelectedValue.ToString();
            Response.Redirect("~/UserSelectedMovie.aspx?city=" + cty + "&movie=" + mve + " &thetre=" + thr + " &date=" + dte);

        }


    }
}

After  selecting  movie, you can see the hall lay out  of your selected hall. Here you can select the seats and user can selet 6 tickets only.
We use business o bjects and data access layers in this projects.

BOL.cs  and DAL.cs

BOL.cs   code :

using System;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.HtmlControls;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Xml.Linq;
usingSystem.Data.Sql;
usingSystem.Data.SqlClient;

/// <summary>
/// Summary description for BOL
/// </summary>
public class BOL
{
    SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
      public BOL()
      {
            //
            // TODO: Add constructor logic here
            //
      }
    public int AddScreen(stringscreenName)
    {
        try
        {
            SqlParameter[] p = new SqlParameter[1];
            p[0] = newSqlParameter("@ScreenName", screenName);
            returnDAL.ExecuteNonQuery(DAL.GetConnectionString(), CommandType.StoredProcedure, "sp_AddScreen", p);
        }
        catch (ArgumentException ex)
        {
            thrownew ArgumentException(ex.Message);
        }
    }
    public DataSet GetScreens()
    {
        try
        {
            SqlParameter[] p = new SqlParameter[0];
            returnDAL.ExecuteDataSet(DAL.GetConnectionString(), CommandType.StoredProcedure, "sp_GetScreens", p);
        }
        catch (Exception)
        {       
            throw;
        }
    }
    public DataSet GetScreenLayout(intscreenId)
    {
        try
        {
            SqlParameter[] p = new SqlParameter[1];
            p[0] = newSqlParameter("@ScreenId", screenId);
            returnDAL.ExecuteDataSet(DAL.GetConnectionString(), CommandType.StoredProcedure, "sp_GetScreenLayout", p);
        }
        catch (ArgumentException ex)
        {
            thrownew ArgumentException(ex.Message);
        }
    }
    public string AddScreenLayout(stringrowName, int screenId,  string one, string two, stringthree, string four, stringfive, string six, stringseven, string eight, stringnine, string ten, stringeleven, string twelve, stringthirteen, string fourteen, string fifteen, stringsixteen, string seventeen, string eighteen, stringnineteen, string twenty, string twentyone, stringtwentytwo, string twentythree, string twentyfour, stringtwentyfive, string twentysix, string twentyseven, stringtwentyeight, string twentynine, string thirty)
    {
        try
        {
            SqlParameter[] p = new SqlParameter[33];
            p[0] = newSqlParameter("@RowName", rowName);
            p[1] = newSqlParameter("@ScreenId", screenId);
            p[3] = newSqlParameter("@1", one);
            p[4] = newSqlParameter("@2", two);
            p[5] = newSqlParameter("@3", three);
            p[6] = newSqlParameter("@4", four);
            p[7] = new SqlParameter("@5", five);
            p[8] = newSqlParameter("@6", six);
            p[9] = newSqlParameter("@7", seven);
            p[10] = newSqlParameter("@8", eight);
            p[11] = newSqlParameter("@9", nine);
            p[12] = newSqlParameter("@10", ten);
            p[13] = newSqlParameter("@11", eleven);
            p[14] = newSqlParameter("@12", twelve);
            p[15] = newSqlParameter("@13", thirteen);
            p[16] = newSqlParameter("@14", fourteen);
            p[17] = newSqlParameter("@15", fifteen);
            p[18] = newSqlParameter("@16", sixteen);
            p[19] = newSqlParameter("@17", seventeen);
            p[20] = newSqlParameter("@18", eighteen);
            p[21] = newSqlParameter("@19", nineteen);
            p[22] = newSqlParameter("@20", twenty);
            p[23] = newSqlParameter("@21", twentyone);
            p[24] = newSqlParameter("@22", twentytwo);
            p[25] = newSqlParameter("@23", twentythree);
            p[26] = newSqlParameter("@24", twentyfour);
            p[27] = newSqlParameter("@25", twentyfive);
            p[28] = newSqlParameter("@26", twentysix);
            p[29] = newSqlParameter("@27", twentyseven);
            p[30] = newSqlParameter("@28", twentyeight);
            p[31] = newSqlParameter("@29", twentynine);
            p[32] = newSqlParameter("@30", thirty);
            p[2] = newSqlParameter("@Message", SqlDbType.VarChar, 150);
            p[2].Direction = ParameterDirection.Output;
            DAL.ExecuteDataSet(DAL.GetConnectionString(), CommandType.StoredProcedure, "sp_AddScreenLayout", p);
            returnConvert.ToString(p[2].Value);
        }
        catch (ArgumentException ex)
        {
            throw new ArgumentException(ex.Message);
        }
    }
}
 ============================================================================================
DAL.cs code :

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

/// <summary>
/// Summary description for DAL
/// </summary>
public class DAL
{
      public DAL()
      {
            //
            // TODO: Add constructor logic here
            //
      }
    static SqlConnection con;
    static SqlCommand cmd;
    static DataSet ds;
    static SqlDataAdapter da;
    public static stringGetConnectionString()
    {
        SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
        stringconstr = con.ToString();
        returnconstr;
    }
    public static intExecuteNonQuery(string connectionString, CommandType commandType, stringcommandText, SqlParameter[] parameters)
    {
        try
        {
            SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
            cmd = newSqlCommand(commandText, con);
            cmd.CommandType = commandType;
            foreach(SqlParameter p inparameters)
            {
                if(p.Value == null)
                {
                }
                cmd.Parameters.Add(p);
            }
            con.Open();
            returncmd.ExecuteNonQuery();
        }
        catch (SqlException ex)
        {
            thrownew ArgumentException(ex.Message);
        }
        finally{ con.Close(); }
    }
    public static DataSetExecuteDataSet(string connectionString, CommandType commandType, stringcommandText, SqlParameter[] parameters)
    {
        try
        {
            SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
            cmd = newSqlCommand();
            cmd.Connection = con;
            cmd.CommandText = commandText;
            cmd.CommandType = commandType;
            if(parameters == null)
            {
                da = newSqlDataAdapter(cmd);
                ds = newDataSet();
                da.Fill(ds);
                returnds;
            }
            else
            {
                foreach(SqlParameter p inparameters)
                {
                    if((p.Direction == ParameterDirection.InputOutput) && (p.Value == null))
                    {
                    }
                    //if (p.Value != null)
                    //{
                    cmd.Parameters.Add(p);
                    //}
                }
                da = newSqlDataAdapter(cmd);
                ds = newDataSet();
                da.Fill(ds);
                returnds;
            }
        }
        catch (SqlException ex)
        {
            thrownew ArgumentException(ex.Message);
        }
    }  
}

============================================================================================
AdminAddHallLayout.aspx


Admin can create different hall layouts,  these layouts are used to any number of halls.

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

namespaceBookFilmTickets.Admin
{
    public partial class AddHallLayout1 : System.Web.UI.Page
    {
         intval;
        BOLobj;  //Business Object Layer class

        //Default Constructor
        publicAddHallLayout1()
        {
         obj = newBOL();
        }
        protectedvoid Page_Load(objectsender, EventArgs e)
        {
            if(Session["Admin"].ToString() == "")
            {
                Response.Redirect("AdminIndex.aspx");
            }
            if(!IsPostBack)
            {
                BindScreens();
            }
        }
        voidBindScreens()
        {
            try
            {
                ddlScreens.Items.Clear();
                ddlScreens.DataSource = obj.GetScreens();
                ddlScreens.DataTextField = "ScreenName";
                ddlScreens.DataValueField = "ScreenId";
                ddlScreens.DataBind();
                ddlScreens.Items.Insert(0, "Select");
            }
            catch(Exception)
            {
                throw;
            }
        }

        protectedvoid btnSubmit_Click(objectsender, EventArgs e)
        {
         
                intval = obj.AddScreen(Convert.ToString(txtScreenName.Text));
                if(val >= 0)
                {
                    Response.Write("Screen addeed successfully.");
                    BindScreens();
                }
                else
                    Response.Write("Screen you added is already existed.");
         
          
        }
        protectedvoid chkSelectAll_CheckedChanged(object sender, EventArgse)
        {
            if(chkSelectAll.Checked)
            {
                foreach(ListItem lt inchkbSeats.Items)
                {
                    lt.Selected = true;
                    val += 1;
                    lt.Text = Convert.ToString(val);
                }
            }
            else
            {
                foreach(ListItem lt inchkbSeats.Items)
                {
                    lt.Selected = false;
                    lt.Text = "";
                }
                chkSelectAll.Checked = false;
            }
        }

        protectedvoid chkbSeats_SelectedIndexChanged(object sender, EventArgse)
        {
            foreach(ListItem lt inchkbSeats.Items)
            {
                if(lt.Selected)
                {
                    val += 1;
                    lt.Text = Convert.ToString(val);
                }
                else{ lt.Text = ""; }
            }
        }

        /// <summary>
        /// This is for adding screen layout
        /// </summary>
        protectedvoid btnSubmitScreenLayout_Click(object sender, EventArgse)
        {
            //try
            //{
                stringone = chkbSeats.Items.FindByValue("1").Text.ToString();
                stringtwo = chkbSeats.Items.FindByValue("2").Text.ToString();
                stringthree = chkbSeats.Items.FindByValue("3").Text.ToString();
                stringfour = chkbSeats.Items.FindByValue("4").Text.ToString();
                stringfive = chkbSeats.Items.FindByValue("5").Text.ToString();
                stringsix = chkbSeats.Items.FindByValue("6").Text.ToString();
                stringseven = chkbSeats.Items.FindByValue("7").Text.ToString();
                stringeight = chkbSeats.Items.FindByValue("8").Text.ToString();
                stringnine = chkbSeats.Items.FindByValue("9").Text.ToString();
                stringten = chkbSeats.Items.FindByValue("10").Text.ToString();
                stringeleven = chkbSeats.Items.FindByValue("11").Text.ToString();
                stringtwelve = chkbSeats.Items.FindByValue("12").Text.ToString();
                stringthirteen = chkbSeats.Items.FindByValue("13").Text.ToString();
                stringfourteen = chkbSeats.Items.FindByValue("14").Text.ToString();
                stringfifteen = chkbSeats.Items.FindByValue("15").Text.ToString();
                stringsixteen = chkbSeats.Items.FindByValue("16").Text.ToString();
                stringseventeen = chkbSeats.Items.FindByValue("17").Text.ToString();
                stringeighteen = chkbSeats.Items.FindByValue("18").Text.ToString();
                stringnineteen = chkbSeats.Items.FindByValue("19").Text.ToString();
                stringtwenty = chkbSeats.Items.FindByValue("20").Text.ToString();
                stringtwentyone = chkbSeats.Items.FindByValue("21").Text.ToString();
                stringtwentytwo = chkbSeats.Items.FindByValue("22").Text.ToString();
                stringtwentythree = chkbSeats.Items.FindByValue("23").Text.ToString();
                stringtwentyfour = chkbSeats.Items.FindByValue("24").Text.ToString();
                stringtwentyfive = chkbSeats.Items.FindByValue("25").Text.ToString();
                stringtwentysix = chkbSeats.Items.FindByValue("26").Text.ToString();
                stringtwentyseven = chkbSeats.Items.FindByValue("27").Text.ToString();
                stringtwentyeight = chkbSeats.Items.FindByValue("28").Text.ToString();
                stringtwentynine = chkbSeats.Items.FindByValue("29").Text.ToString();
                stringthirty = chkbSeats.Items.FindByValue("30").Text.ToString();
                lblMsg.Text = obj.AddScreenLayout(Convert.ToString(txtRowName.Text), Convert.ToInt32(ddlScreens.SelectedValue), one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twentyone, twentytwo, twentythree, twentyfour, twentyfive, twentysix, twentyseven, twentyeight, twentynine, thirty);
                if(lblMsg.Text == "Added Successfully.")
                {
                    GetScreenLayout(Convert.ToInt32(ddlScreens.SelectedValue));
                }
            //}
            //catch (Exception)
            //{ throw; }
        }

        /// <summary>
        /// Binds the Screen Layout to gvScreenLayout GridView which is present in Panel3(GroupingText="Screen Layout";)
        /// </summary>
        /// <param name="screenId"></param>
        voidGetScreenLayout(int screenId)
        {
            try
            {
                gvScreenLayout.DataSource = obj.GetScreenLayout(screenId);
                gvScreenLayout.DataBind();
            }
            catch(ArgumentException ex)
            {
                Response.Write(ex.Message);
            }
        }

        protectedvoid ddlScreens_SelectedIndexChanged1(object sender, EventArgse)
        {
            lblMsg.Text = "";
            if(ddlScreens.SelectedIndex != 0)
            {
                gvScreenLayout.Visible = true;
                GetScreenLayout(Convert.ToInt32(ddlScreens.SelectedValue));
            }
            else
            { gvScreenLayout.Visible = false; }
        }

        public bool MyVisible(stringtxt)
        {
            if(txt == "")
            { returnfalse; }
            else{ return true; }
        }

        protectedvoid ddlRowType_SelectedIndexChanged(object sender, EventArgse)
        {
            if(ddlRowType.Text == "Empty Line")
            {
                txtRowName.ReadOnly = true; txtRowName.Text = "Line";
                chkbSeats.Visible = false;
                chkSelectAll.Visible = false;
                lblSeatsPostion.Visible = false;
                Label6.Visible = false;
                foreach(ListItem lt inchkbSeats.Items)
                {
                    lt.Selected = false;
                    lt.Text = "";
                }
            }
            elseif (ddlRowType.Text == "Row")
            {
                txtRowName.ReadOnly = false; txtRowName.Text = "";
                chkbSeats.Visible = true; chkSelectAll.Checked = false;
                chkSelectAll.Visible = true; Label6.Visible = true;
                lblSeatsPostion.Visible = true;
            }
        }

        protectedvoid gvScreenLayout_PageIndexChanging(object sender, GridViewPageEventArgse)
        {
            gvScreenLayout.PageIndex = e.NewPageIndex;
            GetScreenLayout(Convert.ToInt32(ddlScreens.SelectedValue));
        }
    }
}


UserSelectedMovie.aspx

In this page , page load  event  all the booked tickets shows red colour chairs and available tickets are shown in green colour. 
using System;
usingSystem.Collections;
usingSystem.Configuration;
usingSystem.Data;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
usingSystem.Xml.Linq;
usingSystem.Data.SqlClient;
usingSystem.Collections.Generic;

namespaceBookFilmTickets
{
    public partial class UserSelectedMovie : System.Web.UI.Page
    {
        stringsr;
        stringST, cost;
        stringS1, S2, S3, S4, S5, S6;
        int sm;
        int fc;
        string[] words = new string[6];
      
        intcount = 0;
        SqlConnectioncon = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);

        BOLobj = new BOL();
        protectedvoid Page_Load(objectsender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                pan1.Visible = false;
                Panel1.Visible = false;
                lblcity.Text = Request.QueryString["city"];
                lblmovie.Text = Request.QueryString["movie"];
                lblthtre.Text = Request.QueryString["thetre"];
                lblshowtim.Text = Request.QueryString["date"];



                DateTimedt1115AM = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 11, 15, 0);
                if(DateTime.UtcNow < dt1115AM)
                {
                    LinkButton1.ForeColor = System.Drawing.Color.SeaGreen;
                    LinkButton1.Enabled = true;
                }
                else
                {
                    LinkButton1.ForeColor = System.Drawing.Color.Red;
                    LinkButton1.Enabled = false;
                }

                DateTimedt215AM = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 14, 15, 0);
                if(DateTime.UtcNow < dt215AM)
                {
                    LinkButton2.ForeColor = System.Drawing.Color.SeaGreen;
                    LinkButton2.Enabled = true;
                }
                else
                {
                    LinkButton2.ForeColor = System.Drawing.Color.Red;
                    LinkButton2.Enabled = false;
                }

                DateTimedt615AM = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 18, 15, 0);
                if(DateTime.UtcNow < dt615AM)
                {
                    LinkButton3.ForeColor = System.Drawing.Color.SeaGreen;
                    LinkButton3.Enabled = true;
                }
                else
                {
                    LinkButton3.ForeColor = System.Drawing.Color.Red;
                    LinkButton3.Enabled = false;
                }

                DateTimedt915AM = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 21, 15, 0);
                if(DateTime.UtcNow < dt915AM)
                {
                    LinkButton4.ForeColor = System.Drawing.Color.SeaGreen;
                    LinkButton4.Enabled = true;
                }
                else
                {
                    LinkButton4.ForeColor = System.Drawing.Color.Red;
                    LinkButton4.Enabled = false;
                }

                intscr = 103;
                gvScreenLayout.DataSource = obj.GetScreenLayout(scr);
                gvScreenLayout.DataBind();

                stringstr1 = "select T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15  from moviedata where movie ='" + Request.QueryString["movie"] + "' and city = '" + Request.QueryString["city"] + "' and  theatre = '" + Request.QueryString["thetre"] + "'";
                SqlDataAdapteradp1 = new SqlDataAdapter(str1, con);
                DataSetds1 = new DataSet();
                adp1.Fill(ds1);
                if(ds1.Tables[0].Rows.Count != 0)
                {
                    ArrayListlistp = new ArrayList();

                    foreach(DataRow drRow inds1.Tables[0].Rows)
                    {
                        foreach (var itm in drRow.ItemArray)
                        {
                            listp.Add(itm);
                            foreach (string k in listp)
                            {
                                string category = k.Substring(0, 1);
                                string seno = k.Remove(0, 1);


                                for (int i = 0; i < gvScreenLayout.Rows.Count; i++)
                                {

                                    HyperLink Hyp = gvScreenLayout.Rows[i].Cells[0].FindControl("HyperLink1") as HyperLink;

                                    string cat1 = Hyp.Text;

                                    if (category == cat1)
                                    {
                                        string ids1 = "ImageButton"+ seno.ToString();
                                        ImageButton imgThumb = (ImageButton)(gvScreenLayout.Rows[i].FindControl(ids1));
                                        imgThumb.ImageUrl = "~/Images/chair_green.jpg";

                                    }

                                }
                            }
                        }
                    }
                }
                stringstr = "select Seat1,Seat2,Seat3,Seat4,Seat5,Seat6 from TransactionMovie where MovieName ='" + Request.QueryString["movie"] + "' and City = '" + Request.QueryString["city"] + "' and  TheatreName = '" + Request.QueryString["thetre"] + "'";
                SqlDataAdapteradp = new SqlDataAdapter(str, con);
                DataSetds = new DataSet();
                adp.Fill(ds);
                if(ds.Tables[0].Rows.Count != 0)
                {
                    ArrayListlistp = new ArrayList();

                    foreach(DataRow drRow inds.Tables[0].Rows)
                    {
                        foreach (var itm in drRow.ItemArray)
                        {
                            listp.Add(itm);
                            foreach (string k in listp)
                            {
                                string category = k.Substring(0, 1);
                                string seno = k.Remove(0, 1);


                                for (int i = 0; i < gvScreenLayout.Rows.Count; i++)
                                {

                                    HyperLink Hyp = gvScreenLayout.Rows[i].Cells[0].FindControl("HyperLink1") as HyperLink;

                                    string cat1 = Hyp.Text;

                                    if (category == cat1)
                                    {
                                        string ids1 = "ImageButton"+ seno.ToString();
                                        ImageButton imgThumb = (ImageButton)(gvScreenLayout.Rows[i].FindControl(ids1));
                                        imgThumb.ImageUrl = "~/Images/chair_red.jpg";
                                        imgThumb.Enabled = false;
                                    }

                                }
                            }
                        }
                    }
                }


                for(int i = 0; i < gvScreenLayout.Rows.Count; i++)
                {
                    for(int j = 1; j < gvScreenLayout.Columns.Count; j++)
                    {
                        string idSlv = "ImageButton"+ j.ToString();
                        ImageButton imgbtnSlv = gvScreenLayout.Rows[i].Cells[j].FindControl(idSlv) asImageButton;
                        if (imgbtnSlv.ImageUrl == "~/images/chair_silver.jpg")
                        {
                            imgbtnSlv.Enabled = false;
                        }
                     
                    }
                }

            }
          
            MultiView1.ActiveViewIndex = 0;
        }

        protectedvoid Button3_Click1(objectsender, EventArgs e)
        {
            pan1.Visible = true;
        }

        public bool MyVisible(stringtxt)
        {
            if(txt == "")
            { returnfalse; }
            else{ return true; }
        }
      
        protectedvoid LinkButton1_Click(objectsender, EventArgs e)
        {
            Panel1.Visible = true;
            lbltime.Text = "11:15 AM";
        }

        protectedvoid LinkButton2_Click(objectsender, EventArgs e)
        {
            Panel1.Visible = true;
            lbltime.Text = "2:15 PM";
        }

        protectedvoid LinkButton3_Click(objectsender, EventArgs e)
        {
            Panel1.Visible = true;
            lbltime.Text = "6:15 PM";
        }

        protectedvoid LinkButton4_Click(objectsender, EventArgs e)
        {

            Panel1.Visible = true;
            lbltime.Text = "9:15 PM";
        }

        protectedvoid ImageButton1_Click(object sender, ImageClickEventArgse)
        {
            stringun = Convert.ToString(Session["username"]);
            if(un.ToString() != "")
            {

                words = Label2.Text.Split(',');
                intln = words.Length - 1;
                if(ln == 1)
                {
                    S1 = words[0].ToString();
                    S2 = "0"; S3 = "0"; S4 = "0"; S5 = "0"; S6 = "0";

                }
                if(ln == 2)
                {
                    S1 = words[0].ToString();
                    S2 = words[1].ToString();
                    S3 = "0"; S4 = "0"; S5 = "0"; S6 = "0";

                }
                if(ln == 3)
                {
                    S1 = words[0].ToString();
                    S2 = words[1].ToString();
                    S3 = words[2].ToString();
                    S4 = "0"; S5 = "0"; S6 = "0";

                }
                if(ln == 4)
                {
                    S1 = words[0].ToString();
                    S2 = words[1].ToString();
                    S3 = words[2].ToString();
                    S4 = words[3].ToString();
                    S5 = "0"; S6 = "0";

                }
                if (ln == 5)
                {
                    S1 = words[0].ToString();
                    S2 = words[1].ToString();
                    S3 = words[2].ToString();
                    S4 = words[3].ToString();
                    S5 = words[4].ToString();
                    S6 = "0";

                }
                if(ln == 6)
                {
                    S1 = words[0].ToString();
                    S2 = words[1].ToString();
                    S3 = words[2].ToString();
                    S4 = words[3].ToString();
                    S5 = words[4].ToString();
                    S6 = words[5].ToString();

                }


                stringus = Convert.ToString(Session["username"]);
                stringtrans = "INSERT INTO TransactionMovie(UserId, MovieName, City , Date ,TheatreName,Showtime,Seat1,Seat2 ,Seat3 ,Seat4,Seat5,Seat6,TotalCost,Flag,TransTime) VALUES ('" + us + "','" + lblmovie.Text + "','" + lblcity.Text + "','" + lblshowtim.Text + "','" + lblthtre.Text + "','" + lbltime.Text + "','" + S1 + "' , '" + S2 + "' ,'" + S3 + "','" + S4 + "','" + S5 + "','"+ S6 + "','" + lblcost.Text + "', 'T', '" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "')";

                SqlCommandcmd3 = new SqlCommand(trans, con);
                cmd3.CommandType = CommandType.Text;
                con.Open();
                cmd3.ExecuteNonQuery();
                con.Close();
                Response.Redirect("http://bookfilmtickets.com/payment/pay.aspx");

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Ticket booking completed Succesfully ", "alert('  Ticket booking completed Succesfully')", true);


                // Response.Redirect("index.aspx");
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Please Login to Book ticket ", "alert(' Please Login to Book ticket')", true);
            }
        }

        protectedvoid gvScreenLayout_RowCommand(object sender, GridViewCommandEventArgse)
        {
            if(e.CommandName == "ib1" || e.CommandName == "ib2" || e.CommandName == "ib3" || e.CommandName == "ib4" || e.CommandName == "ib5" || e.CommandName == "ib6" || e.CommandName == "ib7" || e.CommandName == "ib8" || e.CommandName == "ib9" || e.CommandName == "ib10" || e.CommandName == "ib11" || e.CommandName == "ib12" || e.CommandName == "ib13" || e.CommandName == "ib14" || e.CommandName == "ib15" || e.CommandName == "ib16" || e.CommandName == "ib17" || e.CommandName == "ib18" || e.CommandName == "ib19" || e.CommandName == "ib20" || e.CommandName == "ib21" || e.CommandName == "ib22" || e.CommandName == "ib23" || e.CommandName == "ib24" || e.CommandName == "ib25" || e.CommandName == "ib26" || e.CommandName == "ib27" || e.CommandName == "ib28" || e.CommandName == "ib29" || e.CommandName == "ib30")
            {
               
                GridViewRowgvr = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                HyperLinkHyp = gvr.FindControl("HyperLink1") as HyperLink;
                intind = gvr.RowIndex;
                stringcat = Hyp.Text;
                intsno = Convert.ToInt32(e.CommandArgument);
                stringseat = cat + sno.ToString();             
                stringids = "ImageButton" + sno.ToString();              
                ImageButtonimgThumb = (ImageButton)(gvScreenLayout.Rows[ind].FindControl(ids));
                if(imgThumb.ImageUrl == "~/Images/chair_green.jpg"&& fc <= 6)
                {
                    imgThumb.ImageUrl = "~/Images/chair_orange.jpg";

                }
                else
                {
                    imgThumb.ImageUrl = "~/Images/chair_green.jpg";
                }
                for(int i = 0; i < gvScreenLayout.Rows.Count; i++)
                {
                    for(int j = 1; j < gvScreenLayout.Columns.Count; j++)
                    {
                        string idsf = "ImageButton"+ j.ToString();
                        ImageButton imgbtn = gvScreenLayout.Rows[i].Cells[j].FindControl(idsf) asImageButton;

                        if ("~/Images/chair_orange.jpg"== imgbtn.ImageUrl)
                        {
                            count = count + 1;
                            if (count <= 6)
                            {
                                HyperLink Hyp4 = gvScreenLayout.Rows[i].FindControl("HyperLink1") as HyperLink;                             
                                ST = Hyp4.Text + (imgbtn.CommandArgument).ToString();
                                sr += ST + ",";
                                Label2.Text = sr.ToString();
                                string str4 = "select Range1,Range2,Range3,Range4,Range5,Range6,Range7,Range8,Range9,Range10,Range11,Range12,Range13,Range14,Range15,Range16,Range17 from moviedata where movie ='" + Request.QueryString["movie"] + "' and city = '" + Request.QueryString["city"] + "' and  theatre = '" + Request.QueryString["thetre"] + "'";
                                SqlDataAdapter adp4 = newSqlDataAdapter(str4, con);
                                DataSet ds4 = new DataSet();
                                adp4.Fill(ds4);
                                if(ds4.Tables[0].Rows.Count != 0)
                                {
                                    //CATEGORY A
                                    string CS1=ds4.Tables[0].Rows[0]["Range1"].ToString();
                                    string CostCat1 = CS1.Substring(0, 1);
                                    if (CostCat1 == Hyp4.Text)
                                    {
                                        sm += 55;
                                    }
                                    //CATEGORY B
                                    string CS2 = ds4.Tables[0].Rows[0]["Range2"].ToString();
                                    string CostCat2 = CS2.Substring(0, 1);
                                    if(CostCat2 == Hyp4.Text)
                                    {
                                        sm += 55;
                                    }
                                    //CATEGORY C
                                    string CS3 = ds4.Tables[0].Rows[0]["Range3"].ToString();
                                    string CostCat3 = CS3.Substring(0, 1);
                                    if (CostCat3 == Hyp4.Text)
                                    {
                                        sm += 55;
                                    }
                                    //CATEGORY D
                                    string CS4 = ds4.Tables[0].Rows[0]["Range4"].ToString();
                                    stringCostCat4 = CS4.Substring(0, 1);
                                    if (CostCat4 == Hyp4.Text)
                                    {
                                        sm += 55;
                                    }
                                    //CATEGORY E
                                    string CS5 = ds4.Tables[0].Rows[0]["Range5"].ToString();
                                    string CostCat5 = CS5.Substring(0, 1);
                                    if (CostCat5 == Hyp4.Text)
                                    {
                                        sm += 55;
                                    }
                                    //CATEGORY F
                                    string CS6 = ds4.Tables[0].Rows[0]["Range6"].ToString();
                                    string CostCat6 = CS6.Substring(0, 1);
                                    if (CostCat6 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY G
                                    string CS7 = ds4.Tables[0].Rows[0]["Range7"].ToString();
                                    string CostCat7 = CS7.Substring(0, 1);
                                    if (CostCat7 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY H
                                    string CS8 = ds4.Tables[0].Rows[0]["Range8"].ToString();
                                    string CostCat8 = CS8.Substring(0, 1);
                                    if (CostCat8 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY I
                                    string CS9 = ds4.Tables[0].Rows[0]["Range9"].ToString();
                                    string CostCat9 = CS9.Substring(0, 1);
                                    if (CostCat9 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY J
                                    string CS10 = ds4.Tables[0].Rows[0]["Range10"].ToString();
                                    string CostCat10 = CS10.Substring(0, 1);
                                    if (CostCat10 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY K
                                    string CS11 = ds4.Tables[0].Rows[0]["Range11"].ToString();
                                    string CostCat11 = CS11.Substring(0, 1);
                                    if (CostCat11 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY L
                                    string CS12 = ds4.Tables[0].Rows[0]["Range12"].ToString();
                                    string CostCat12 = CS12.Substring(0, 1);
                                    if (CostCat12 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY M
                                    string CS13 = ds4.Tables[0].Rows[0]["Range13"].ToString();
                                    string CostCat13 = CS13.Substring(0, 1);
                                    if (CostCat13 == Hyp4.Text)
                                    {
                                        sm += 45;
                                    }
                                    //CATEGORY N
                                    stringCS14 = ds4.Tables[0].Rows[0]["Range14"].ToString();
                                    string CostCat14 = CS14.Substring(0, 1);
                                    if (CostCat14 == Hyp4.Text)
                                    {
                                        sm += 20;
                                    }
                                    //CATEGORY O
                                    string CS15 = ds4.Tables[0].Rows[0]["Range15"].ToString();
                                    string CostCat15 = CS15.Substring(0, 1);
                                    if (CostCat15 == Hyp4.Text)
                                    {
                                        sm += 20;
                                    }
                                    //CATEGORY P
                                    string CS16 = ds4.Tables[0].Rows[0]["Range16"].ToString();
                                    string CostCat16 = CS16.Substring(0, 1);
                                    if (CostCat16 == Hyp4.Text)
                                    {
                                        sm += 20;
                                    }
                                    //CATEGORY Q
                                    string CS17 = ds4.Tables[0].Rows[0]["Range17"].ToString();
                                    string CostCat17 = CS17.Substring(0, 1);
                                    if (CostCat17 == Hyp4.Text)
                                    {
                                        sm += 20;
                                    }
                                    if (fc == 6)
                                    {
                                        fc = count + 1;
                                    }
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "No  Code", "alert('Cannot Book more than 6 tickets')", true);
                                //gvScreenLayout.Enabled = false;
                                imgThumb.ImageUrl = "~/Images/chair_green.jpg";
                                fc = count + 1;
                            }
                        }

                    }
                }
             

              
           
            }

            if(sr != null)
            {
                Label2.Text = sr.ToString();
            }
            if(sm != 0)
            {
                lblcost.Text = sm.ToString();
            }
      
        }
     
        protectedvoid gvScreenLayout_SelectedIndexChanged(object sender, EventArgse)
        {
         
        }

        protectedvoid btnsearch_Click(objectsender, EventArgs e)
        {
            if(Label2.Text != "" && Session["username"].ToString() != "")
            {
                 stringun = Convert.ToString(Session["username"]);
                stringnameproof ="select * from UserRegistration where UEmail = '"+ un +"'";
                SqlDataAdapterad = new SqlDataAdapter(nameproof,con);
                DataSetds = new DataSet();
                ad.Fill(ds);
                if(ds.Tables[0].Rows.Count > 0)
                {
                    stringuname = ds.Tables[0].Rows[0]["UName"].ToString();
                    stringproof1 = ds.Tables[0].Rows[0]["UIdproof"].ToString();
                    stringproof2 = ds.Tables[0].Rows[0]["UIdnumber"].ToString();
                    stringproof = proof1 + proof2;
                    Response.Redirect("~/PrintTicket.aspx?name=" +uname +"& theatre=" + lblthtre.Text + " &showtime=" + LinkButton2.Text + " & seats=" + Label2.Text + " &movie=" + lblmovie.Text + " &amount =" + lblcost.Text + "   & prooof=" + proof);

                }
            }
        }

     
        }

        }
if you have any queries feel free to ask me.
for complete source code , you can mail me to yaphethonline@gmail.com.

13 comments:

  1. please update in wpf application!!!!!!!!!!!!!

    ReplyDelete
  2. Hi, Please Send me the code of this project on my email ID

    aajitm@gmail.com

    ReplyDelete
  3. where to download the code ?

    ReplyDelete
  4. please Sir ur Work is very Impressive. i Wish to have look at ur code so please Sir, send
    on this unchaosme@gmail.com

    ReplyDelete
  5. Sir,
    Your Work is Very Impressive. I wanna have a Look at ur Source code, So if u could then please send on this unchaosme@gmail.com

    ReplyDelete
  6. Its Superb Sir.. Please Send the total code and design to my mail id sai.rapola@gmail.com

    ReplyDelete
  7. yur work is awesome plzz mail me code and design..
    dheerajjariwal@gmail.com

    ReplyDelete
  8. yur work is awesome plzz mail me code and design..
    dheerajjariwal@gmail.com

    ReplyDelete
  9. your code is awsome.
    may i have this design and source to my email please?

    avikon88@gmail.com

    ReplyDelete
  10. Hi Team, could you please give me the images for database and forms from the above coding to my email id
    salmanm75@yahoo.in or memon_salman30@yahoo.com

    ReplyDelete
  11. please send me hole project to me to my email.
    a.belani1994@gmail.com

    ReplyDelete
  12. yur work is awesome plzz mail me code and design..
    bolatciserkan@gmail.com

    ReplyDelete

  13. BookMyShow offers! If you are looking for discounts or offers for movietickets, go to Tracedeals directly. There are many offers and movie theatres get your coupons and offers at Tracedeals. Download the application or take out your PC and Go through Tracedeals.in.
    bookmyshow offers
    bookmyshow today offers
    Bookmyshow Hyderabad
    Bookmyshow Coupons
    Paytm movie offers

    ReplyDelete