コード例 #1
0
ファイル: EditProfile.cs プロジェクト: shubhamid/lendabook
        private void button2_Click(object sender, EventArgs e)
        {
            if (ans == true && password.Equals(Encrypt(textBox1.Text)))
            {
                String password1 = textBox2.Text;
                if (password1 != null && password1.Equals(textBox3.Text))
                {
                    connect1();
                    comm1 = new MySqlCommand();
                    comm1.Connection = conn;
                    password1 = Encrypt(password1);
                    comm1.CommandText = "update database.login SET password = '******' where userid= '" + id + "'";
                    comm1.CommandType = CommandType.Text;
                    comm1.ExecuteNonQuery();
                    conn.Close();
                    ans2 = true;
                }
                else
                {

                    MessageBox.Show("New passwords do not match! Fill the form again.");
                    EditProfile ep1 = new EditProfile(id);
                    this.Hide();
                    ep1.Show();
                    textBox2.Clear();
                    textBox3.Clear();
                }

            }
            else if (!password.Equals(Encrypt(textBox1.Text)))
            {
                MessageBox.Show("Current password entered is wrong. Please login again.");
                this.Hide();
                Form1 f11 = new Form1();
                f11.Show();
                ans2 = false;
            }

            if (ans2 == true)
            {
                String fname = textBox4.Text;
                String lname = textBox5.Text;
                String email = textBox6.Text;
                String contactno = textBox7.Text;
                String contactno2 = textBox12.Text;
                String houseno = textBox8.Text;
                String streetno = textBox9.Text;
                String city = textBox10.Text;
                String State = textBox11.Text;
                // MessageBox.Show("");
                connect1();
                comm2 = new MySqlCommand();
                comm2.Connection = conn;
                comm2.CommandText = "update database.userinfo1 SET email='" + email + "', fname= '" + fname + "',lname = '" + lname + "',houseno = '" + houseno + "',streetno = '" + streetno + "',city = '" + city + "',state = '" + State + "' where userid = '" + id + "'";
                comm2.CommandType = CommandType.Text;
                comm2.ExecuteNonQuery();
                //MessageBox.Show("");
                comm3 = new MySqlCommand();
                comm3.Connection = conn;
                comm3.CommandText = "delete from database.userinfo2 where userid = '" + id + "'";
                comm3.CommandType = CommandType.Text;
                comm3.ExecuteNonQuery();
                if (textBox7.Text != null)
                {
                    comm3 = new MySqlCommand();
                    comm3.Connection = conn;
                    comm3.CommandText = "insert into database.userinfo2(userid,contactno) values ('" + id + "','" + contactno + "')";
                    comm3.CommandType = CommandType.Text;
                    comm3.ExecuteNonQuery();
                }

                // MessageBox.Show("");
                if (textBox12.Text != null && textBox12.Text != "Enter another number")
                {
                    comm3 = new MySqlCommand();
                    comm3.Connection = conn;
                    comm3.CommandText = "insert into database.userinfo2(userid,contactno) values ('" + id + "','" + contactno2 + "')";
                    comm3.CommandType = CommandType.Text;
                    comm3.ExecuteNonQuery();
                }
                conn.Close();
                MessageBox.Show("Your Information is updated. Please Sign in Again!");
                this.Hide();
                Form1 f12 = new Form1();
                f12.Show();
            }
        }
コード例 #2
0
ファイル: menu.cs プロジェクト: shubhamid/lendabook
 private void button4_Click(object sender, EventArgs e)
 {
     this.Close();
     EditProfile ep = new EditProfile(id);
     ep.Show();
 }