Beispiel #1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            this.isCanceled = false;

            //fechada a tela de paramentros
            //agora chame a barra de progresso
            XFrmWait.ShowSplashScreen("Gerando relatório...");

            _newParametros.Clear();

            for (int i = 0; i < _parameterCollection.Count; i++)
            {
                #region processo
                Parameter parameter = new Parameter();
                parameter.Name = (string)gridParametros[0, i].Value;

                // Specify other parameter properties.
                parameter.Type = _parameterCollection[i].Type;

                parameter.Value = Convert.ChangeType(gridParametros[2, i].EditedFormattedValue,
                                                     parameter.Type, System.Globalization.CultureInfo.GetCultureInfo("pt-BR"));
                parameter.Description = (string)gridParametros[1, i].Value;
                parameter.Visible     = true;

                _newParametros.Add(parameter);

                #endregion
            }


            XFrmWait.CloseSplashScreen();
            this.Close();
        }
Beispiel #2
0
        private async void validaCep()
        {
            SplashScreenManager.ShowForm(typeof(XFrmWait));

            XFrmWait.ShowSplashScreen("Procurando CEP");

            string cep = txtCep.Text;

            FindCepIts find = new FindCepIts();

            var result = await find.FindAdress(txtCep.Text);

            if (result)
            {
                txtCidade.Enabled  = false;
                txtUf.Enabled      = false;
                lblFlagCep.Visible = true;
            }
            else
            {
                txtCidade.Enabled  = true;
                txtUf.Enabled      = true;
                lblFlagCep.Visible = false;
            }

            txtCep.Text        = find.Cep;
            txtCidade.Text     = find.Cidade;
            txtUf.Text         = find.UF;
            txtBairro.Text     = find.Bairro;
            txtLogradouro.Text = find.Endereco;

            SplashScreenManager.CloseForm();
        }
        private void wizardPage1_PageCommit(object sender, EventArgs e)
        {
            XFrmWait.ShowSplashScreen("Gerando lançamentos");
            this.completionWizardPage1.AllowFinish = false;

            var manager = new LancamentoDaoManager();

            this._lancamentoList.ForEach(delegate(LancamentoFinanceiro lan)
            {
                try
                {
                    if (_action == FormTypeAction.Salvar)
                    {
                        manager.SaveLancamento(lan);
                    }
                    else
                    {
                        manager.Reparcelar(_lancamentoAtual, lan);
                    }
                }
                catch (Exception ex)
                {
                    XMessageIts.Erro("Falha no parcelamento !\nVerifique a pasta de logs ou contate o administrador", "Operação cancelada");
                    LoggerUtilIts.GenerateLogs(ex);
                    this.Dispose();
                    return;
                }
            });
            this.completionWizardPage1.AllowFinish = true;
            XFrmWait.CloseSplashScreen();
        }
Beispiel #4
0
        public override async void PreVisualizarValidar()
        {
            if (!string.IsNullOrEmpty(txtExcelFile.Text))
            {
                try
                {
                    var m = new ModelProducaoSerra(gridViewBase, _user);
                    XFrmWait.ShowSplashScreen("Preparando Dados");

                    var r = await Task.Run(() => m.LoadProducaoNew());

                    if (r)
                    {
                        base.ShowResult(m.Result);
                        this.IsValido             = true;
                        this.barBtnSalvar.Enabled = true;
                    }
                    else
                    {
                        XMessageIts.Advertencia("Validação com erros.");
                        base.ShowErrors(m.Errors);
                        this.barBtnSalvar.Enabled = false;
                    }
                    Console.WriteLine(r);
                    XFrmWait.CloseSplashScreen();
                }
                catch (Exception ex)
                {
                    LoggerUtilIts.ShowExceptionLogs(ex);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Gera o relatório passando os parametros pelo metodo, sem necessidade de exibir a tela.
        /// </summary>
        /// <param name="parameterCollection"></param>
        /// <param name="parameters"></param>
        public void GerarRelatorio(ParameterCollection parameterCollection, params object[] parameters)
        {
            this._isCanceled = false;
            XFrmWait.ShowSplashScreen("Gerando relatório ");

            //fechada a tela de paramentros
            //agora chame a barra de progresso
            SplashScreenManager.ShowForm(typeof(XFrmWait));

            NewParametros.Clear();
            int i = 0;

            foreach (var p in parameterCollection)
            {
                Parameter parameter = new Parameter();
                parameter.Name = p.Name; // gridViewParams.GetRowCellValue(i, "Name").ToString();

                // Specify other parameter properties.
                parameter.Type = p.Type; // parameterCollection[i].Type;
                //Convert.ChangeType(gridParametros[2, i].EditedFormattedValue,
                //parameter.Type, System.Globalization.CultureInfo.GetCultureInfo("pt-BR"));
                parameter.Description = p.Description;
                //(string)gridParametros[1, i].Value;
                parameter.Visible = true;

                #region processo
                parameter.Value = parameters[i];
                NewParametros.Add(parameter);
                #endregion
                i++;
            }


            SplashScreenManager.CloseForm();
        }
Beispiel #6
0
        private async void wizardPage1_PageCommit(object sender, EventArgs e)
        {
            Task <bool> taskBaixa = Task.Run(() => startBaixa());

            this.completionWizardPage1.AllowFinish = false;


            //mostra a barrinha ae jovem
            XFrmWait.ShowSplashScreen("Baixando lançamentos");

            //tenta baixar
            this.IsBaixa = await taskBaixa;

            //se deu errado
            if (!IsBaixa)
            {
                //cancele o evento
                completionWizardPage1.FinishText = "Falha ao realizar a baixado dos lançamento(s).";
            }

            //deixa encerrar
            this.completionWizardPage1.AllowFinish = true;

            //fecha a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #7
0
        /// <summary>
        /// Carrega todos os dados no grid control assincrono, com ordenação OrderByDescending
        /// </summary>
        /// <param name="form"></param>
        /// <param name="gridControl"></param>
        /// <returns></returns>
        public async Task FillGridControlAsync(Form form, GridControl gridControl, String fieldOrdenacao)
        {
            XFrmWait.ShowSplashScreen();
            var source = await this.FindAllAsync();

            //pegue o tipo do primeiro item da source
            Type t = source.Count > 0 ? source[0].GetType() : null;

            if (source.Count > 0)
            {
                //http://stackoverflow.com/questions/188141/list-orderby-alphabetical-order
                gridControl.DataSource = source.OrderByDescending(r => t.InvokeMember(fieldOrdenacao,
                                                                                      System.Reflection.BindingFlags.GetProperty,
                                                                                      null,
                                                                                      r,
                                                                                      null));
            }
            else
            {
                gridControl.DataSource = source;
            }

            //termina a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #8
0
        /// <summary>
        /// Preenche o grid de maneira assincrona e exibe uma barra de progresso durante o processo.
        /// Esse metódo deve ser chamad com o tratamento abaixo:
        /// if (this.gridLookUp.InvokeRequired)
        /// {
        ///     this.Invoke(new MethodInvoker(delegate{
        ///         Context.Entidade.FillGridLookup(gridControl, taskName);
        ///      }));
        /// }
        /// É necessário disparar uma thread que estará em primeiro plano
        ///  new Thread(Tarefa).Start();
        /// </summary>
        /// <param name="comboBox"></param>GridLookUp
        /// <param name="taskName"></param>Nome da tarefa
        public async void FillGridlLookUp(GridLookUpEdit gridLookUp, string taskName = null)
        {
            XFrmWait.ShowSplashScreen(taskName);

            var lista = await FindAllAsync();

            gridLookUp.Properties.DataSource = lista;

            //termina a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #9
0
        /// <summary>
        /// Preenche o grid de maneira assincrona e exibe uma barra de progresso durante o processo.
        /// Esse metódo deve ser chamad com o tratamento abaixo:
        /// if (this.gridControl.InvokeRequired)
        /// {
        ///     this.Invoke(new MethodInvoker(delegate{
        ///         Context.Entidade.FillGridControl(gridControl, taskName);
        ///      }));
        /// }
        /// É necessário disparar uma thread que estará em primeiro plano
        ///  new Thread(Tarefa).Start();
        /// </summary>
        /// <param name="gridControl"></param>
        /// <param name="taskName"></param>
        public async void FillGridControl(GridControl gridControl, string taskName = null)
        {
            //inicia a barra
            XFrmWait.ShowSplashScreen(taskName);
            var lista = await FindAllAsync();

            gridControl.DataSource = lista;

            //termina a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #10
0
        private void barBtnSalvarCotacao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            XFrmWait.ShowSplashScreen("Salvando moedas");
            var cotacoes = gridView1.GetItens <CotacaoMonetaria>();

            var manager = new MoedaDaoManager();

            foreach (var c in cotacoes)
            {
                manager.SaveCotacaoMonetaria(c);
            }
            XFrmWait.CloseSplashScreen();
        }
Beispiel #11
0
        /// <summary>
        /// Preenche o grid de maneira assincrona e exibe uma barra de progresso durante o processo.
        /// Esse metódo deve ser chamad com o tratamento abaixo:
        /// if (this.comboBox.InvokeRequired)
        /// {
        ///     this.Invoke(new MethodInvoker(delegate{
        ///         Context.Entidade.FillGridControl(gridControl, taskName);
        ///      }));
        /// }
        /// É necessário disparar uma thread que estará em primeiro plano
        ///  new Thread(Tarefa).Start();
        /// </summary>
        /// </summary>
        /// <param name="comboBox"></param>ComboBox
        /// <param name="taskName"></param>Nome da tarefa
        public async void FillComboBoxEdit(ComboBoxEdit comboBox, string taskName = null)
        {
            XFrmWait.ShowSplashScreen(taskName);

            var lista = await FindAllAsync();

            comboBox.Properties.Items.Clear();
            comboBox.SelectedItem = null;
            comboBox.Properties.Items.AddRange(lista);

            if (lista.Count > 0)
            {
                comboBox.SelectedItem = lista[0];
            }
            //termina a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #12
0
        /// <summary>
        /// Exibe o relatório informado.
        /// </summary>
        /// <param name="xreport"></param>
        /// <param name="ribbon"></param>
        public static void ShowPreviewReport(XtraReport xreport, bool ribbon = false)
        {
            //call progressbar
            XFrmWait.ShowSplashScreen("Gerando relatório...");

            //chama a tela de parametros
            xreport.CreateDocument();

            //close a progressbar
            XFrmWait.CloseSplashScreen();

            if (ribbon)
            {
                xreport.ShowRibbonPreview();
            }

            xreport.ShowPreview();
        }
Beispiel #13
0
        public override async void Salvar()
        {
            if (this._type == TypeImport.Material)
            {
                var m = new ModelMaterialSerra(gridViewBase);
                var r = await XFrmWait.StartTask <bool>(Task.Run(() => m.CreateBaseProduto()), "Gerando base");

                if (r)
                {
                    base.ShowResult(m.Result, m.Errors);
                }
            }
            else
            {
                if (this.barBtnSalvar.Enabled)
                {
                    var m = new ModelProducaoSerra(gridViewResult, _user);

                    XFrmWait.ShowSplashScreen("Importando Produção");
                    var r = await Task.Factory.StartNew(() => m.SalvaProducao());

                    //var r = await XFrmWait.StartTask<bool>(Task.Run(() => m.SalvaProducao()), "Salvando Produção");

                    if (r)
                    {
                        XMessageIts.Mensagem("Produção importada com sucesso.");
                    }
                    else
                    {
                        XMessageIts.Erro("Ocorreram erros durante a importação!");
                    }

                    base.ShowResult(m.Result, m.Errors);

                    XFrmWait.CloseSplashScreen();
                    this.barBtnSalvar.Enabled = false;
                }
                else
                {
                    XMessageIts.Mensagem("Realize a validação antes de salvar!");
                }
            }
        }
        private void wizardPage1_PageCommit(object sender, EventArgs e)
        {
            this.completionWizardPage1.AllowFinish = false;
            XFrmWait.ShowSplashScreen("Baixando lançamentos");

            //tenta baixar
            this.IsCompensado = baixar();

            //se deu errado
            if (!IsCompensado)
            {
                //cancele o evento
                completionWizardPage1.FinishText = "Falha ao realizar a baixado dos lançamento(s).";
            }
            else
            {
                this.completionWizardPage1.AllowFinish = true;
            }

            //fecha a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #15
0
        private void wizardPageProdutos_PageCommit(object sender, EventArgs e)
        {
            this.completionWizardPage1.AllowFinish = false;
            XFrmWait.ShowSplashScreen("Criando transferência");

            //tenta baixar
            this.IsSuccess = transfere();

            //se deu errado
            if (!IsSuccess)
            {
                //cancele o evento
                completionWizardPage1.FinishText = "Falha ao realizar a transferência de estoque.";
            }
            else
            {
                this.completionWizardPage1.AllowFinish = true;
            }

            //fecha a barra
            XFrmWait.CloseSplashScreen();
        }
Beispiel #16
0
        private async void validaCep()
        {
            if (chValidacaoOnline.Checked)
            {
                XFrmWait.ShowSplashScreen("Validando CEP...");

                //SplashScreenManager.ShowForm(typeof(XFrmWait));

                FindCepIts find = new FindCepIts();

                var result = await find.FindAdress(txtCep.Text);

                this.lblFlagCep.Visible = true;

                if (result)
                {
                    //atualiza o cep
                    this.txtCep.Text = find.Cep;

                    this.Cep = txtCep.Text;


                    if (!string.IsNullOrEmpty(find.Bairro))
                    {
                        this.txtBairro.Text = find.Bairro;
                    }

                    if (!string.IsNullOrEmpty(find.Endereco))
                    {
                        this.txtEndereco.Text = find.Endereco;
                    }

                    if (!string.IsNullOrEmpty(find.Complemento))
                    {
                        this.txtComplemento.Text = find.Complemento;
                    }

                    if (!string.IsNullOrEmpty(find.Cidade))
                    {
                        this.txtCidade.Text = find.Cidade;
                    }

                    if (!string.IsNullOrEmpty(find.UF))
                    {
                        this.txtUf.Text = find.UF;
                    }


                    if (!string.IsNullOrEmpty(find.Cidade))
                    {
                        this.comboCidade.Properties.Items.Clear();
                        this.comboCidade.Properties.Items.Add(find.Cidade);
                        this.comboCidade.SelectedIndex = 0;
                    }

                    if (!string.IsNullOrEmpty(find.UF))
                    {
                        this.comboUf.Properties.Items.Clear();
                        this.comboUf.Properties.Items.Add(find.UF);
                        this.comboUf.SelectedIndex = 0;
                    }

                    //Flag ok
                    this.lblFlagCep.Appearance.Image = Properties.Resources.apply_16x16;
                }
                else
                {
                    //Flag nao encontrado
                    this.lblFlagCep.Appearance.Image = Properties.Resources.cancel_16x16;
                }

                XFrmWait.CloseSplashScreen();
                //SplashScreenManager.CloseForm();
            }
        }