private void button_action(object sender, EventArgs e)
        {
            if (sender is Button)
            {
                Button temp = (Button)sender;
                // FlowLayoutPanel flowLayout = (FlowLayoutPanel)temp.Parent;
                ContactFormController contactFormController = (ContactFormController)temp.Parent;
                //   MessageBox.Show(sender.ToString());
                String name  = contactFormController.name;
                String email = contactFormController.email;
                // Int32 contactNumber = Convert.ToInt32(m.ContactNumber);
                String mobileNo = contactFormController.mobileNo;

                int userId = loggedInUser.Id;

                // MessageBox.Show("Do you wish to add this Contact");


                if (name != "" && email != "")

                {
                    if (MessageBox.Show("Do you wish to Add this Contact ", "Add Contact",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                        MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                    {
                        ContactModel contact = new ContactModel();
                        contact.ContactName = name;
                        contact.MobileNo    = mobileNo;
                        contact.Email       = email;
                        contact.UserId      = userId;


                        ContactModelManager contactModelManager = new ContactModelManager();
                        Boolean             status = contactModelManager.addContact(contact);

                        if (status)
                        {
                            MessageBox.Show("Successfully Added Cotact to Database");
                            contactFormController.Hide();
                        }
                        else
                        {
                            MessageBox.Show("DataBase Error");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Name And Email Cannot be Empty");
                }
            }
        }
        private void btnAdcontact_Click(object sender, EventArgs e)
        {
            int quantity = Convert.ToInt32(this.selectNumber.Value);

            for (int i = 0; i < quantity; i++)
            {
                ContactFormController cfc = new ContactFormController();
                // uc.Size = new Size(100, 20);
                cfc.Location = new Point(200, 200 + (i * 20));
                cfc.btnCreateContact.Click += button_action;
                this.flowLayoutPanel1.Controls.Add(cfc);
            }
        }
        //view edit functionality
        private void viewEditForm(ContactModel contact)
        {
            ContactFormController cfc = new ContactFormController();

            // uc.Size = new Size(100, 20);
            //new function



            cfc.mobilenumbertxt.Text = contact.MobileNo;
            cfc.contactNametxt.Text  = contact.ContactName;
            cfc.emailtxt.Text        = contact.Email;


            cfc.btnCreateContact.Click += button_action_edit;
            this.flowLayoutPanel1.Controls.Add(cfc);
        }