private void b3_Click(object sender, EventArgs e) { psglogin p1 = new psglogin(); p1.Tag = this; p1.Show(this); Hide(); }
private void b1_Click(object sender, EventArgs e) { if (c1.Text == "PASSENGER") { psglogin p = new psglogin(); p.Tag = this; p.Show(this); Hide(); } if (c1.Text == "DRIVER") { DriverLogin d = new DriverLogin(); d.Tag = this; d.Show(this); Hide(); } }
public Psgapprovement(String Text1, String Text2) { InitializeComponent(); SqlConnection con = new SqlConnection(); SqlCommand com = new SqlCommand(); SqlDataAdapter d = new SqlDataAdapter(); con.ConnectionString = "Data Source=DESKTOP-4K792AB;" + "Initial Catalog=Taxi project;" + "Integrated Security=True;"; com.Connection = con; try { con.Open(); com.CommandType = CommandType.Text; com.CommandText = "Select * from Coordinate,OriginCity,DestinationCity where Coordinate.OID=OriginCity.ID and Coordinate.DID=DestinationCity.ID and OriginCity.CityName=@Ocity and DestinationCity.CityName=@Dcity"; com.Parameters.Add("@Ocity", Text1); com.Parameters.Add("@Dcity", Text2); d.SelectCommand = com; DataTable dt6 = new DataTable(); d.Fill(dt6); t1.Text = dt6.Rows[0]["Cost"].ToString(); t2.Text = dt6.Rows[0]["Time"].ToString(); String BID = dt6.Rows[0]["BID"].ToString(); com.CommandText = "insert into Travel([BID],[TDate]) values(@BID,GetDate())"; com.Parameters.Add("@BID", BID); com.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { MessageBox.Show("Travel provided soon!"); psglogin p1 = new psglogin(); p1.Tag = this; p1.Show(this); Hide(); } }
private void button1_Click_1(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=DESKTOP-4K792AB;" + "Initial Catalog=Taxi project;" + "Integrated Security=True;"; SqlCommand com = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); com.Connection = con; com.CommandText = "select * from passenger where passenger.ID=@User and Passenger.NCode=@Pass"; try { con.Open(); com.Parameters.AddWithValue("@User", t1.Text); com.Parameters.AddWithValue("@Pass", t2.Text); da.SelectCommand = com; DataTable dt1 = new DataTable(); da.Fill(dt1); t1.Text = dt1.Rows[0]["ID"].ToString(); MessageBox.Show(t1.Text + "WAS FOUND!!"); con.Close(); PTRequest p = new PTRequest(); p.Tag = this; p.Show(this); Hide(); } catch (Exception ex) { MessageBox.Show("National Code Is Already Available!"); psglogin p1 = new psglogin(); p1.Tag = this; p1.Show(this); Hide(); } }