private void searchBtn_Click(object sender, RoutedEventArgs e)
        {
            FundInfo fundInfoObj = new FundInfo();
            fundInfoObj.wellwisher_name = searchTxtBlck.Text;

            List<FundInfo> funds = BDMSDb.DbInteraction.SearchAllFundList(fundInfoObj);

            _fundCollection.Clear();

            foreach (FundInfo fund in funds)
            {
                _fundCollection.Add(fund);
            }
        }
        private static int DoRegisterNewFundInDb(FundInfo fundDetails)
        {
            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 fund(fund_Id,fund_wellwisher_name,fund_contact,fund_dod,fund_received_by,fund_amount) "
                                                   + "VALUES(@fund_Id,@fund_wellwisher_name,@fund_contact,@fund_dod,@fund_received_by,@fund_amount)";

                msqlCommand.Parameters.AddWithValue("@fund_Id", fundDetails.id);
                msqlCommand.Parameters.AddWithValue("@fund_wellwisher_name", fundDetails.wellwisher_name);
                msqlCommand.Parameters.AddWithValue("@fund_contact", fundDetails.contact);
                msqlCommand.Parameters.AddWithValue("@fund_dod", fundDetails.dod);
                msqlCommand.Parameters.AddWithValue("@fund_received_by", fundDetails.received_by);
                msqlCommand.Parameters.AddWithValue("@fund_amount", fundDetails.amount);

                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
        public static void EditFund(FundInfo fundToEdit)
        {
            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 = "UPDATE fund SET fund_wellwisher_name=@fund_wellwisher_name,fund_contact=@fund_contact,fund_dod=@fund_dod,fund_received_by=@fund_received_by,fund_amount=@fund_amount WHERE fund_id=@fund_id";

                msqlCommand.Parameters.AddWithValue("@fund_wellwisher_name", fundToEdit.wellwisher_name);
                msqlCommand.Parameters.AddWithValue("@fund_contact", fundToEdit.contact);
                msqlCommand.Parameters.AddWithValue("@fund_dod", fundToEdit.dod);
                msqlCommand.Parameters.AddWithValue("@fund_received_by", fundToEdit.received_by);
                msqlCommand.Parameters.AddWithValue("@fund_amount", fundToEdit.amount);
                msqlCommand.Parameters.AddWithValue("@fund_id", fundToEdit.id);
                msqlCommand.ExecuteNonQuery();

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
        }
 public static int DoRegisterNewFund(FundInfo fundDetails)
 {
     return DoRegisterNewFundInDb(fundDetails);
 }
        private static List<FundInfo> QueryAllFundList()
        {
            List<FundInfo> FundList = new List<FundInfo>();
            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 fund;";
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    FundInfo Fund = new FundInfo();

                    Fund.id = msqlReader.GetString("fund_Id");
                    Fund.wellwisher_name = msqlReader.GetString("fund_wellwisher_name");
                    Fund.contact = msqlReader.GetString("fund_contact");
                    Fund.dod = msqlReader.GetDateTime("fund_dod");
                    Fund.received_by = msqlReader.GetString("fund_received_by");
                    Fund.amount = msqlReader.GetDouble("fund_amount");

                    FundList.Add(Fund);
                }

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

            return FundList;
        }
        private void submitAddFundBtn_Click(object sender, RoutedEventArgs e)
        {
            BDMSData.FundInfo newFund = new BDMSData.FundInfo();

            newFund.id = GenerateId();
            newFund.wellwisher_name = well_wisher_name.Text;
            newFund.contact = contactNoTB.Text;
            newFund.dod = dODDatePicker.SelectedDate.Value;
            newFund.received_by = receivedByComboBox.Text;
            newFund.amount = Convert.ToDouble(amountsTB.Text);

            if (isEdit == false)
            {
                newFund.id = GenerateId();
                BDMSDb.DbInteraction.DoRegisterNewFund(newFund);
            }
            else
            {
                newFund.id = fundId;
                BDMSDb.DbInteraction.EditFund(newFund);
            }

            this.Close();
        }