private void action(int rowIndex) { int i = rowIndex; string type = dgItems.Rows[i].Cells[2].Value.ToString(); if (string.Equals(type, "zfin", StringComparison.OrdinalIgnoreCase) || string.Equals(type, "zfor", StringComparison.OrdinalIgnoreCase) || string.Equals(type, "zcom", StringComparison.OrdinalIgnoreCase) || string.Equals(type, "zpkg", StringComparison.OrdinalIgnoreCase)) { int zfinIndex = Convert.ToInt32(dgItems.Rows[i].Cells[1].Value); frmZfinOverview zo = new frmZfinOverview(zfinIndex, this); zo.Show(); } else if (string.Equals(type, "Kontakt", StringComparison.OrdinalIgnoreCase)) { int contactId = Convert.ToInt32(dgItems.Rows[i].Cells[1].Value); frmContact co = new frmContact(contactId, this); co.Show(); } else if (string.Equals(type, "Sold-to", StringComparison.OrdinalIgnoreCase) || string.Equals(type, "Ship-to", StringComparison.OrdinalIgnoreCase) || string.Equals(type, "Carrier", StringComparison.OrdinalIgnoreCase)) { int companyId = Convert.ToInt32(dgItems.Rows[i].Cells[1].Value); frmCompany cp = new frmCompany(companyId, this); cp.Show(); } else { MessageBox.Show("Funkcja nie jest jeszcze dostępna"); } }
private void loadContact(object sender, EventArgs e) { int i = dgvConctacts.CurrentCell.RowIndex; int contactId = Convert.ToInt32(dgvConctacts.Rows[i].Cells[0].Value); frmContact contact = new frmContact(contactId, this); contact.Show(); }