private static List<FeedbackInfo> getAllshopFeedbackList(FeedbackInfo feedbackinfo)
        {
            List<FeedbackInfo> shopFeedbackList = new List<FeedbackInfo>();

            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "Select * From feedback where item = @input ; ";

                msqlCommand.Parameters.AddWithValue("@input", feedbackinfo.name);
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    FeedbackInfo shopFeedback = new FeedbackInfo();

                    shopFeedback.feedDate = msqlReader.GetDateTime("feedDate");
                    shopFeedback.name = msqlReader.GetString("name");
                    shopFeedback.email = msqlReader.GetString("email");
                    shopFeedback.rate = msqlReader.GetString("rate");
                    shopFeedback.feedback = msqlReader.GetString("feedback");

                    shopFeedbackList.Add(shopFeedback);
                }

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }

            return shopFeedbackList;
        }
 public static List<FeedbackInfo> getshopFeedbackList(FeedbackInfo feedbackinfo)
 {
     return getAllshopFeedbackList(feedbackinfo);
 }
        private static int DoRegisterFeedbackindb(FeedbackInfo NewFeedback)
        {
            int returnVal = 0;
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {
                //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();

                //define the connection used by the command object
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "INSERT INTO feedback(id,feedDate,item,name,email,rate,feedback) "
                                    + "VALUES(@id,@feedDate,@item,@name,@email,@rate,@feedback)";

                msqlCommand.Parameters.AddWithValue("@id", NewFeedback.id);
                msqlCommand.Parameters.AddWithValue("@feedDate", NewFeedback.feedDate);
                msqlCommand.Parameters.AddWithValue("@item", NewFeedback.item);
                msqlCommand.Parameters.AddWithValue("@name", NewFeedback.name);
                msqlCommand.Parameters.AddWithValue("@email", NewFeedback.email);
                msqlCommand.Parameters.AddWithValue("@rate", NewFeedback.rate);
                msqlCommand.Parameters.AddWithValue("@feedback", NewFeedback.feedback);
                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
 public static List<FeedbackInfo> getproductFeedbackList(FeedbackInfo feedbackinfo)
 {
     return getAllproductFeedbackList(feedbackinfo);
 }
 public static int DoEnterFeedback(FeedbackInfo NewFeedback)
 {
     return DoRegisterFeedbackindb(NewFeedback);
 }
        private void GetSelectedshopfeedbackItem()
        {
            FeedbackInfo shopInfo = new FeedbackInfo();
            shopInfo.name = shopNameTb.Text;

            List<FeedbackInfo> shops = DbInteraction.getshopFeedbackList(shopInfo);

            _shopFeedbackCollection.Clear();

            foreach (FeedbackInfo shop in shops)
            {
                _shopFeedbackCollection.Add(shop);
            }
        }
        private void submitshopBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!nameTb.Text.Equals("") && !mailTb.Text.Equals("") && !ratingTb.Text.Equals("") && !feedbackTb.Text.Equals(""))
            {
            ShoppingMallData.FeedbackInfo newFeedback = new ShoppingMallData.FeedbackInfo();

            newFeedback.id = GenerateId();

            newFeedback.item = shopNameTb.Text;
            newFeedback.feedDate = feedDateDp.SelectedDate.Value;
            newFeedback.name = nameTb.Text;
            newFeedback.email = mailTb.Text;
            newFeedback.rate = ratingTb.Text;
            newFeedback.feedback = feedbackTb.Text;

            ShoppingMallDb.DbInteraction.DoEnterFeedback(newFeedback);
            clearshopfeedbackFields();
            //fetchFeedBackData();

            GetSelectedshopfeedbackItem();
            }
            else
            {
                MessageBox.Show("Please Insert Info Properly");
            }
        }
        private void GetSelectedProductfeedbackItem()
        {
            FeedbackInfo productInfo = new FeedbackInfo();
            productInfo.name = productNameTb.Text;

            List<FeedbackInfo> products = DbInteraction.getproductFeedbackList(productInfo);

            _productFeedbackCollection.Clear();

            foreach (FeedbackInfo product in products)
            {
                _productFeedbackCollection.Add(product);
            }
        }