Beispiel #1
0
 private void prvGetEstoqueProdutos()
 {
     dados                   = new DataTable();
     syncProduto             = new SyncProduto();
     dados                   = syncProduto.puvAtualizarEstoque();
     dtgResultado.DataSource = dados;
     lblTtlRegs.Text         = "Total de registros: " + dados.Rows.Count;
     pgbProgresso.Visible    = true;
     lblProduto.Visible      = true;
     pgbProgresso.Maximum    = dtgResultado.Rows.Count;
     for (int i = 1; i <= dtgResultado.Rows.Count; i++)
     {
         lblProduto.Text = "IDPRO: " + Convert.ToInt32(dtgResultado.Rows[i - 1].Cells["IDPRO"].Value) +
                           ", PRODUTO: " + (dtgResultado.Rows[i - 1].Cells["PRODUTO"].Value) +
                           ", " + PrimaveraSync.Properties.Settings.Default.spotTabPrice + ": " + Convert.ToDouble(dtgResultado.Rows[i - 1].Cells[PrimaveraSync.Properties.Settings.Default.spotTabPrice].Value) +
                           ", STOK_OFF: " + Convert.ToInt32(dtgResultado.Rows[i - 1].Cells["STOK_OFF"].Value);
         syncProduto.conectaWebService(Convert.ToInt32(dtgResultado.Rows[i - 1].Cells["IDPRO"].Value), Convert.ToInt32(dtgResultado.Rows[i - 1].Cells["STOK_OFF"].Value), "estoque");
         syncProduto.conectaWebService(Convert.ToInt32(dtgResultado.Rows[i - 1].Cells["IDPRO"].Value), Convert.ToDouble(dtgResultado.Rows[i - 1].Cells[PrimaveraSync.Properties.Settings.Default.spotTabPrice].Value), "preco");
         pgbProgresso.Value = i;
         lblTtlRegs.Text    = i.ToString();
     }
 }
Beispiel #2
0
        private void prvGetProdutos()
        {
            string syncAtacado, syncAvista, syncPromocao;

            syncAtacado  = Properties.Settings.Default.syncTabWholesale;
            syncAvista   = Properties.Settings.Default.syncTabSpot;
            syncPromocao = Properties.Settings.Default.syncTabPromo;

            dados       = new DataTable();
            syncProduto = new SyncProduto();
            List <Produto> listaProdutos = new List <Produto>();

            if (txtCpro.TextLength > 0)
            {
                listaProdutos = syncProduto.puvAtualizarProduto(txtCpro.Text);
            }
            else
            {
                listaProdutos = syncProduto.puvAtualizarProduto("");
            }
            for (int i = 0; i < listaProdutos.Count; i++)
            {
                dadosTab = new DataTable();
                dadosTab = syncProduto.pdtSincronizaTabelas(listaProdutos[i].idext_pro);
                if (dadosTab.Rows.Count > 0)
                {
                    //retorno vem varejo atacado avista promocao
                    if (dadosTab.Rows[0][0].ToString().Length > 0)
                    {
                        listaProdutos[i].retailTabPrice = Convert.ToDouble(dadosTab.Rows[0][0]); //varejo;
                    }
                    else
                    {
                        listaProdutos[i].retailTabPrice = 0;
                    }

                    if (syncAtacado == "S")
                    {
                        if (dadosTab.Rows[0][1].ToString().Length > 0)
                        {
                            listaProdutos[i].wholesaleTabPrice = Convert.ToDouble(dadosTab.Rows[0][1]); //atacado
                        }
                        else
                        {
                            listaProdutos[i].wholesaleTabPrice = 0;
                        }
                    }
                    else
                    {
                        listaProdutos[i].wholesaleTabPrice = 0;
                    }

                    if (syncAvista == "S")
                    {
                        if (dadosTab.Rows[0][2].ToString().Length > 0)
                        {
                            listaProdutos[i].spotTabPrice = Convert.ToDouble(dadosTab.Rows[0][2]); //avista
                        }
                        else
                        {
                            listaProdutos[i].spotTabPrice = 0;
                        }
                    }
                    else
                    {
                        listaProdutos[i].spotTabPrice = 0;
                    }

                    if (syncPromocao == "S")
                    {
                        if (dadosTab.Rows[0][3].ToString().Length > 0)
                        {
                            listaProdutos[i].promoTabPrice = Convert.ToDouble(dadosTab.Rows[0][3]); //promocao;
                        }
                        else
                        {
                            listaProdutos[i].promoTabPrice = 0;
                        }
                    }
                    else
                    {
                        listaProdutos[i].promoTabPrice = 0;
                    }
                }
            }
            dtgResultado.DataSource = listaProdutos;
            lblTtlRegs.Text         = "Total de registros: " + listaProdutos.Count;
            pgbProgresso.Visible    = true;
            lblProduto.Visible      = true;
            pgbProgresso.Maximum    = dtgResultado.Rows.Count;
            for (int i = 1; i <= dtgResultado.Rows.Count; i++)
            {
                lblProduto.Text = "IDPRO: " + Convert.ToInt32(listaProdutos[i - 1].idpro) +
                                  ", PRODUTO: " + (listaProdutos[i - 1].produto) +
                                  ", " + PrimaveraSync.Properties.Settings.Default.spotTabPrice + ": " + Convert.ToDouble(listaProdutos[i - 1].spotTabPrice) +
                                  ", STOK_OFF: " + Convert.ToInt32(listaProdutos[i - 1].stok_off);
                string escreveString = "";
                if (cbxEscreveString.Checked == true)
                {
                    escreveString = "true";
                }
                else
                {
                    escreveString = "false";
                }

                txtResult.Text    += syncProduto.sincronizarProduto(listaProdutos[i - 1], escreveString);
                txtResult.Text    += "\r\n\r\n\r\n";
                pgbProgresso.Value = i;
                lblTtlRegs.Text    = i.ToString();
                Thread.Sleep(10);
            }
        }