Ejemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string        a  = "";
            string        b  = "";
            string        c  = "";
            CustomerLogin cl = new CustomerLogin(a, b, c);

            cl.Owner = this;
            this.Hide();
            cl.ShowDialog();
            Close();
        }
Ejemplo n.º 2
0
        private void Rigiter_Click(object sender, RoutedEventArgs e)
        {
            SqlConnection con      = new SqlConnection(@"Data Source=DESKTOP-NN9ENGI\SQLEXPRESS;Initial Catalog=SOURCE;Integrated Security=True");
            string        Name     = textbox0.Text;
            string        Email    = textbox1.Text;
            string        Password = textbox2.Password;

            // con.Close();
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "select * from Register where Password='******'";
            try
            {
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    MessageBox.Show("This Password is Taken", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                    con.Close();
                }
                else
                {
                    con.Close();
                    try
                    {
                        con.Open();
                        SqlCommand cnd = con.CreateCommand();
                        cnd.CommandType = System.Data.CommandType.Text;

                        if (textbox0.Text == "" && textbox1.Text == "" && textbox2.Password == "")
                        {
                            MessageBox.Show("Mandotory Fields Must Fill first", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            cnd.CommandText = "insert into Register(Name,Email,Password) values('" + Name + "','" + Email + "','" + Password + "')"; //'" + source + "','" + time + "','" + date + "','" + search + "','" + password + "','" + Email + "')";
                            cnd.ExecuteNonQuery();
                            textbox0.Text     = "";
                            textbox1.Text     = "";
                            textbox2.Password = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    con.Close();
                    string        a  = textbox0.Text;
                    string        b  = textbox1.Text;
                    string        c  = textbox2.Password;
                    CustomerLogin cl = new CustomerLogin(a, b, c);
                    cl.Owner = this;
                    this.Hide();
                    cl.ShowDialog();
                    Close();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            //MessageBox.Show("Do you Want To Login","Confirmation!",MessageBoxButton.YesNo,)
        }