最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#實現(xiàn)航班預訂系統(tǒng)

 更新時間:2022年05月27日 17:18:09   作者:Xuxiaoooo  
這篇文章主要為大家詳細介紹了C#實現(xiàn)航班預訂系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了C#實現(xiàn)航班預訂的具體代碼,供大家參考,具體內(nèi)容如下

連接數(shù)據(jù)庫

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

namespace MyTickets
{
? ? public class DBHelper
? ? {
? ? ? ? //數(shù)據(jù)庫連接字符串
? ? ? ? public string connString = @"Data Source=.;Initial Catalog=MyTicket;Trusted_Connection=Yes;Connect Timeout=90";
? ? ? ? /// <summary>
? ? ? ? /// 數(shù)據(jù)庫連接對象
? ? ? ? /// </summary>
? ? ? ? private SqlConnection connction;
? ? public SqlConnection Connction
? ? ? ? {
? ? ? ? ? ? get
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (connction == null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? connction = new SqlConnection(connString);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? return connction;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? /// <summary>
? ? ? ? /// 打開數(shù)據(jù)庫連接
? ? ? ? /// </summary>
? ? ? ? public void OpenConnection()
? ? ? ? {
? ? ? ? ? ? if (connction.State == ConnectionState.Closed)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Connction.Open();
? ? ? ? ? ? }
? ? ? ? ? ? else if (connction.State == ConnectionState.Broken)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Connction.Close();
? ? ? ? ? ? ? ? Connction.Open();
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
? ? ? ? /// <summary>
? ? ? ? /// 關(guān)閉數(shù)據(jù)庫連接
? ? ? ? /// </summary>
? ? ? ? public void CloseConnection()
? ? ? ? {
? ? ? ? ? ? if(connction.State==ConnectionState.Open|| connction.State == ConnectionState.Broken)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Connction.Close();
? ? ? ? ? ? }
? ? ? ? }

? ? }
}

開頭動畫代碼

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace MyTickets
{
? ? public partial class 開頭 : Form
? ? {
? ? ? ? public 開頭()
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? ? ? timer1.Interval = 1000;
? ? ? ? ? ? timer1.Start();
? ? ? ? ? ? timer1.Tick += new EventHandler(timer1_Tick);
? ? ? ? }


? ? ? ? private void 開頭_Load(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? TransparencyKey = BackColor;
? ? ? ? ? ??
? ? ? ? }

? ? ? ? private void timer1_Tick(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? timer1.Stop();
? ? ? ? ? ? 初始界面 f0 = new 初始界面();
? ? ? ? ? ? this.Hide();
? ? ? ? ? ? f0.ShowDialog();
? ? ? ? }
? ? }
}

