private static int DoRegisterNewMemberInDb(MemberInfo memberDetails)
        {
            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 member(member_id,member_name,member_doj,member_address,member_contect) "
                                                   + "VALUES(@member_id,@member_name,@member_doj,@member_address,@member_contect)";

                msqlCommand.Parameters.AddWithValue("@member_id", memberDetails.id);
                msqlCommand.Parameters.AddWithValue("@member_name", memberDetails.name);
                msqlCommand.Parameters.AddWithValue("@member_doj", memberDetails.doj);
                msqlCommand.Parameters.AddWithValue("@member_address", memberDetails.address);
                msqlCommand.Parameters.AddWithValue("@member_contect", memberDetails.phone);

                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
        public static void EditMember(MemberInfo memberToEdit)
        {
            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 member SET member_name=@member_name,member_doj=@member_doj,member_address=@member_address,member_contect=@member_contect WHERE member_id=@id";

                msqlCommand.Parameters.AddWithValue("@member_name", memberToEdit.name);
                msqlCommand.Parameters.AddWithValue("@member_doj", memberToEdit.doj);
                msqlCommand.Parameters.AddWithValue("@member_address", memberToEdit.address);
                msqlCommand.Parameters.AddWithValue("@member_contect", memberToEdit.phone);
                msqlCommand.Parameters.AddWithValue("@id", memberToEdit.id);

                msqlCommand.ExecuteNonQuery();

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
        }
 public static int DoRegisterNewMember(MemberInfo memberDetails)
 {
     return DoRegisterNewMemberInDb(memberDetails);
 }
        private static List<MemberInfo> QueryAllMemberList()
        {
            List<MemberInfo> MemberList = new List<MemberInfo>();
            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 member;";
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    MemberInfo Member = new MemberInfo();

                    Member.id = msqlReader.GetString("member_id");
                    Member.name = msqlReader.GetString("member_name");
                    Member.doj = msqlReader.GetDateTime("member_doj");
                    Member.address = msqlReader.GetString("member_address");
                    Member.phone = msqlReader.GetString("member_contect");

                    MemberList.Add(Member);
                }

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

            return MemberList;
        }
 public static List<MemberInfo> SearchAllMemberList(MemberInfo memberinfoObj)
 {
     return DoSearchAllMemberList(memberinfoObj);
 }
        private void searchBtn_Click(object sender, RoutedEventArgs e)
        {
            MemberInfo memberinfoObj = new MemberInfo();
            memberinfoObj.name = searchTxtBlck.Text;

            List<MemberInfo> members = BDMSDb.DbInteraction.SearchAllMemberList(memberinfoObj);

            _memberCollection.Clear();

            foreach (MemberInfo member in members)
            {
                _memberCollection.Add(member);
            }
        }