// Club // protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { DataList7.SelectedIndex = e.Item.ItemIndex; LinkButton l1; l1 = (LinkButton)DataList7.Items[DataList7.SelectedIndex].FindControl("l1"); int seatid = Convert.ToInt16(e.CommandArgument); if (l1.Text != " ") { if (l1.BackColor.Name == "CornflowerBlue") { l1.BackColor = System.Drawing.Color.LightGreen; } else { l1.BackColor = System.Drawing.Color.FromName("CornflowerBlue"); } } //class obj class SqlConnection con2 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\userside.mdf;Integrated Security=True;User Instance=True"); string str2; str2 = "update Seat_Master set status='Book' where Seatid=" + seatid + ""; SqlCommand cmd2 = new SqlCommand(str2, con2); con2.Open(); cmd2.ExecuteNonQuery(); SqlConnection con1 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\userside.mdf;Integrated Security=True;User Instance=True"); string str1 = "insert into Booking_master(userid,movieid,TheatreId,Seatid,username,moviename,bookedticket,price,bookingdate,category,Screenname,timing,seatno)values(" + Session["userid"] + "," + Session["movieid"] + "," + ViewState["TheatreId"] + "," + seatid + ",'" + Session["UserName"] + "','" + lblMoviName.Text + "','" + DropDownList2.SelectedItem.Text + "','" + lblRate.Text + "','" + lblMoviesDate.Text + "','" + DropDownList1.SelectedItem.Text + "','" + lblSid.Text + "','" + lblShowtime.Text + "','" + l1.Text + "')"; con1.Open(); SqlCommand cmd1 = new SqlCommand(str1, con1); cmd1.ExecuteNonQuery(); m.ExecuteNonQuery1("insert into Total_Seat values(" + seatid + "," + ViewState["TheatreId"] + ",'" + lblScreen.Text + "','" + lblShowtime.Text + "','Book','" + lblMoviesDate.Text + "')"); Label2.Text = "Seat Booked."; //Response.Redirect ( "Seeticket.aspx"); con1.Close(); // for getting booking id's }
protected void abtadd_Click(object sender, EventArgs e) { int r = Convert.ToInt16(txtseat.Text); for (int y = 1; y <= r; y++) { string name; name = txtblock.Text + y; m.ExecuteNonQuery1("Insert into Seat_Master values(" + drptheater.SelectedItem.Value + "," + drpcity.SelectedValue + ",'" + name + "','" + drpscreen.SelectedItem.Text + "','" + drptype.SelectedItem.Text + "'," + txtamnt0.Text + ",'UnBook')"); } abtadd.Enabled = false; GridView1.DataBind(); Label2.Text = "Seat Detail Inserted Succ..."; }