機票預訂界面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace MyTickets
{
? ? public partial class 機票預訂 : Form
? ? {
? ? ? ? #region 構(gòu)造函數(shù)
? ? ? ? public 機票預訂()
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? }

? ? ? ? public 機票預訂(string text)
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? ? ? usename.Text = text;
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 方法

? ? ? ? #region 綁定cbo
? ? ? ? /// <summary>
? ? ? ? /// 綁定cbo
? ? ? ? /// </summary>
? ? ? ? private void BindCbo()
? ? ? ? {
? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? //sql語句
? ? ? ? ? ? string sql = "select * from cityInfo";
? ? ? ? ? ? //適配器adapter
? ? ? ? ? ? SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connction);
? ? ? ? ? ? //數(shù)據(jù)集
? ? ? ? ? ? DataSet ds = new DataSet();
? ? ? ? ? ? //填充數(shù)據(jù)集
? ? ? ? ? ? adapter.FillSchema(ds, SchemaType.Source, "cityInfo");
? ? ? ? ? ? adapter.Fill(ds, "cityInfo");
? ? ? ? ? ? //新的一行
? ? ? ? ? ? DataRow row = ds.Tables["cityInfo"].NewRow();
? ? ? ? ? ? row[0] = -1;
? ? ? ? ? ? row[1] = "請選擇";
? ? ? ? ? ? //插入
? ? ? ? ? ? ds.Tables["cityInfo"].Rows.InsertAt(row, 0);
? ? ? ? ? ? //獲取視圖
? ? ? ? ? ? DataView dv1 = new DataView(ds.Tables["cityInfo"]);
? ? ? ? ? ? DataView dv2 = new DataView(ds.Tables["cityInfo"]);
? ? ? ? ? ? //綁定
? ? ? ? ? ? this.cboDestinationCity.DataSource = dv1;
? ? ? ? ? ? this.cboDestinationCity.DisplayMember = "cityName";
? ? ? ? ? ? this.cboDestinationCity.ValueMember = "id";

? ? ? ? ? ? this.cboLeaveCity.DataSource = dv2;
? ? ? ? ? ? this.cboLeaveCity.DisplayMember = "cityName";
? ? ? ? ? ? this.cboLeaveCity.ValueMember = "id";?
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 綁定dgv
? ? ? ? /// <summary>
? ? ? ? /// 綁定dgv
? ? ? ? /// </summary>
? ? ? ? private void BindDgv()
? ? ? ? {
? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? string sql = string.Format(@"select flightNo,airways,leaveTime,landTime,price
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? from flightInfo,airwaysInfo
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? where flightInfo.airwaysId=airwaysInfo.id
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? and leaveCity={0}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? and destinationCity={1}", cboLeaveCity.SelectedValue, cboDestinationCity.SelectedValue);
? ? ? ? ? ? SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connction);
? ? ? ? ? ? DataSet ds = new DataSet();
? ? ? ? ? ? adapter.Fill(ds, "flightInfo");
? ? ? ? ? ? this.dataGridView1.DataSource = ds.Tables["flightInfo"];
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 驗證預訂部分的用戶輸入
? ? ? ? /// <summary>
? ? ? ? /// 驗證預訂部分的用戶輸入
? ? ? ? /// </summary>
? ? ? ? /// <returns></returns>
? ? ? ? private bool ValidateInput()
? ? ? ? {
? ? ? ? ? ? if (txtFlightNo.Text == string.Empty)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("請選擇一個航班!");
? ? ? ? ? ? ? ? return false;
? ? ? ? ? ? }
? ? ? ? ? ? if (dateTimePicker1.Value < DateTime.Now)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("請選擇正確的出發(fā)日期!");
? ? ? ? ? ? ? ? dateTimePicker1.Focus();
? ? ? ? ? ? ? ? return false;
? ? ? ? ? ? }
? ? ? ? ? ? return true;
? ? ? ? }?
? ? ? ? #endregion

? ? ? ? #endregion

? ? ? ? #region 事件
? ? ? ? //加載事件
? ? ? ? private void Form1_Load(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? BindCbo();
? ? ? ? ? ? TransparencyKey = BackColor;

? ? ? ? }
? ? ? ? //查詢事件
? ? ? ? private void tbnQuery_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? if(cboLeaveCity.Text=="請選擇"||cboDestinationCity.Text=="請選擇")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("請選擇出發(fā)地與目的地!");
? ? ? ? ? ? ? ? this.dataGridView1.DataSource = null;
? ? ? ? ? ? ? ? return;
? ? ? ? ? ? }
? ? ? ? ? ? BindDgv();
? ? ? ? ? ? //清空txt
? ? ? ? ? ? foreach (Control c in groupBox2.Controls)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(c is TextBox)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? c.Text = string.Empty;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? //單擊dgv
? ? ? ? private void dataGridView1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? if(dataGridView1.Rows.Count>0)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? this.txtFlightNo.Text = dataGridView1.CurrentRow.Cells["flightNo"].Value.ToString();
? ? ? ? ? ? ? ? this.txtAirways.Text = dataGridView1.CurrentRow.Cells["airways"].Value.ToString();
? ? ? ? ? ? ? ? this.txtFrom.Text = cboLeaveCity.Text;
? ? ? ? ? ? ? ? this.txtTo.Text = cboDestinationCity.Text;
? ? ? ? ? ? ? ? this.txtLeaveTime.Text = dataGridView1.CurrentRow.Cells["leaveTime"].Value.ToString();
? ? ? ? ? ? ? ? this.txtLandTime.Text = dataGridView1.CurrentRow.Cells["landTime"].Value.ToString();
? ? ? ? ? ? ? ? this.txtPrice.Text = dataGridView1.CurrentRow.Cells["price"].Value.ToString();
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? //點擊關(guān)閉
? ? ? ? private void button2_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? Application.Exit();
? ? ? ? }

