private void button1_Click(object sender, EventArgs e) { if ((txt_visa_number.Text.Length == 16 && txt_sec.Text.Length == 3) && (master_card.Checked == true || visa.Checked == true)) { string cardkind = ""; if (master_card.Checked == true) { cardkind = "Master Card"; } if (visa.Checked == true) { cardkind = "visa"; } ClsUsers.AddUser(txt_visa_number.Text, txt_sec.Text, cardkind); if (MessageBox.Show("ARE You Want To Add Another Visa ?", "Another Visa ?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { txt_visa_number.Text = ""; txt_sec.Text = ""; } else { login lg = new login(); lg.Show(); Hide(); } } }
private void button3_Click(object sender, EventArgs e) { if ((txt_visa_number.Text.Length == 16 && txt_sec.Text.Length == 3) && (master_card.Checked == true || visa.Checked == true)) { string cardkind = ""; if (master_card.Checked == true) { cardkind = "Master Card"; } if (visa.Checked == true) { cardkind = "visa"; } ClsUsers.AddUser(txt_visa_number.Text, txt_sec.Text, cardkind); if (MessageBox.Show("ARE You Want To Add Another Visa ?", "Another Visa ?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { txt_visa_number.Text = ""; txt_sec.Text = ""; } else { DataTable dtreg = new DataTable(); SqlCommand cmd2 = new SqlCommand(); cmd2.Connection = clset.cn; cmd2.CommandType = CommandType.StoredProcedure; cmd2.CommandText = "getpaymentcards2"; cmd2.Parameters.Add("@Id", SqlDbType.VarChar, 9).Value = login.idd; DataTable dt1 = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd2); da.Fill(dt1); clset.cn.Open(); dtreg.Load(cmd2.ExecuteReader()); if (dtreg.Rows.Count > 0) { Payment pm = new Payment(); pm.dataGridView_visa.DataSource = dt1; pm.Show(); Hide(); } dtreg.Reset(); clset.cn.Close(); } } else { MessageBox.Show("Please Insert Your Visa Information"); } }