⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createres.aspx.cs

📁 民航订票系统,实现自助订票,方便快捷!请大家放心下载!
💻 CS
📖 第 1 页 / 共 4 页
字号:
			// 
			// sqlDeleteCommand2
			// 
			this.sqlDeleteCommand2.CommandText = @"DELETE FROM dtReservations WHERE (TicketNo = @Original_TicketNo) AND (ClassOfRes = @Original_ClassOfRes) AND (DateOfJourney = @Original_DateOfJourney) AND (DateOfRes = @Original_DateOfRes) AND (EMail = @Original_EMail OR @Original_EMail IS NULL AND EMail IS NULL) AND (Fare = @Original_Fare) AND (FltNo = @Original_FltNo) AND (Name = @Original_Name) AND (ReservedBy = @Original_ReservedBy) AND (Status = @Original_Status) AND (TicketConfirmed = @Original_TicketConfirmed OR @Original_TicketConfirmed IS NULL AND TicketConfirmed IS NULL)";
			this.sqlDeleteCommand2.Connection = this.sqlConnection1;
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_TicketNo", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TicketNo", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ClassOfRes", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ClassOfRes", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_DateOfJourney", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "DateOfJourney", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_DateOfRes", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "DateOfRes", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_EMail", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "EMail", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Fare", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Fare", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_FltNo", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FltNo", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Name", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Name", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReservedBy", System.Data.SqlDbType.VarChar, 15, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReservedBy", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Status", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Status", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_TicketConfirmed", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TicketConfirmed", System.Data.DataRowVersion.Original, null));
			// 
			// sqlDataAdapter3
			// 
			this.sqlDataAdapter3.DeleteCommand = this.sqlDeleteCommand2;
			this.sqlDataAdapter3.InsertCommand = this.sqlInsertCommand3;
			this.sqlDataAdapter3.SelectCommand = this.sqlSelectCommand3;
			this.sqlDataAdapter3.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "dtReservations", new System.Data.Common.DataColumnMapping[] {
																																																						new System.Data.Common.DataColumnMapping("TicketNo", "TicketNo"),
																																																						new System.Data.Common.DataColumnMapping("FltNo", "FltNo"),
																																																						new System.Data.Common.DataColumnMapping("DateOfJourney", "DateOfJourney"),
																																																						new System.Data.Common.DataColumnMapping("ClassOfRes", "ClassOfRes"),
																																																						new System.Data.Common.DataColumnMapping("Name", "Name"),
																																																						new System.Data.Common.DataColumnMapping("EMail", "EMail"),
																																																						new System.Data.Common.DataColumnMapping("Fare", "Fare"),
																																																						new System.Data.Common.DataColumnMapping("Status", "Status"),
																																																						new System.Data.Common.DataColumnMapping("ReservedBy", "ReservedBy"),
																																																						new System.Data.Common.DataColumnMapping("DateOfRes", "DateOfRes"),
																																																						new System.Data.Common.DataColumnMapping("TicketConfirmed", "TicketConfirmed")})});
			this.sqlDataAdapter3.UpdateCommand = this.sqlUpdateCommand2;
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("en-US");
			this.dataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd";
			// 
			// sqlSelectCommand4
			// 
			this.sqlSelectCommand4.CommandText = "SELECT EMail, Discount FROM dtFrequentFliers WHERE (EMail = @EMail)";
			this.sqlSelectCommand4.Connection = this.sqlConnection1;
			this.sqlSelectCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EMail", System.Data.SqlDbType.VarChar, 50, "EMail"));
			// 
			// sqlInsertCommand4
			// 
			this.sqlInsertCommand4.CommandText = "INSERT INTO dtFrequentFliers(EMail, Discount) VALUES (@EMail, @Discount); SELECT " +
				"EMail, Discount FROM dtFrequentFliers WHERE (EMail = @EMail)";
			this.sqlInsertCommand4.Connection = this.sqlConnection1;
			this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EMail", System.Data.SqlDbType.VarChar, 50, "EMail"));
			this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Discount", System.Data.SqlDbType.Int, 4, "Discount"));
			// 
			// sqlUpdateCommand3
			// 
			this.sqlUpdateCommand3.CommandText = "UPDATE dtFrequentFliers SET EMail = @EMail, Discount = @Discount WHERE (EMail = @" +
				"Original_EMail) AND (Discount = @Original_Discount); SELECT EMail, Discount FROM" +
				" dtFrequentFliers WHERE (EMail = @EMail)";
			this.sqlUpdateCommand3.Connection = this.sqlConnection1;
			this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EMail", System.Data.SqlDbType.VarChar, 50, "EMail"));
			this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Discount", System.Data.SqlDbType.Int, 4, "Discount"));
			this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_EMail", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "EMail", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Discount", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Discount", System.Data.DataRowVersion.Original, null));
			// 
			// sqlDeleteCommand3
			// 
			this.sqlDeleteCommand3.CommandText = "DELETE FROM dtFrequentFliers WHERE (EMail = @Original_EMail) AND (Discount = @Ori" +
				"ginal_Discount)";
			this.sqlDeleteCommand3.Connection = this.sqlConnection1;
			this.sqlDeleteCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_EMail", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "EMail", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Discount", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Discount", System.Data.DataRowVersion.Original, null));
			// 
			// sqlDataAdapter4
			// 
			this.sqlDataAdapter4.DeleteCommand = this.sqlDeleteCommand3;
			this.sqlDataAdapter4.InsertCommand = this.sqlInsertCommand4;
			this.sqlDataAdapter4.SelectCommand = this.sqlSelectCommand4;
			this.sqlDataAdapter4.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "dtFrequentFliers", new System.Data.Common.DataColumnMapping[] {
																																																						  new System.Data.Common.DataColumnMapping("EMail", "EMail"),
																																																						  new System.Data.Common.DataColumnMapping("Discount", "Discount")})});
			this.sqlDataAdapter4.UpdateCommand = this.sqlUpdateCommand3;
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();

		}
		#endregion

		private void btnNext_Click(object sender, System.EventArgs e)
		{
			dataSet11.Clear();
			sqlConnection1.Open();
			sqlDataAdapter1.Fill(dataSet11, "FltDetails");
			sqlConnection1.Close();
			bool exists=false;
			foreach (DataRow myRow in dataSet11.Tables["FltDetails"].Rows)
			{
				if (myRow[0].ToString().Trim().ToLower()==txtFltNo.Text.ToLower())
				{
					exists=true;
					txtOrg.Text=myRow[1].ToString();
					txtDest.Text=myRow[2].ToString();
					txtDepTime.Text=myRow[3].ToString().Substring(myRow[3].ToString().Length-11).Trim();
					if(lstClass.SelectedIndex==0)
						txtFare.Text=myRow[8].ToString();
					else
						txtFare.Text=myRow[9].ToString();
				}
			}
			if (exists==false)
			{
				lblMessage.Text="Incorrect flight number. Please try again";
				return;
			}
			txtTNo.Text="Auto generated";
			txtFltNo.Enabled=false;
			lstClass.Enabled=false;
			Cal1.Enabled=false;
			sqlDataAdapter2.SelectCommand.Parameters[0].Value=txtFltNo.Text.Trim();
			sqlDataAdapter2.SelectCommand.Parameters[1].Value=Cal1.SelectedDate.ToShortDateString();
			sqlDataAdapter2.SelectCommand.Parameters[2].Value=lstClass.SelectedItem.Text;
			sqlConnection1.Open();
			sqlDataAdapter2.Fill(dataSet11, "FltStatus");
			if (dataSet11.Tables["FltStatus"].Rows.Count==0)
			{
				txtStatus.Text="Available";
			}
			else
			{
				int status=Convert.ToInt32(dataSet11.Tables["FltStatus"].Rows[0][3]);
				if (status<=0)
				{
					txtStatus.Text="Waitlisted (" + Convert.ToString((status-1)) + ")";
				}
				else
				{
					txtStatus.Text="Available";
				}
			}
		}
		private void txtCancel_Click(object sender, System.EventArgs e)
		{
			txtFltNo.Text="";
			lstClass.SelectedIndex=0;
			Cal1.SelectedDate=DateTime.Today;
			txtTNo.Text="";
			txtFare.Text="";
			txtStatus.Text="";
			txtOrg.Text="";
			txtDest.Text="";
			txtDepTime.Text="";
			txtName.Text="";
			txtEMail.Text="";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -