コード例 #1
0
        private async void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                NetSalesManager netSalesManager = new NetSalesManager();
                int             indexColumn     = dataView.Columns.Count;
                if (await netSalesManager.connect(Settings.Default["user"].ToString(), Settings.Default["password"].ToString()))
                {
                    int index = int.Parse(colun_index.Value.ToString());
                    for (int i = 0; i < dataView.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            dataView[0, i].Value = "STATUS_NETSALES";
                            continue;
                        }
                        string contrato = dataView.Rows[i].Cells[index + 1].Value.ToString();
                        string status   = await netSalesManager.consultaContrato(contrato);

                        dataView[0, i].Value = status;
                    }
                    btnExport.Visible = true;
                }
                else
                {
                    MessageBox.Show("Ocorreu um erro no login, Por favor tente novamente!", "GSales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
コード例 #2
0
ファイル: Dashboard.cs プロジェクト: jpaulolxm/GsalesPro
        private async void importarToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                WaitExcel waitExcel = new WaitExcel();

                if (!string.IsNullOrWhiteSpace(Settings.Default["user"].ToString()) && !string.IsNullOrWhiteSpace(Settings.Default["password"].ToString()))
                {
                    OpenFileDialog openFileDialog = new OpenFileDialog();
                    openFileDialog.Multiselect = false;
                    openFileDialog.Filter      = "Excel (*.xls)|*.xls";
                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        Importar importar = new Importar();
                        var      clientes = await importar.readExcel(openFileDialog.FileName);

                        if (clientes != null)
                        {
                            painel_central.Controls.Clear();
                            waitExcel.loading = true;
                            waitExcel.status  = true;
                            waitExcel.Dock    = DockStyle.Fill;
                            painel_central.Controls.Add(waitExcel);

                            NetSalesManager netSalesManager = new NetSalesManager();

                            if (await netSalesManager.connect(Settings.Default["user"].ToString(), Settings.Default["password"].ToString()))
                            {
                                waitExcel.clientesExport = await netSalesManager.foraFieldNgestor(clientes);

                                waitExcel.loading   = false;
                                waitExcel.status    = false;
                                waitExcel.btnExport = true;
                            }
                            else
                            {
                                MessageBox.Show("Ocorreu um erro no login, Por favor tente novamente!", "GSales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                waitExcel.loading   = false;
                                waitExcel.status    = false;
                                waitExcel.btnExport = false;
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("É necessário cadastrar um usuário e senha.", "Gsales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    waitExcel.loading   = false;
                    waitExcel.status    = false;
                    waitExcel.btnExport = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
コード例 #3
0
        private async void btn_pesquisar_Click(object sender, EventArgs e)
        {
            NetSalesManager netSalesManager = new NetSalesManager();

            btn_pesquisar.Enabled = false;
            textBox1.Enabled      = false;
            lbl_wait.Visible      = true;
            if (await netSalesManager.connect(Settings.Default["user"].ToString(), Settings.Default["password"].ToString()))
            {
                ConsultaContrato consultaContrato = new ConsultaContrato();
                result = await consultaContrato.pesquisaPorCpfOrCnpj(textBox1.Text);

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
        }
コード例 #4
0
        private async void btn_verificar_Click(object sender, EventArgs e)
        {
            try
            {
                pictureBox1.Visible = true;
                lbl_status.Visible  = true;
                btn_export.Visible  = false;

                btn_verificar.Enabled = false;
                var             listContratos   = contratos();
                NetSalesManager netSalesManager = new NetSalesManager();
                if (await netSalesManager.connect(Settings.Default["user"].ToString(), Settings.Default["password"].ToString()))
                {
                    clienteForaFields = await netSalesManager.foraField(listContratos);

                    ContratosNaoEncontrados = netSalesManager.ContratosNaoEncontrados;

                    if (ContratosNaoEncontrados.Count > 0)
                    {
                        button1.Visible = true;
                    }

                    btn_verificar.Enabled = true;

                    pictureBox1.Visible = false;
                    lbl_status.Visible  = false;
                    btn_export.Visible  = true;
                }
                else
                {
                    MessageBox.Show("Ocorreu um erro no login, Por favor tente novamente!", "GSales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    btn_verificar.Enabled = true;
                    pictureBox1.Visible   = false;
                    lbl_status.Visible    = false;
                    btn_export.Visible    = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }