Esempio n. 1
0
        private void dgProdutos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var row   = senderGrid.Rows[e.RowIndex];
                var sku   = row.Cells[1].Value.ToString();
                var valor = row.Cells[5].Value.ToString();
                if (partnerId == 1)
                {
                    var frm = new FrmRixty(sku);
                    frm.ShowDialog();
                }
                else if (partnerId == 3)
                {
                    var frm = new FrmEPay(new EpayProductPurchase
                    {
                        SKU   = sku,
                        Preco = valor,
                        //Amount = Convert.ToInt32(Convert.ToDecimal(valor) * 100)
                    });
                    frm.ShowDialog();
                }
            }
        }
Esempio n. 2
0
        private void dgProdutos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var row = senderGrid.Rows[e.RowIndex];
                if (row.Cells[4].Value.ToString().Equals("Desabilitado"))
                {
                    MessageBox.Show("Este produto está desabilitado!", "Atenção");
                    return;
                }
                var preco   = Convert.ToDecimal(row.Cells[6].Value) == 0 ?"0.00" : (Convert.ToDecimal(row.Cells[6].Value) / 100).ToString("#.##");
                var details = new EpayProductPurchase
                {
                    Nome     = row.Cells[0].Value.ToString(),
                    Provider = row.Cells[1].Value.ToString(),
                    SKU      = row.Cells[2].Value.ToString(),
                    EAN      = row.Cells[3].Value.ToString(),
                    Preco    = preco,
                    Enabled  = row.Cells[5].Value.ToString(),
                    Amount   = Convert.ToInt32(row.Cells[6].Value.ToString()),
                };
                var frm = new FrmEPay(details);
                frm.ShowDialog();
            }
        }