? ? ? ? //點擊預定
? ? ? ? private void button1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? if(ValidateInput())
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Random random = new Random();
? ? ? ? ? ? ? ? int orderId= random.Next(100000, 9999999);
? ? ? ? ? ? ? ? string flightNo = this.txtFlightNo.Text;
? ? ? ? ? ? ? ? string leaveDate = this.dateTimePicker1.Value.ToShortDateString();
? ? ? ? ? ? ? ? string landTime = this.txtLandTime.Text;
? ? ? ? ? ? ? ? string price = this.txtPrice.Text;
? ? ? ? ? ? ? ? int num = (int)this.numNunber.Value;
? ? ? ? ? ? ? ? string leavePlace = this.txtFrom.Text;
? ? ? ? ? ? ? ? string landPlace = this.txtTo.Text;
? ? ? ? ? ? ? ? string usename = this.usename.Text;
? ? ? ? ? ? ? ? string sql = string.Format(@"insert into orderInfo(orderId,flightNo,leaveDate,landTime,price,Number,leavePlace,landPlace,useId)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? values({0},'{1}','{2}','{3}','{4}',{5},'{6}','{7}','{8}')", orderId, flightNo, leaveDate,landTime,price,num, leavePlace, landPlace,usename);
? ? ? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? ? ? try
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? //執(zhí)行工具
? ? ? ? ? ? ? ? ? ? SqlCommand cmd = new SqlCommand(sql, dbHelper.Connction);
? ? ? ? ? ? ? ? ? ? //打開數(shù)據(jù)庫
? ? ? ? ? ? ? ? ? ? dbHelper.OpenConnection();
? ? ? ? ? ? ? ? ? ? //執(zhí)行
? ? ? ? ? ? ? ? ? ? int result =cmd.ExecuteNonQuery();
? ? ? ? ? ? ? ? ? ? //判斷
? ? ? ? ? ? ? ? ? ? if(result>0)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? MessageBox.Show("預訂成功!訂單編號是:" + orderId);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? MessageBox.Show("預定失敗,請重試!");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? catch(Exception ex)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("發(fā)生錯誤,請聯(lián)系管理員,錯誤原因是:"+ex.Message);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? finally
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? dbHelper.CloseConnection();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? #endregion

? ? ? ? #region 鼠標移動
? ? ? ? Point mouseOff;//鼠標移動位置變量
? ? ? ? bool leftFlag;//標簽是否為左鍵
? ? ? ? private void 機票預訂_MouseDown(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (e.Button == MouseButtons.Left)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? mouseOff = new Point(-e.X, -e.Y); //得到變量的值
? ? ? ? ? ? ? ? leftFlag = true; ? ? ? ? ? ? ? ? ?//點擊左鍵按下時標注為true;

? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 機票預訂_MouseMove(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {

? ? ? ? ? ? ? ? Point mouseSet = Control.MousePosition;
? ? ? ? ? ? ? ? mouseSet.Offset(mouseOff.X, mouseOff.Y); ?//設(shè)置移動后的位置
? ? ? ? ? ? ? ? Location = mouseSet;
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 機票預訂_MouseUp(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? leftFlag = false;//釋放鼠標后標注為false;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? #endregion

? ? }
}

訂單查詢界面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace MyTickets
{
? ? public partial class 訂單查詢 : Form
? ? {
? ? ? ? public 訂單查詢(string text)
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? ? ? usename.Text = text.ToString();
? ? ? ? }
? ? ? ? #region 鼠標移動
? ? ? ? Point mouseOff;//鼠標移動位置變量
? ? ? ? bool leftFlag;//標簽是否為左鍵
? ? ? ? private void 訂單查詢_MouseDown(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (e.Button == MouseButtons.Left)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? mouseOff = new Point(-e.X, -e.Y); //得到變量的值
? ? ? ? ? ? ? ? leftFlag = true; ? ? ? ? ? ? ? ? ?//點擊左鍵按下時標注為true;

? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 訂單查詢_MouseMove(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {

? ? ? ? ? ? ? ? Point mouseSet = Control.MousePosition;
? ? ? ? ? ? ? ? mouseSet.Offset(mouseOff.X, mouseOff.Y); ?//設(shè)置移動后的位置
? ? ? ? ? ? ? ? Location = mouseSet;
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 訂單查詢_MouseUp(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? leftFlag = false;//釋放鼠標后標注為false;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? #endregion

? ? ? ? private void 訂單查詢_Load(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? string sql = string.Format(@"select orderId,flightNo,leaveDate,landTime,leavePlace,landPlace from orderInfo where useId ='{0}'",usename);
? ? ? ? ? ? SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connction);
? ? ? ? ? ? DataSet ds = new DataSet();
? ? ? ? ? ? adapter.Fill(ds, "orderInfo");
? ? ? ? ? ? this.dataGridView1.DataSource = ds.Tables["orderInfo"];
? ? ? ? }

? ? ? ? private void button1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? Application.Exit();
? ? ? ? }
? ? }
}

登錄界面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Data.SqlClient;


namespace MyTickets
{
? ? public partial class 初始界面 : Form
? ? {

? ? ? ? public 初始界面()
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? }
? ? ? ? int count = 0;

? ? ? ? #region 鼠標移動
? ? ? ? Point mouseOff;//鼠標移動位置變量
? ? ? ? bool leftFlag;//標簽是否為左鍵
? ? ? ? private void 初始界面_MouseDown(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (e.Button == MouseButtons.Left)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? mouseOff = new Point(-e.X, -e.Y); //得到變量的值
? ? ? ? ? ? ? ? leftFlag = true; ? ? ? ? ? ? ? ? ?//點擊左鍵按下時標注為true;

? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 初始界面_MouseMove(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {

? ? ? ? ? ? ? ? Point mouseSet = Control.MousePosition;
? ? ? ? ? ? ? ? mouseSet.Offset(mouseOff.X, mouseOff.Y); ?//設(shè)置移動后的位置
? ? ? ? ? ? ? ? Location = mouseSet;
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private void 初始界面_MouseUp(object sender, MouseEventArgs e)
? ? ? ? {
? ? ? ? ? ? if (leftFlag)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? leftFlag = false;//釋放鼠標后標注為false;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 打開其他窗口

? ? ? ? private void 查詢訂單btn_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? string userid = this.用戶名TEXT.Text;
? ? ? ? ? ? string psword = this.passwordtxt.Text;
? ? ? ? ? ? if (userid.Equals("") || psword.Equals(""))//用戶名或密碼為空
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("用戶名或密碼不能為空");
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? string sql = string.Format(@"select useId,psword from LoginIn where useId = '{0}' and psWord = '{1}'", userid, psword);
? ? ? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? ? ? SqlCommand cmd = new SqlCommand(sql, dbHelper.Connction);
? ? ? ? ? ? ? ? dbHelper.OpenConnection();
? ? ? ? ? ? ? ? SqlDataReader sdr = cmd.ExecuteReader();

? ? ? ? ? ? ? ? if (sdr.Read())
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("信息驗證成功");

? ? ? ? ? ? ? ? ? ? //跳轉(zhuǎn)到主頁面
? ? ? ? ? ? ? ? ? ? 訂單查詢 fd = new 訂單查詢(用戶名TEXT.Text);
? ? ? ? ? ? ? ? ? ? fd.ShowDialog();
? ? ? ? ? ? ? ? ? ? this.Hide();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("用戶名或密碼錯誤");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 輪播
? ? ? ? private void ChangeImage(Image img, int millisecondsTimeOut)
? ? ? ? {
? ? ? ? ? ? if (this.IsHandleCreated)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? this.Invoke(new Action(() =>
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? 輪播1.Image = img;
? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ? );
? ? ? ? ? ? }
? ? ? ? ? ? Thread.Sleep(millisecondsTimeOut);
? ? ? ? }
? ? ? ? private void 初始界面_Load(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? Thread th;
? ? ? ? ? ? th = new Thread
? ? ? ? ? ? ? ? (
? ? ? ? ? ? ? ? ? ? delegate ()
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? // 3就是要循環(huán)輪數(shù)了
? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < 100; i++)
? ? ? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? ? ? //調(diào)用方法
? ? ? ? ? ? ? ? ? ? ? ? ? ? ChangeImage(Properties.Resources.東方航空, 2000);
? ? ? ? ? ? ? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ChangeImage(Properties.Resources.南方航空, 2000);
? ? ? ? ? ? ? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ChangeImage(Properties.Resources.四川航空, 2000);
? ? ? ? ? ? ? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ChangeImage(Properties.Resources.海南航空, 2000);
? ? ? ? ? ? ? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? );
? ? ? ? ? ? th.IsBackground = true;
? ? ? ? ? ? th.Start();
? ? ? ? }

? ? ? ? //關(guān)閉
? ? ? ? private void label1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? Application.Exit();
? ? ? ? }

? ? ? ? //輪播
? ? ? ? private void pictureBox1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? if (count % 4 == 0)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.Diagnostics.Process.Start("http://www.ceair.com/");
? ? ? ? ? ? }
? ? ? ? ? ? if (count % 4 == 3)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.Diagnostics.Process.Start("https://www.hnair.com/");
? ? ? ? ? ? }
? ? ? ? ? ? if (count % 4 == 1)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.Diagnostics.Process.Start("https://www.csair.com/");
? ? ? ? ? ? }
? ? ? ? ? ? if (count % 4 == 2)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.Diagnostics.Process.Start("http://www.sichuanair.com/");
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? #endregion

? ? ? ? #region 綁定登錄
? ? ? ? private void 登錄btn_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? string userid = this.用戶名TEXT.Text;
? ? ? ? ? ? string psword = this.passwordtxt.Text;
? ? ? ? ? ? if (userid.Equals("") || psword.Equals(""))//用戶名或密碼為空
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("用戶名或密碼不能為空");
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? string sql = string.Format(@"select useId,psword from LoginIn where useId = '{0}' and psWord = '{1}'",userid, psword);
? ? ? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? ? ? SqlCommand cmd = new SqlCommand(sql, dbHelper.Connction);
? ? ? ? ? ? ? ? dbHelper.OpenConnection();
? ? ? ? ? ? ? ? SqlDataReader sdr = cmd.ExecuteReader();

? ? ? ? ? ? ? ? if (sdr.Read())
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("信息驗證成功");

? ? ? ? ? ? ? ? ? ? //跳轉(zhuǎn)到主頁面
? ? ? ? ? ? ? ? ? ? 機票預訂 f2 = new 機票預訂(用戶名TEXT.Text);
? ? ? ? ? ? ? ? ? ? this.Hide();
? ? ? ? ? ? ? ? ? ? f2.ShowDialog();

? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("用戶名或密碼錯誤");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ??

? ? ? ? } ??
? ? ? ? #endregion
? ? ? ??
? ? ? ? #region 綁定注冊
? ? ? ? private void 注冊btn_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? string userid = this.用戶名TEXT.Text;
? ? ? ? ? ? string psword = this.passwordtxt.Text;
? ? ? ? ? ? string sql = string.Format(@"insert into LoginIn(useId,psWord)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? values('{0}','{1}')", userid, psword);
? ? ? ? ? ? DBHelper dbHelper = new DBHelper();
? ? ? ? ? ? try
? ? ? ? ? ? {
? ? ? ? ? ? ? ? //執(zhí)行工具
? ? ? ? ? ? ? ? SqlCommand cmd = new SqlCommand(sql, dbHelper.Connction);
? ? ? ? ? ? ? ? //打開數(shù)據(jù)庫
? ? ? ? ? ? ? ? dbHelper.OpenConnection();
? ? ? ? ? ? ? ? //執(zhí)行
? ? ? ? ? ? ? ? int result = cmd.ExecuteNonQuery();
? ? ? ? ? ? ? ? //判斷
? ? ? ? ? ? ? ? if (result > 0)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("注冊成功,請登錄!");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MessageBox.Show("注冊失敗,請重試!");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? catch (Exception ex)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? MessageBox.Show("發(fā)生錯誤,請聯(lián)系管理員,錯誤原因是:" + ex.Message);
? ? ? ? ? ? }

? ? ? ? }
? ? ? ? #endregion


? ? }
}

