using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (DropDownList1.SelectedValue==”مرد” &&( DropDownList2.SelectedIndex== 0 || DropDownList2.SelectedIndex== 1 || DropDownList2.SelectedIndex== 2))
Label1.Text = “شما فقط می توانید برای سانس های آقایان بلیط رزرو کنید”;
else if (DropDownList1.SelectedValue == “زن” && (DropDownList2.SelectedIndex == 3 || DropDownList2.SelectedIndex == 4 || DropDownList2.SelectedIndex == 5))
Label1.Text = “شما فقط می توانید برای سانس های خانمها بلیط رزرو کنید”;
else
{
try
{
SqlConnection sd2 = new SqlConnection();
sd2.ConnectionString = ConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString;
SqlDataAdapter con2 = new SqlDataAdapter(“SELECT * FROM belit where fish=N'” + TextBox7.Text + “‘”, sd2);
DataTable vb2 = new DataTable();
con2.Fill(vb2);
if (vb2.Rows.Count > 0)
{
Label1.Text = “این فیش پرداختی قبلا استفاده شده است”;
}
else
{
SqlConnection sd = new SqlConnection();
sd.ConnectionString = ConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString;
SqlDataAdapter con = new SqlDataAdapter(“SELECT * FROM belit where sans=N'” + DropDownList2.SelectedValue + “‘ and melicode='” + TextBox3.Text + “‘ and roozh='” + DropDownList3.SelectedValue + “‘ and rooz='” + DropDownList4.SelectedValue + “‘ and mah='” + DropDownList5.SelectedValue + “‘”, sd);
DataTable vb = new DataTable();
con.Fill(vb);
if (vb.Rows.Count > 0)
{
Label1.Text = “شما قبلا این بلیط را رزرو کرده اید”;
}
else
{
string fish = TextBox7.Text;
SqlConnection sd1 = new SqlConnection();
sd1.ConnectionString = ConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString;
SqlCommand con1 = new SqlCommand();
string vb1 = “insert into belit Values (N'” + TextBox1.Text + “‘,N'” + TextBox2.Text + “‘,N'” + TextBox3.Text + “‘,N'” + TextBox4.Text + “‘,N'” + TextBox5.Text + “‘,N'” + DropDownList3.SelectedValue + “‘,N'” + DropDownList4.SelectedValue + “‘,N'” + DropDownList5.SelectedValue + “‘,N'” + DropDownList2.SelectedValue + “‘,N'” + TextBox7.Text + “‘)”;
con1.CommandType = CommandType.Text;
con1.CommandText = vb1;
con1.Connection = sd1;
sd1.Open();
con1.ExecuteNonQuery();
sd1.Close();
Label1.Text = “بلیط مورد نظر برای شما ثبت شد. لطفا شماره ی آن را حتما یادداشت کنید”;
Label12.Visible = false;
SqlConnection sd4 = new SqlConnection();
sd4.ConnectionString = ConfigurationManager.ConnectionStrings[“ConnectionString”].ConnectionString;
SqlDataAdapter con4 = new SqlDataAdapter(“SELECT * FROM belit where fish=N'” + fish + “‘”, sd4);
DataTable vb4 = new DataTable();
con4.Fill(vb4);
if (vb4.Rows.Count > 0)
{
Label16.Text = vb4.Rows[0].ItemArray[10].ToString();
Label18.Text = vb4.Rows[0].ItemArray[0].ToString();
Label20.Text = vb4.Rows[0].ItemArray[1].ToString();
Label22.Text = vb4.Rows[0].ItemArray[2].ToString();
Label24.Text = vb4.Rows[0].ItemArray[3].ToString();
Label26.Text = vb4.Rows[0].ItemArray[4].ToString();
Label28.Text = vb4.Rows[0].ItemArray[5].ToString();
Label30.Text = vb4.Rows[0].ItemArray[6].ToString();
Label32.Text = vb4.Rows[0].ItemArray[7].ToString();
Label34.Text = vb4.Rows[0].ItemArray[8].ToString();
Label36.Text = vb4.Rows[0].ItemArray[9].ToString();
}
}
}
}
catch
{
Label1.Text = “خطایی در ارسال اطلاعات پیش آمده”;
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Label12.Visible = true;
TextBox1.Text = “”;
TextBox2.Text = “”;
TextBox3.Text = “”;
TextBox4.Text = “”;
TextBox5.Text = “”;
Label1.Text = “”;
TextBox7.Text = “”;
Label16.Text = “”;
Label18.Text =””;
Label20.Text =””;
Label22.Text = “”;
Label24.Text =””;
Label26.Text = “”;
Label28.Text = “”;
Label30.Text =””;
Label32.Text = “”;
Label34.Text = “”;
Label36.Text =””;
}
|