示例#1
0
        private void AddItemProdutosNFCe(int CUPOMELETRONICOID)
        {
            LIS_PRODUTONFCECollection LIS_PRODUTONFCEColl_iTEM = new LIS_PRODUTONFCECollection();

            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("CUPOMELETRONICOID", "System.Int32", "=", CUPOMELETRONICOID.ToString()));
            LIS_PRODUTONFCEColl_iTEM = LIS_PRODUTONFCEP.ReadCollectionByParameter(RowRelatorio, "PRODUTONFCEID");

            PRODUTONFCEProvider PRODUTONFCEP = new PRODUTONFCEProvider();
            int itemProduto = 1;

            foreach (LIS_PRODUTONFCEEntity item in LIS_PRODUTONFCEColl_iTEM)
            {
                PRODUTONFCEEntity PRODUTONFCETy = new PRODUTONFCEEntity();
                PRODUTONFCETy      = PRODUTONFCEP.Read(Convert.ToInt32(item.PRODUTONFCEID));
                PRODUTONFCETy.ITEM = itemProduto;
                PRODUTONFCEP.Save(PRODUTONFCETy);
                itemProduto++;
            }
        }
示例#2
0
        private void dtgItensCupom_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowindex = e.RowIndex;

            if (LIS_PRODUTONFCEColl.Count > 0 && rowindex > -1)
            {
                int ColumnSelecionada = e.ColumnIndex;
                int CodSelect         = -1;

                if (ColumnSelecionada == 0)//Editar
                {
                    try
                    {
                        if (LIS_PRODUTONFCEColl[rowindex].IDSTATUSNFCE == 4) // Aberto
                        {
                            CodSelect               = Convert.ToInt32(LIS_PRODUTONFCEColl[rowindex].PRODUTONFCEID);
                            PRODUTONFCETy           = PRODUTONFCEP.Read(CodSelect);
                            txtQuant.Text           = Convert.ToDecimal(PRODUTONFCETy.QUANTIDADE).ToString("n2");
                            cbProduto.SelectedValue = PRODUTONFCETy.IDPRODUTO;
                            txtvalorunit.Text       = Convert.ToDecimal(PRODUTONFCETy.VALORUNITARIO).ToString("n2");
                            txtVlTotal.Text         = Convert.ToDecimal(PRODUTONFCETy.VALORTOTAL).ToString("n2");
                        }
                        else
                        {
                            MessageBox.Show("Cupom Já Emitido, Não é Possível Alterar!");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro técnico: " + ex.Message);
                    }
                }
                else if (ColumnSelecionada == 1)                         //Excluir
                {
                    if (LIS_PRODUTONFCEColl[rowindex].IDSTATUSNFCE == 4) // Aberto
                    {
                        DialogResult dr = MessageBox.Show(ConfigMessage.Default.MsgDelete,
                                                          ConfigSistema1.Default.NameSytem, MessageBoxButtons.YesNo);

                        if (dr == DialogResult.Yes)
                        {
                            try
                            {
                                CodSelect = Convert.ToInt32(LIS_PRODUTONFCEColl[rowindex].PRODUTONFCEID);
                                PRODUTONFCEP.Delete(CodSelect);
                                ExibirDadosCupom(CUPOMELETRONICOID);
                                MessageBox.Show(ConfigMessage.Default.MsgDelete2);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ConfigMessage.Default.MsgDeleteErro);
                                MessageBox.Show("Erro técnico: " + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Cupom Já Emitido, Não é Possível Excluir!");
                    }
                }
            }
        }