下面是一些效果圖

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:

相關(guān)文章

  • c#創(chuàng)建windows服務(wù)(Windows Services)詳細步驟

    c#創(chuàng)建windows服務(wù)(Windows Services)詳細步驟

    這篇文章主要介紹了c#創(chuàng)建windows服務(wù)(Windows Services)詳細步驟,大家參考使用吧
    2013-12-12
  • 積累Visual Studio 常用快捷鍵的動畫演示

    積累Visual Studio 常用快捷鍵的動畫演示

    在代碼開發(fā)過程中,頻繁的使用鍵盤、鼠標操作非常麻煩,影響程序的開發(fā)效率。如何操作能用鍵盤來操作,那就節(jié)省時間了。下面小編把我平時積累的有關(guān)visul studio 常用快捷鍵的動畫演示分享給大家,僅供大家參考
    2015-10-10
  • C#實現(xiàn)石頭剪刀布游戲

    C#實現(xiàn)石頭剪刀布游戲

    這篇文章主要為大家詳細介紹了C#實現(xiàn)石頭剪刀布游戲,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-10-10
  • C# 各種導出的方法總結(jié)

    C# 各種導出的方法總結(jié)

    本篇文章主要介紹了C# 各種導出方法的相關(guān)知識,具有很好的參考價值。下面跟著小編一起來看下吧
    2017-05-05
  • 日常收集C#接口知識(知識全面)

    日常收集C#接口知識(知識全面)

    本文分為七章節(jié)給大家介紹c#接口知識,內(nèi)容比較詳細,特此分享腳本之家平臺,供大家參考
    2016-01-01
  • C# 解析XML和反序列化的示例

    C# 解析XML和反序列化的示例

    這篇文章主要介紹了C# 解析XML和反序列化的示例,幫助大家更好的理解和學習使用c#,感興趣的朋友可以了解下
    2021-04-04
  • C#清理非托管對象實例分析

    C#清理非托管對象實例分析

    這篇文章主要介紹了C#清理非托管對象的方法,結(jié)合實例形式詳細分析了C#清理非托管對象釋放資源的相關(guān)原理與實現(xiàn)技巧,需要的朋友可以參考下
    2016-02-02
  • C#實現(xiàn)縮放字體的方法

    C#實現(xiàn)縮放字體的方法

    這篇文章主要介紹了C#實現(xiàn)縮放字體的方法,涉及C#操作Matrix實現(xiàn)字體縮放的相關(guān)技巧,需要的朋友可以參考下
    2015-06-06
  • .net與javascript腳本的交互方法總結(jié)

    .net與javascript腳本的交互方法總結(jié)

    這篇文章主要介紹了.net與javascript腳本的交互方法,實例講述了.net訪問javascript的方法與javascript訪問.net的方法,非常具有實用價值,需要的朋友可以參考下
    2014-10-10
  • C#中datatable序列化與反序列化實例分析

    C#中datatable序列化與反序列化實例分析

    這篇文章主要介紹了C#中datatable序列化與反序列化,是datatable的常用技巧,需要的朋友可以參考下
    2014-09-09

最新評論

萝北县| 安达市| 临朐县| 顺昌县| 砀山县| 定州市| 东宁县| 浏阳市| 苍南县| 四子王旗| 江口县| 资溪县| 盐边县| 达日县| 沛县| 全州县| 囊谦县| 伊通| 肃南| 黔江区| 图片| 阜康市| 宁城县| 合阳县| 永福县| 公安县| 诏安县| 达孜县| 衡阳县| 大庆市| 中宁县| 英德市| 宜阳县| 阿克苏市| 尼木县| 呼和浩特市| 台湾省| 乌拉特前旗| 柳江县| 湟中县| 梁山县|