Example #1
0
        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");
            }
        }
Example #2
0
        private void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = ((DataGridView)sender).Columns[e.ColumnIndex].Name;

            switch (colName)
            {
            case "Order":
                string   oNumber = ((DataGridView)sender).Rows[e.RowIndex].Cells[0].Value.ToString();
                frmOrder Order   = new frmOrder(int.Parse(oNumber), this);
                Order.Show(this);
                break;

            case "ZPKG":
            case "ZPKGName":
                string comNumber = ((DataGridView)sender).Rows[e.RowIndex].Cells[1].Value.ToString();
                bool   isInt     = int.TryParse(comNumber, out int com);
                if (isInt)
                {
                    frmZfinOverview FrmZfinOverview = new frmZfinOverview(com, this);
                    FrmZfinOverview.Show(this);
                }
                else
                {
                    string[]        ops     = Regex.Split(comNumber, Environment.NewLine);
                    List <string>   Options = new List <string>(ops);
                    frmOptionPicker op      = new frmOptionPicker("Wybierz który element chcesz otworzyć:", "Wiele elementów", Options, this);
                    var             res     = op.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        isInt = int.TryParse(op.ReturnValue, out com);
                        if (isInt)
                        {
                            frmZfinOverview FrmZfinOverview = new frmZfinOverview(com, this);
                            FrmZfinOverview.Show(this);
                        }
                        else
                        {
                            MessageBox.Show("Niezidentyfikowany błąd");
                        }
                    }
                }

                break;

            case "ZFIN":
            case "ZFINName":
                string          zNumber            = ((DataGridView)sender).Rows[e.RowIndex].Cells[3].Value.ToString();
                frmZfinOverview FrmProductOverview = new frmZfinOverview(int.Parse(zNumber), this);
                FrmProductOverview.Show(this);
                break;
            }
        }