Пример #1
0
        public MLL.FormaPagamento ObterPorId(int id)
        {
            FormaPagamentoDAL formaDAL = new FormaPagamentoDAL(db);

            MLL.FormaPagamento forma = formaDAL.obtemPorId(id);

            return(forma);
        }
Пример #2
0
 public InfoFormaPagamento[] Importar(string codigo)
 {
     try
     {
         return(FormaPagamentoDAL.BuscarDados(codigo));
     }
     catch
     {
         return(null);
     }
 }
Пример #3
0
 public void localizar()
 {
     try
     {
         objDAL         = new FormaPagamentoDAL();
         this.fp_codigo = objDAL.localizar(this.fp_codigo);
         objDAL         = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
 public void excluir()
 {
     try
     {
         objDAL = new FormaPagamentoDAL();
         objDAL.excluir(this.fp_codigo);
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
 public void alterar()
 {
     try
     {
         objDAL = new FormaPagamentoDAL();
         objDAL.alterar(this.fp_codigo, this.fp_descricao);
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
 public void inserir()
 {
     try
     {
         objDAL = new FormaPagamentoDAL();
         objDAL.inserir(this.fp_descricao);
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
        public IList <MLL.FormaPagamento> ObterListaFormasPag()
        {
            FormaPagamentoDAL forma = new FormaPagamentoDAL(db);

            IList <MLL.FormaPagamento> lista = forma.Tudo().OrderBy(f => f.Descricao_Forma_Pagamento).ToList();

            foreach (MLL.FormaPagamento formas in lista)
            {
                formas.CodigoCript = CriptografaID(formas.Codigo_Forma_Pagamento);
            }

            return(lista);
        }
Пример #8
0
 public DataTable localizarEmTudo(String descricao)
 {
     try
     {
         DataTable tab;
         objDAL = new FormaPagamentoDAL();
         tab    = objDAL.localizarEmTudo(descricao);
         objDAL = null;
         return(tab);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #9
0
 public DataTable localizarComRetorno(String descricao, String atributo)
 {
     try
     {
         DataTable tab;
         objDAL = new FormaPagamentoDAL();
         tab    = objDAL.localizar(descricao, atributo);
         objDAL = null;
         return(tab);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #10
0
        public JObject EditarFormaPag(MLL.FormaPagamento forma)
        {
            JObject           obj      = new JObject();
            FormaPagamentoDAL formaDAL = new FormaPagamentoDAL(db);

            if (formaDAL.Editar(forma))
            {
                obj.Add(new JProperty("ok", "ok"));
            }
            else
            {
                obj.Add(new JProperty("erro", formaDAL.erro));
            }

            return(obj);
        }
Пример #11
0
        public string ExcluirFormaPag(MLL.FormaPagamento formaPag)
        {
            string            result   = "";
            FormaPagamentoDAL formaDAL = new FormaPagamentoDAL(db);

            if (formaDAL.Remover(formaPag))
            {
                result = "ok";
            }
            else
            {
                result = "erro - " + formaDAL.erro;
            }

            return(result);
        }
Пример #12
0
 public void localizarProxAnterior(String descricao, int codigo)
 {
     try
     {
         DataTable tab = null;
         objDAL = new FormaPagamentoDAL();
         tab    = objDAL.localizarProxAnterior(descricao, codigo);
         if (tab.Rows.Count > 0)
         {
             this.fp_codigo = int.Parse(tab.Rows[0][0].ToString());
         }
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #13
0
 public void localizarLeave(String descricao, String atributo)
 {
     try
     {
         DataTable tab;
         objDAL = new FormaPagamentoDAL();
         tab    = objDAL.localizarLeave(descricao, atributo);
         if (tab.Rows.Count > 0)
         {
             this.fp_codigo    = int.Parse(tab.Rows[0]["fp_codigo"].ToString());
             this.fp_descricao = tab.Rows[0]["fp_descricao"].ToString();
         }
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #14
0
 public void localizarPrimeiroUltimo(String descricao)
 {
     try
     {
         DataTable tab    = null;
         int       codigo = 0;
         objDAL = new FormaPagamentoDAL();
         tab    = objDAL.localizarPrimeiroUltimo(descricao);
         if (tab.Rows.Count > 0)
         {
             int.TryParse(tab.Rows[0][0].ToString(), out codigo);
         }
         this.fp_codigo = codigo;
         objDAL         = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #15
0
        public JObject ObterFormaPag()
        {
            JObject           obj     = new JObject();
            JArray            arr     = new JArray();
            FormaPagamentoDAL formPag = new FormaPagamentoDAL(db);

            List <MLL.FormaPagamento> lista = formPag.Tudo()
                                              .OrderBy(f => f.Descricao_Forma_Pagamento)
                                              .ToList();

            foreach (MLL.FormaPagamento forma in lista)
            {
                arr.Add(new JObject(
                            new JProperty("codigo", forma.Codigo_Forma_Pagamento),
                            new JProperty("texto", forma.Descricao_Forma_Pagamento)
                            ));
            }

            obj.Add(new JProperty("lista", arr));

            return(obj);
        }
        public void PreencheDependencias(DefinicoesClienteSolicitacao d, int codCliente, int codFilial)
        {
            using (var categoriaDAL = new CategoriaClienteDAL())
            {
                Task t1 = Task.Factory.StartNew(() =>
                {

                    var categorias = from c in categoriaDAL.ListarTodos()
                                     select c;

                    d.CategoriasCliente = new List<CategoriaCliente>();
                    foreach (var cat in categorias)
                    {
                        d.CategoriasCliente.Add(cat);
                    }
                    categorias = null;
                });

                Task t2 = Task.Factory.StartNew(() =>
                {
                    var formaPagamentoDAL = new FormaPagamentoDAL();
                    var formasPagamento = from f in formaPagamentoDAL.ListarTodos()
                                          select f;

                    d.FormasPagamento = new List<FormaPagamento>();

                    foreach (var forma in formasPagamento)
                    {
                        d.FormasPagamento.Add(forma);
                    }

                    formasPagamento = null;
                });

                Task t3 = Task.Factory.StartNew(() =>
                {
                    var grupoContasAReceberDAL = new GrupoContasAReceberDAL();

                    var grupoContasReceber = from ct in grupoContasAReceberDAL.ListarTodos()
                                             select ct;

                    d.GruposContasReceber = new List<GrupoContasAReceber>();

                    foreach (var grupo in grupoContasReceber)
                    {
                        d.GruposContasReceber.Add(grupo);
                    }
                    grupoContasReceber = null;
                });

                Task t4 = Task.Factory.StartNew(() =>
                {

                    var representanteDAL = new RepresentanteDAL();

                    //var representantes = from rep in representanteDAL.ListarTodos().Where(r => r.usuCodfil == codFilial)
                    //                     select rep;

                    var representantes = from rep in representanteDAL.ListarTodos().Where(r => r.sitrep == "A")
                                         select rep;

                    d.Representantes = new List<Representante>();

                    foreach (var representante in representantes)
                    {
                        d.Representantes.Add(representante);
                    }

                    //representantes = null;
                }).ContinueWith( _ =>
                {
                 var repBLL = new RepresentanteBLL();
                    d.Vendedores = repBLL.ListarVendedores(0, d.Representantes);

                });

                Task t5 = Task.Factory.StartNew(() =>
                {
                    var regiaoVendasDAL = new RegiaoVendasDAL();

                    var regioesVendas = from reg in regiaoVendasDAL.ListarTodos()
                                        select reg;

                    d.RegioesVendas = new List<RegiaoVendas>();

                    foreach (var regiao in regioesVendas)
                    {
                        d.RegioesVendas.Add(regiao);
                    }

                    regioesVendas = null;
                });

                Task t6 = Task.Factory.StartNew(() => {

                    var prazoDAL = new CondicaoPagamentoDAL();
                    var prazos = prazoDAL.ListarTodos().Where(p => p.usuSitsicad == "A").ToList();
                    d.CondicoesPagamento = prazos;

                });

                //Task t7 = Task.Factory.StartNew();

                Task.WaitAll(t1, t2, t3, t4,t5, t6);
            }
        }