private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            TextBox[] txbArray = { txbId, txbFirstName, txbLastName, txbNationalCode };
            bool      a        = MyFunctions.isTextBoxEmpty(txbArray);

            if (!a)
            {
                return;
            }

            bool b = MyFunctions.isTextBoxInt("Please Enter only integeral valuse in ID & National Code.", txbId, txbNationalCode);

            if (!b)
            {
                return;
            }

            bool c = MyFunctions.checkTextBoxLenght(4, txbId);

            if (!c)
            {
                return;
            }

            bool d = MyFunctions.checkDatePickerValidation(dpRegistrationDate);

            if (!d)
            {
                return;
            }

            bool f = MyFunctions.checkTextBoxLenght(10, txbNationalCode);

            if (!f)
            {
                return;
            }

            if (!MemberList.ContainsKey(txbId.Text))
            {
                Member temp = new Member();
                temp.FirstName     = txbFirstName.Text;
                temp.LastName      = txbLastName.Text;
                temp.NationalCode  = txbNationalCode.Text;
                temp.Id            = txbId.Text;
                temp.RegisteryDate = (DateTime)dpRegistrationDate.SelectedDate;
                MemberList.Add(txbId.Text, temp);
                MessageBox.Show("Member successfully added.");
            }
            else
            {
                MessageBox.Show("This ID is already used.");
                txbId.Clear();
                txbId.Focus();
                return;
            }
            txbFirstName.Clear(); txbId.Clear(); txbLastName.Clear();
            dpRegistrationDate.Text = ""; txbNationalCode.Clear();
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            TextBox[] txbArray = { txbName, txbId, txbWriterName, txbPublisher, txbPublicationYear, txbTotalNumber };
            bool      a        = MyFunctions.isTextBoxEmpty(txbArray);

            if (!a)
            {
                return;
            }

            bool b = MyFunctions.isTextBoxInt("Please Enter only integeral valuse in Id ,publication year and number", txbId, txbPublicationYear, txbTotalNumber);

            if (!b)
            {
                return;
            }

            bool c = MyFunctions.checkTextBoxLenght(4, txbId, txbPublicationYear);

            if (!c)
            {
                return;
            }

            bool d = MyFunctions.checkDatePickerValidation(dpRegistrationDate);

            if (!d)
            {
                return;
            }

            if (!BookList.ContainsKey(txbId.Text))
            {
                Book temp = new Book();
                temp.Name            = txbName.Text;
                temp.Id              = txbId.Text;
                temp.Writer          = txbWriterName.Text;
                temp.Publisher       = txbPublisher.Text;
                temp.PublicationYear = Convert.ToInt32(txbPublicationYear.Text);
                temp.TotalNumber     = Convert.ToInt32(txbTotalNumber.Text);
                temp.Registration    = (DateTime)dpRegistrationDate.SelectedDate;
                BookList.Add(txbId.Text, temp);
                MessageBox.Show("Book successfully added.");
            }
            else
            {
                MessageBox.Show("This id is already used.");
                txbId.Clear();
                txbId.Focus();
                return;
            }
            txbName.Clear(); txbId.Clear(); txbWriterName.Clear(); txbPublisher.Clear();
            txbPublicationYear.Clear(); txbTotalNumber.Clear(); dpRegistrationDate.Text = "";
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            TextBox[] txbArray = { txbName, txbWriterName, txbPublisher, txbPublicationYear, txbTotalNumber };
            bool      a        = MyFunctions.isTextBoxEmpty(txbArray);

            if (!a)
            {
                return;
            }
            bool b = MyFunctions.isTextBoxInt("Please Enter only integeral valuse in publication year and number", txbPublicationYear, txbTotalNumber);

            if (!b)
            {
                return;
            }
            bool c = MyFunctions.checkTextBoxLenght(4, txbPublicationYear);

            if (!c)
            {
                return;
            }

            bool d = MyFunctions.checkDatePickerValidation(dpRegistrationDate);

            if (!d)
            {
                return;
            }

            Book temp = new Book();

            temp.Name            = txbName.Text;
            temp.Id              = txbId.Text;
            temp.Writer          = txbWriterName.Text;
            temp.Publisher       = txbPublisher.Text;
            temp.PublicationYear = Convert.ToInt32(txbPublicationYear.Text);
            temp.TotalNumber     = Convert.ToInt32(txbTotalNumber.Text);
            temp.Registration    = (DateTime)dpRegistrationDate.SelectedDate;
            BookList[temp.Id]    = temp;
            MessageBox.Show("Book successfully Edied.");
            txbName.Clear(); txbId.Clear(); txbWriterName.Clear(); txbPublisher.Clear();
            txbPublicationYear.Clear(); txbTotalNumber.Clear(); dpRegistrationDate.Text = "";
            btnOk.IsEnabled              = true;
            btnEdit.IsEnabled            = false;
            txbId.IsEnabled              = true;
            txbName.IsEnabled            = false; txbWriterName.IsEnabled = false;
            txbPublisher.IsEnabled       = false; txbPublicationYear.IsEnabled = false; txbTotalNumber.IsEnabled = false;
            dpRegistrationDate.IsEnabled = false;
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            TextBox[] txbArray = { txbFirstName, txbLastName, txbNationalCode };
            bool      a        = MyFunctions.isTextBoxEmpty(txbArray);

            if (!a)
            {
                return;
            }

            bool b = MyFunctions.checkDatePickerValidation(dpRegistrationDate);

            if (!b)
            {
                return;
            }

            bool c = MyFunctions.checkTextBoxLenght(10, txbNationalCode);

            if (!c)
            {
                return;
            }

            bool d = MyFunctions.isTextBoxInt("Enter only integeral values in National Code.", txbNationalCode);

            if (!d)
            {
                return;
            }

            Member temp = new Member();

            temp.FirstName         = txbFirstName.Text;
            temp.LastName          = txbLastName.Text;
            temp.NationalCode      = txbNationalCode.Text;
            temp.Id                = txbId.Text;
            temp.RegisteryDate     = (DateTime)dpRegistrationDate.SelectedDate;
            MemberList[txbId.Text] = temp;
            MessageBox.Show("Member successfully edited.");
            txbFirstName.Clear(); txbId.Clear(); txbLastName.Clear(); txbNationalCode.Clear();
            dpRegistrationDate.Text   = "";
            btnOk.IsEnabled           = true;
            btnEdit.IsEnabled         = false;
            txbId.IsEnabled           = true;
            txbLastName.IsEnabled     = false; txbFirstName.IsEnabled = false;
            txbNationalCode.IsEnabled = false; dpRegistrationDate.IsEnabled = false;
        }