コード例 #1
0
 private void hideCustomerEdit()
 {
     CustomerName.Show();
     customerNameTextBox.Hide();
     CustomerEmail.Show();
     customerEmailTextBox.Hide();
     CustomerPhone.Show();
     customerPhoneTextBox.Hide();
     EditCustomerInfoButton.Show();
     CancelChangeButton.Hide();
     AcceptChangeButton.Hide();
 }
コード例 #2
0
        private void checkCustomerDataChanged(int customerId)
        {
            SqlConnection con = new SqlConnection("Data Source=luxefood.database.windows.net;Initial Catalog=LuxeFoods;User ID=Klees;Password=Johnny69;Connect Timeout=60;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
            DataSet       ds  = new DataSet();

            con.Open();
            SqlCommand     read  = new SqlCommand($"SELECT * from [user] WHERE id='{customerId}'", con);
            SqlDataAdapter adapt = new SqlDataAdapter(read);

            adapt.FillSchema(ds, SchemaType.Source, "CustomerInfo");
            adapt.Fill(ds, "CustomerInfo");
            con.Close();

            DataTable tblCustomerInfo = ds.Tables["CustomerInfo"];

            var names = customerNameTextBox.Text.Split();

            if (names.Length >= 2)
            {
                foreach (DataRow x in tblCustomerInfo.Rows)
                {
                    if ((string)x["voornaam"] != names[0] || (string)x["achternaam"] != names[1] || (string)x["email"] != customerEmailTextBox.Text || (string)x["telefoonnummer"] != customerPhoneTextBox.Text)
                    {
                        AcceptChangeButton.Show();
                    }
                    else
                    {
                        AcceptChangeButton.Hide();
                    }
                }
            }
            else if (names.Length >= 1)
            {
                foreach (DataRow x in tblCustomerInfo.Rows)
                {
                    if ((string)x["voornaam"] != names[0] || (string)x["achternaam"] != names[0] || (string)x["email"] != customerEmailTextBox.Text || (string)x["telefoonnummer"] != customerPhoneTextBox.Text)
                    {
                        AcceptChangeButton.Show();
                    }
                    else
                    {
                        AcceptChangeButton.Hide();
                    }
                }
            }
        }