private void btnAdcontact_Click(object sender, EventArgs e) { Boolean create = true; ContactModel contact = null; ContactcreateFormView contactView = new ContactcreateFormView(loggedInUser, create, contact); this.Hide(); contactView.ShowDialog(); this.Close(); }
private void button_action_edit(object sender, EventArgs e) { if (sender is Button) { Button temp = (Button)sender; // FlowLayoutPanel flowLayout = (FlowLayoutPanel)temp.Parent; TableLayoutPanel tableLayoutPanel = (TableLayoutPanel)temp.Parent; // MessageBox.Show(sender.ToString()); TableLayoutPanel tableLayoutPanel1 = (TableLayoutPanel)tableLayoutPanel.Parent; ContactDisplayController contactDisplayController = (ContactDisplayController)tableLayoutPanel1.Parent; string name = contactDisplayController.name; string email = contactDisplayController.email; // Int32 contactNumber = Convert.ToInt32(m.ContactNumber); string mobileNo = contactDisplayController.mobileNo; string id = contactDisplayController.id; int userId = loggedInUser.Id; //MessageBox.Show(name + email + mobileNo); if (MessageBox.Show("Do you wish to edit Contact " + name, "Edit 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; contact.ContactId = Convert.ToInt32(id); Boolean create = false; ContactcreateFormView contactView = new ContactcreateFormView(loggedInUser, create, contact); this.Hide(); contactView.ShowDialog(); this.Close(); } } }