private void buttonsave_Click(object sender, EventArgs e) { CustomerDataLogic customerDataLogic = new CustomerDataLogic(); customerName = textBoxcustomername.Text.Trim(); phoneno = textBoxphonenumber.Text.Trim(); fax = textBoxfax.Text.Trim(); email = textBoxemail.Text.Trim(); address = textBoxaddress.Text.Trim(); string dropdownvalue = comboBoxIsactive.SelectedValue.ToString(); isActive = dropdownvalue == "0" ? false : true; adminname = textBoxcontactpersonnameadmin.Text.Trim(); adminemail = textBoxcontactpersonemailadmin.Text.Trim(); adminphone = textBoxcontactpersonphoneadmin.Text.Trim(); adminmobile = textBoxcontactpersonmobileadmin.Text.Trim(); ITname = textBoxcontactpersonnameit.Text.Trim(); ITmobile = textBoxcontactpersonmobileit.Text.Trim(); ITemail = textBoxcontactpersonemailit.Text.Trim(); ITphone = textBoxcontactpersonphoneit.Text.Trim(); bool result = customerDataLogic.AddCustomer(customerName, phoneno, fax, email, address, isActive, adminname, adminemail, adminphone, adminmobile, ITname, ITmobile, ITemail, ITphone, isSystemGenerated); if (result == true) { MessageBox.Show("Success!"); CustomerListForm customerListForm = new CustomerListForm(); this.Hide(); customerListForm.Show(); } else { MessageBox.Show("Error!"); } }
private void dataGridViewCustomerList_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int rowIndex = e.RowIndex; int customerId = int.Parse(dataGridViewCustomerList.Rows[rowIndex].Cells[0].Value.ToString()); CustomerDataLogic customerDataLogic = new CustomerDataLogic(); bool result = customerDataLogic.GetCustomerInfo(customerId, out customerName, out phoneno, out fax, out email, out address, out isActive, out adminname, out adminemail, out adminphone, out adminmobile, out ITname, out ITmobile, out ITemail, out ITphone, out isSystemGenerated); if (result == true) { Customeraddform customerAddForm = new Customeraddform() { MdiParent = this.Parent.FindForm() }; customerAddForm.customerName = customerName; customerAddForm.phoneno = phoneno; customerAddForm.fax = fax; customerAddForm.email = email; customerAddForm.address = address; customerAddForm.isActive = isActive; customerAddForm.adminname = adminname; customerAddForm.adminemail = adminemail; customerAddForm.adminphone = adminphone; customerAddForm.adminmobile = adminmobile; customerAddForm.ITname = ITname; customerAddForm.ITmobile = ITmobile; customerAddForm.ITemail = ITemail; customerAddForm.ITphone = ITphone; customerAddForm.isSystemGenerated = isSystemGenerated; customerAddForm.customerId = customerId; this.Hide(); customerAddForm.Show(); } else { MessageBox.Show("No Valid Information Found!", "Error!"); } }