private void button1_Click_1(object sender, EventArgs e)
        {
            Hide();
            EnquiryForm enquiryForm = new EnquiryForm();

            enquiryForm.Username = textBox1.Text;
            enquiryForm.Show();
        }
Esempio n. 2
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            Hide();
            GetUserDetails eForm1 = new GetUserDetails();
            EnquiryForm    eForm  = new EnquiryForm();

            eForm.Username     = Username;
            eForm1.GetUsername = Username;
            eForm.Show();
        }
Esempio n. 3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            SqlConnection con   = new SqlConnection(@"Server=localhost\MSSQLSERVER01;Database=BankApplication;Trusted_Connection=True;");
            String        Query = "Select * from dbo.User_Data Where Username = '******'";
            SqlCommand    cmd   = new SqlCommand(Query, con);

            cmd.CommandType = CommandType.Text;
            cmd.Connection  = con;
            con.Open();
            String password = "";

            using (SqlDataReader sdr = cmd.ExecuteReader())
            {
                sdr.Read();
                try
                {
                    password = encryptpass(textBox2.Text);
                    if (sdr["PinNumber"].ToString().TrimEnd().Equals(password) && sdr["Username"].ToString().TrimEnd().Equals(textBox1.Text))
                    {
                        EnquiryForm eForm = new EnquiryForm();
                        eForm.passingvalue = textBox1.Text;
                        eForm.Show();
                        Hide();
                        con.Close();
                    }

                    else
                    {
                        if (sdr["PinNumber"].ToString().TrimEnd() != textBox2.Text && sdr["Username"].ToString().TrimEnd() == textBox1.Text)
                        {
                            con.Close();
                            label4.Visible = true;
                        }
                        else
                        {
                            con.Close();
                            label3.Visible = true;
                        }
                    }
                }
                catch (Exception)
                {
                    con.Close();
                    label3.Visible = true;
                }
            }
        }
 private void GetUserDetails_Load(object sender, EventArgs e)
 {
     try
     {
         EnquiryForm e1 = new EnquiryForm();
         textBox1.Text = GetUsername.TrimEnd();
         textBox2.Text = GetPhoneNumber.TrimEnd();
         //password = encryptpass(GetPinNumber);
         textBox3.Text   = GetPinNumber.TrimEnd();
         textBox4.Text   = "Rs. " + GetBalanceAmount.TrimEnd();
         button2.Enabled = true;
         //label3.Visible = false;
         SqlConnection con   = new SqlConnection(@"Server=localhost\MSSQLSERVER01;Database=BankApplication;Trusted_Connection=True;");
         String        Query = "Select UserImage from dbo.User_Data Where Username = '******'";
         SqlCommand    cmd   = new SqlCommand(Query, con);
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = con;
         con.Open();
         try
         {
             using (SqlDataReader sdr = cmd.ExecuteReader())
             {
                 sdr.Read();
                 byte[] data = (byte[])sdr[0];
                 if (data == null)
                 {
                     UserImage.Image = null;
                 }
                 else
                 {
                     MemoryStream ms = new MemoryStream(data);
                     UserImage.Image = System.Drawing.Bitmap.FromStream(ms);
                 }
                 sdr.Close();
                 Hide();
                 con.Close();
             }
         }
         catch
         {
         }
     }
     catch (Exception)
     {
     }
 }
        private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Server=localhost\MSSQLSERVER01;Database=BankApplication;Trusted_Connection=True;");

            con.Open();

            String Query1 = "Select * from dbo.User_Data Where Username = '******'";

            SqlCommand cmd1 = new SqlCommand(Query1, con);

            cmd1.CommandType = CommandType.Text;
            cmd1.Connection  = con;

            SqlDataReader sdr = cmd1.ExecuteReader();

            {
                sdr.Read();
                try
                {
                    password = encryptpass(textBox3.Text);
                    if (sdr["Username"].ToString().Trim().Equals(textBox1.Text) && sdr["PhoneNumber"].ToString().Trim().Equals(textBox2.Text) && sdr["PinNumber"].ToString().Trim().Equals(password))
                    {
                        label6.Visible   = false;
                        label8.Visible   = false;
                        label5.Visible   = true;
                        textBox2.Enabled = false;
                        textBox3.Enabled = false;
                        textBox1.Enabled = false;
                        button3.Enabled  = false;
                    }
                    else
                    {
                        con.Close();
                        String     Query = "Update dbo.User_Data SET Username = '******',PhoneNumber='" + textBox2.Text + "', PinNumber='" + password + "' WHERE Username = '******'";
                        SqlCommand cmd   = new SqlCommand(Query, con);
                        cmd.Connection = con;
                        con.Open();
                        // password = encryptpass(textBox3.Text);
                        cmd.Parameters.AddWithValue("Username", textBox1.Text);
                        cmd.Parameters.AddWithValue("PhoneNumber", textBox2.Text);
                        cmd.Parameters.AddWithValue("PinNumber", password);

                        if (textBox1.Text.TrimEnd() == "" || textBox2.Text.TrimEnd() == "" || textBox3.Text.TrimEnd() == "" || textBox2.Text.TrimEnd().Length != 10 || textBox3.Text.TrimEnd().Length != 6)
                        {
                            label5.Visible = false;
                            label6.Visible = false;
                            label8.Visible = true;
                            //label7.Visible = true;
                            label8.Text = "No fields should be empty! Phone number must be 10 digits and pin number must be 6 digits";
                        }
                        else
                        {
                            try
                            {
                                //String Script = File.ReadAllText(@"C:\Users\HP\Documents\SQL Server Management Studio\BankApplicationUserData\BankApplicationUserData\Userdata.sql");
                                cmd.ExecuteNonQuery();
                                label5.Visible = false;
                                //label7.Visible = false;
                                label8.Visible   = false;
                                label6.Visible   = true;
                                textBox2.Enabled = false;
                                textBox3.Enabled = false;
                                textBox1.Enabled = false;
                                EnquiryForm enquiryForm = new EnquiryForm();
                                enquiryForm.Username = textBox1.Text;
                                button3.Enabled      = false;
                            }
                            catch
                            {
                                label5.Visible = false;
                                label6.Visible = false;
                                //label7.Visible = false;
                                label8.Visible = true;
                                textBox1.Text  = "";
                                textBox2.Text  = "";
                                textBox3.Text  = "";
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("999999999999");
                    con.Close();
                    String     Query = "Update dbo.User_Data SET Username = '******',PhoneNumber='" + textBox2.Text + "', PinNumber='" + password + "' WHERE Username = '******'";
                    SqlCommand cmd   = new SqlCommand(Query, con);
                    cmd.Connection = con;
                    con.Open();
                    cmd.Parameters.AddWithValue("Username", textBox1.Text);
                    cmd.Parameters.AddWithValue("PhoneNumber", textBox2.Text);
                    cmd.Parameters.AddWithValue("PinNumber", password);

                    if (textBox1.Text.TrimEnd() == "" || textBox2.Text.TrimEnd() == "" || textBox3.Text.TrimEnd() == "" || textBox2.Text.TrimEnd().Length != 10 || textBox3.Text.TrimEnd().Length != 6)
                    {
                        label5.Visible = false;
                        label6.Visible = false;
                        label8.Visible = true;
                        //label7.Visible = true;
                        label8.Text   = "No fields should be empty! Phone number must be 10 digits and pin number must be 6 digits";
                        textBox1.Text = "";
                        textBox2.Text = "";
                        textBox3.Text = "";
                    }
                    else
                    {
                        try
                        {
                            String Script = File.ReadAllText(@"C:\Users\HP\Documents\SQL Server Management Studio\BankApplicationUserData\BankApplicationUserData\Userdata.sql");
                            cmd.ExecuteNonQuery();
                            label5.Visible = false;
                            //label7.Visible = false;
                            label8.Visible = false;
                            label6.Visible = true;
                            EnquiryForm enquiryForm = new EnquiryForm();
                            enquiryForm.Username = textBox1.Text;
                            button3.Enabled      = false;
                        }
                        catch
                        {
                            label5.Visible = false;
                            label6.Visible = false;
                            //label7.Visible = false;
                            label8.Visible = true;
                            textBox1.Text  = "";
                            textBox2.Text  = "";
                            textBox3.Text  = "";
                        }
                    }
                }
            }
            con.Close();
        }