private void buttonX3_Click(object sender, EventArgs e) { SqlDataReader At; cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "select * from Accinfo where Pin=@p"; cmd.Parameters.AddWithValue("@P", PinTxt.Text); con.Open(); At = cmd.ExecuteReader(); if (At.Read()) { AccNum = At["AccNum"].ToString(); Ballance = Convert.ToInt32(At["Ballance"]); PinTxt.Text = ""; superTabControl1.SelectedTab = superTabItem3; } else { MessageBox.Show("رمز اشتباه است"); PinTxt.Text = ""; PinTxt.Focus(); con.Close(); return; } con.Close(); }
private void buttonX11_Click(object sender, EventArgs e) { SqlDataReader At; cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "select * from Accinfo where Pin=@p"; cmd.Parameters.AddWithValue("@P", PinTxt.Text); con.Open(); At = cmd.ExecuteReader(); if (At.Read()) { AccNum = At["AccNum"].ToString(); Ballance = Convert.ToInt32(At["Ballance"]); } if (Ballance <= Int32.Parse(amtxt.Text)) { MessageBox.Show("موجودی حساب کافی نمیباشد"); con.Close(); } con.Close(); //################################################# string AccNum2, AccName2; SqlDataReader dr1; cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "Select * from Accinfo2 where AccNum2=@N"; cmd.Parameters.AddWithValue("@N", AccN2T.Text); con.Open(); dr1 = cmd.ExecuteReader(); if (dr1.Read()) { AccNum2 = dr1["AccNum2"].ToString(); AccName2 = dr1["AccName2"].ToString(); l1.Visible = true; l2.Visible = true; l3.Visible = true; l4.Visible = true; l5.Visible = true; l6.Visible = true; l7.Visible = true; l8.Visible = true; buttonX12.Visible = true; l2.Text = AccNum; l4.Text = AccNum2; l6.Text = AccName2; l8.Text = amtxt.Text; con.Close(); } else { MessageBox.Show("شماره کارت اشتباه است"); AccN2T.Text = ""; AccN2T.Focus(); return; } con.Close(); }