Пример #1
0
        public void GravaNovoStatusUsuario(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO>();

                    Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO novo = new Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO();

                    novo.CODIGO_STATUS_PEDIDO = Convert.ToDecimal(dados["CODIGO_STATUS_PEDIDO"]);
                    novo.ID_USUARIO_STATUS    = Convert.ToDecimal(dados["ID_USUARIO_STATUS"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #2
0
        public void GravaNovoTipoCobranca(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_TIPO_COBRANCA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_TIPO_COBRANCA>();

                    Doran_Servicos_ORM.TB_TIPO_COBRANCA novo = new Doran_Servicos_ORM.TB_TIPO_COBRANCA();

                    novo.COD_TIPO_COBRANCA       = Convert.ToDecimal(dados["COD_TIPO_COBRANCA"]);
                    novo.NUMERO_BANCO            = Convert.ToDecimal(dados["NUMERO_BANCO"]);
                    novo.DESCRICAO_TIPO_COBRANCA = dados["DESCRICAO_TIPO_COBRANCA"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #3
0
        public void GravaNovaTabela(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_TABELA_COMISSAO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_TABELA_COMISSAO>();

                    Doran_Servicos_ORM.TB_TABELA_COMISSAO novo = new Doran_Servicos_ORM.TB_TABELA_COMISSAO();

                    novo.ID_VENDEDOR         = Convert.ToDecimal(dados["ID_VENDEDOR"]);
                    novo.MARGEM_INICIAL      = Convert.ToDecimal(dados["MARGEM_INICIAL"]);
                    novo.MARGEM_FINAL        = Convert.ToDecimal(dados["MARGEM_FINAL"]);
                    novo.PERCENTUAL_COMISSAO = Convert.ToDecimal(dados["PERCENTUAL_COMISSAO"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #4
0
        public void GravaNovoCiclista(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_CICLISTA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CICLISTA>();

                    Doran_Servicos_ORM.TB_CICLISTA novo = new Doran_Servicos_ORM.TB_CICLISTA();

                    novo.NOME_CICLISTA  = dados["NOME_CICLISTA"].ToString();
                    novo.CICLISTA_ATIVO = Convert.ToDecimal(dados["CICLISTA_ATIVO"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, "TB_CICLISTA", Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO_ORIGINAL"]));
                throw ex;
            }
        }
Пример #5
0
        public void GravaNovoContato(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_CLIENTE_CONTATO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CLIENTE_CONTATO>();

                    Doran_Servicos_ORM.TB_CLIENTE_CONTATO novo = new Doran_Servicos_ORM.TB_CLIENTE_CONTATO();

                    novo.ID_CLIENTE                   = Convert.ToDecimal(dados["ID_CLIENTE"]);
                    novo.NOME_CONTATO_CLIENTE         = dados["NOME_CONTATO_CLIENTE"].ToString();
                    novo.TELEFONE_CONTATO_CLIENTE     = dados["TELEFONE_CONTATO_CLIENTE"].ToString();
                    novo.FAX_CONTATO_CLIENTE          = dados["FAX_CONTATO_CLIENTE"].ToString();
                    novo.EMAIL_CONTATO_CLIENTE        = dados["EMAIL_CONTATO_CLIENTE"].ToString();
                    novo.OBS_CONTATO_CLIENTE          = dados["OBS_CONTATO_CLIENTE"].ToString();
                    novo.RECEBE_COPIA_NOTA_ELETRONICA = Convert.ToDecimal(dados["RECEBE_COPIA_NOTA_ELETRONICA"]);
                    novo.SENHA_PORTAL                 = dados["SENHA_PORTAL"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #6
0
        public void GravaNovaConta(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_CONTA_CORRENTE> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CONTA_CORRENTE>();

                    Doran_Servicos_ORM.TB_CONTA_CORRENTE novo = new Doran_Servicos_ORM.TB_CONTA_CORRENTE();

                    novo.NUMERO_AGENCIA        = dados["NUMERO_AGENCIA"].ToString();
                    novo.NUMERO_CONTA          = dados["NUMERO_CONTA"].ToString();
                    novo.NUMERO_BANCO          = Convert.ToDecimal(dados["NUMERO_BANCO"]);
                    novo.ULTIMA_REMESSA        = Convert.ToDecimal(dados["ULTIMA_REMESSA"]);
                    novo.CONTROLE_NOSSO_NUMERO = dados["CONTROLE_NOSSO_NUMERO"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #7
0
        public void GravaNovaUF(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_UF> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_UF>();

                    Doran_Servicos_ORM.TB_UF novo = new Doran_Servicos_ORM.TB_UF();

                    novo.ID_UF             = Convert.ToDecimal(dados["ID_UF"]);
                    novo.DESCRICAO_UF      = dados["DESCRICAO_UF"].ToString();
                    novo.ALIQ_INTERNA_ICMS = Convert.ToDecimal(dados["ALIQ_INTERNA_ICMS"]);
                    novo.ALIQ_ICMS_UF      = Convert.ToDecimal(dados["ALIQ_ICMS_UF"]);
                    novo.SIGLA_UF          = dados["SIGLA_UF"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #8
0
        public string GravaNovoPAGTO(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_PAGTO_PARCIAL> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_PAGTO_PARCIAL>();

                    Doran_Servicos_ORM.TB_PAGTO_PARCIAL novo = new Doran_Servicos_ORM.TB_PAGTO_PARCIAL();

                    DateTime dt = Convert.ToDateTime(dados["DATA_PAGTO"].ToString() + " " + DateTime.Now.Hour.ToString().PadLeft(2, '0') +
                                                     ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Second.ToString().PadLeft(2, '0'));

                    novo.NUMERO_FINANCEIRO = Convert.ToDecimal(dados["NUMERO_FINANCEIRO"]);
                    novo.DATA_PAGTO        = dt;
                    novo.VALOR_PAGTO       = Convert.ToDecimal(dados["VALOR_PAGTO"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria.Th2_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();

                    string soma = SomaPagtoParcial(Convert.ToDecimal(dados["NUMERO_FINANCEIRO"])).ToString();

                    return(soma);
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #9
0
        public void GravaNovoProduto(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_PRODUTO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_PRODUTO>();

                    Doran_Servicos_ORM.TB_PRODUTO novo = new Doran_Servicos_ORM.TB_PRODUTO();

                    novo.CODIGO_PRODUTO       = dados["CODIGO_PRODUTO"].ToString();
                    novo.DESCRICAO_PRODUTO    = dados["DESCRICAO_PRODUTO"].ToString();
                    novo.UNIDADE_MEDIDA_VENDA = dados["UNIDADE_MEDIDA_VENDA"].ToString();
                    novo.PRECO_PRODUTO        = Convert.ToDecimal(dados["PRECO_PRODUTO"]);
                    novo.ALIQ_ISS             = Convert.ToDecimal(dados["ALIQ_ISS_SERVICO"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #10
0
        private void GravaCustos(int i, decimal NUMERO_ITEM_ORCAMENTO, DataContext ctx)
        {
            var item = (from linha in ctx.GetTable <TB_PEDIDO_VENDA>()
                        orderby linha.NUMERO_PEDIDO, linha.NUMERO_ITEM
                        where linha.NUMERO_PEDIDO == NUMERO_PEDIDO
                        select linha).ToList().Skip(i).First();

            var query = (from linha in ctx.GetTable <TB_CUSTO_ITEM_ORCAMENTO_VENDA>()
                         orderby linha.NUMERO_ORCAMENTO, linha.NUMERO_ITEM_ORCAMENTO
                         where linha.NUMERO_ORCAMENTO == NUMERO_ORCAMENTO &&
                         linha.NUMERO_ITEM_ORCAMENTO == NUMERO_ITEM_ORCAMENTO
                         select linha).ToList();

            foreach (var item1 in query)
            {
                System.Data.Linq.Table <Doran_Servicos_ORM.TB_CUSTO_ITEM_PEDIDO_VENDA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CUSTO_ITEM_PEDIDO_VENDA>();

                Doran_Servicos_ORM.TB_CUSTO_ITEM_PEDIDO_VENDA novo = new Doran_Servicos_ORM.TB_CUSTO_ITEM_PEDIDO_VENDA();

                novo.NUMERO_PEDIDO      = NUMERO_PEDIDO;
                novo.NUMERO_ITEM_PEDIDO = item.NUMERO_ITEM;
                novo.NUMERO_CUSTO_VENDA = item1.NUMERO_CUSTO_VENDA;
                novo.CUSTO_ITEM_PEDIDO  = item1.CUSTO_ITEM_ORCAMENTO;
                novo.PREVISAO_ENTREGA   = item1.PREVISAO_ENTREGA;
                novo.OBS_CUSTO_VENDA    = string.IsNullOrEmpty(item1.OBS_CUSTO_VENDA) ? "" : item1.OBS_CUSTO_VENDA;
                novo.CODIGO_FORNECEDOR  = item1.CODIGO_FORNECEDOR;

                Entidade.InsertOnSubmit(novo);

                Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert_PEDIDO_VENDA(ctx, novo, Entidade.ToString(), NUMERO_PEDIDO, ID_USUARIO);
            }

            ctx.SubmitChanges();
        }
Пример #11
0
        public void GravaNovoLimite(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_LIMITE> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_LIMITE>();

                    Doran_Servicos_ORM.TB_LIMITE novo = new Doran_Servicos_ORM.TB_LIMITE();

                    novo.VALOR_LIMITE = Convert.ToDecimal(dados["VALOR_LIMITE"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #12
0
        public void GravaNovoCusto(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_CUSTO_VENDA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CUSTO_VENDA>();

                    Doran_Servicos_ORM.TB_CUSTO_VENDA novo = new Doran_Servicos_ORM.TB_CUSTO_VENDA();

                    novo.DESCRICAO_CUSTO_VENDA       = dados["DESCRICAO_CUSTO_VENDA"].ToString();
                    novo.CUSTO_PERMANENTE            = Convert.ToDecimal(dados["CUSTO_PERMANENTE"]);
                    novo.PERCENTUAL_CUSTO_PERMANENTE = Convert.ToDecimal(dados["PERCENTUAL_CUSTO_PERMANENTE"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #13
0
        public void GravaNovaRegiao(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_REGIAO_VENDA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_REGIAO_VENDA>();

                    Doran_Servicos_ORM.TB_REGIAO_VENDA novo = new Doran_Servicos_ORM.TB_REGIAO_VENDA();

                    novo.CODIGO_REGIAO = dados["CODIGO_REGIAO"].ToString();
                    novo.NOME_REGIAO   = dados["NOME_REGIAO"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #14
0
        public void GravaNovo(Dictionary <string, object> dados, List <string> DESTINATARIOS, decimal ID_USUARIO, string LOGIN_USUARIO)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    string CLIENTE = (from linha in ctx.TB_PEDIDO_VENDAs
                                      where linha.NUMERO_PEDIDO == Convert.ToDecimal(dados["NUMERO_PEDIDO"])
                                      select linha.TB_ITEM_ORCAMENTO_VENDA.TB_ORCAMENTO_VENDA.TB_CLIENTE.NOMEFANTASIA_CLIENTE).ToList().First();

                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_FOLLOW_UP_PEDIDO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_FOLLOW_UP_PEDIDO>();

                    Doran_Servicos_ORM.TB_FOLLOW_UP_PEDIDO novo = new Doran_Servicos_ORM.TB_FOLLOW_UP_PEDIDO();

                    novo.NUMERO_PEDIDO        = Convert.ToDecimal(dados["NUMERO_PEDIDO"]);
                    novo.ID_USUARIO_FOLLOW_UP = ID_USUARIO;
                    novo.DATA_HORA_FOLLOW_UP  = DateTime.Now;
                    novo.TEXTO_FOLLOW_UP      = dados["TEXTO_FOLLOW_UP"].ToString();

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert_PEDIDO_VENDA(ctx, novo, Entidade.ToString(),
                                                                                                 Convert.ToDecimal(dados["NUMERO_PEDIDO"]), ID_USUARIO);

                    ctx.SubmitChanges();

                    if (DESTINATARIOS.Count > 0)
                    {
                        using (Doran_Email_Posicao_Pedido email = new Doran_Email_Posicao_Pedido(ID_USUARIO))
                        {
                            string _OBS = string.Concat(LOGIN_USUARIO.ToUpper(), " salvou uma nova mensagem de Follow Up no pedido ", dados["NUMERO_PEDIDO"].ToString(),
                                                        "<br /><br />", dados["TEXTO_FOLLOW_UP"].ToString(), "<br /><br />",
                                                        dados["ASSINATURA"].ToString());

                            email.NUMERO_PEDIDO  = Convert.ToDecimal(dados["NUMERO_PEDIDO"]);
                            email.CLIENTE        = CLIENTE;
                            email.CODIGO_PRODUTO = "";
                            email.HISTORICO      = _OBS;
                            email.DESTINATARIOS  = DESTINATARIOS;
                            email.ID_CONTA_EMAIL = Convert.ToDecimal(dados["ID_CONTA_EMAIL"]);
                            email.FROM_ADDRESS   = dados["FROM_ADDRESS"].ToString();

                            email.Envia_Email_Posicao_Pedido();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, ID_USUARIO);
                throw ex;
            }
        }
Пример #15
0
        //newlogs和singlelogs参数二选一
        private void SendToZHIREN_SaveInLOCAL(System.Data.Linq.Table <TFTAttLog> table, LinkedList <TFTAttLog> newLogs, TFTAttLog singlelog)
        {
            //sqlCmd.ExecuteNonQuery();
            if (singlelog != null)
            {
                newLogs = new LinkedList <TFTAttLog>();
                newLogs.AddFirst(singlelog);
            }

            ZhiRenHandler.sendUserVerified(newLogs, response =>
            {
                if (response == null || response.Length == 0)
                {
                    return;
                }

                if (response[0].Code != null)
                {
                    //todo:调试模式下依然按照成功处理 等之人后端搞定之后去除isDebugging判断
                    if (!Log.isDebugging() && response[0].Code.Contains("error"))
                    {
                        Log.e("ZHIREN error" + response[0].ErrorMessage);
                        return;
                    }

                    lock (myObject)
                    {
                        foreach (var log in newLogs)
                        {
                            try
                            {
                                //success
                                table.InsertOnSubmit(log);
                                Log.d("SAVE:" + table.Contains(log));
                                table.Context.SubmitChanges();
                                Log.d("SAVED:" + log);
                            }
                            catch (Exception e)
                            {
                                Log.e(e.Message);
                                if (Log.isDebugging())
                                {
                                    throw new Exception("ERROR");
                                }
                            }
                        }
                    }
                }
            });
        }
Пример #16
0
        public decimal Grava_Nota_Entrada(Dictionary <string, object> dados)
        {
            using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
            {
                System.Data.Linq.Table <TB_NOTA_ENTRADA> Entidade = ctx.GetTable <TB_NOTA_ENTRADA>();

                TB_NOTA_ENTRADA novo = new TB_NOTA_ENTRADA();

                novo.NUMERO_NFE = Convert.ToDecimal(dados["NUMERO_NFE"]);
                novo.SERIE_NFE  = dados["SERIE_NFE"].ToString();

                novo.DATA_EMISSAO_NFE = Convert.ToDateTime(dados["DATA_EMISSAO_NFE"]);
                novo.DATA_CHEGADA_NFE = Convert.ToDateTime(dados["DATA_CHEGADA_NFE"]);

                novo.CODIGO_FORNECEDOR = Convert.ToDecimal(dados["CODIGO_FORNECEDOR"]);
                novo.CODIGO_CP_NFE     = Convert.ToDecimal(dados["CODIGO_CP_NFE"]);
                novo.GERA_COBRANCA_NFE = Convert.ToDecimal(dados["GERA_COBRANCA_NFE"]);
                novo.CODIGO_CFOP_NFE   = dados["CODIGO_CFOP_NFE"].ToString();

                novo.BASE_ICMS_NFE       = Convert.ToDecimal(dados["BASE_ICMS_NFE"]);
                novo.VALOR_ICMS_NFE      = Convert.ToDecimal(dados["VALOR_ICMS_NFE"]);
                novo.BASE_ICMS_SUBS_NFE  = Convert.ToDecimal(dados["BASE_ICMS_SUBS_NFE"]);
                novo.VALOR_ICMS_SUBS_NFE = Convert.ToDecimal(dados["VALOR_ICMS_SUBS_NFE"]);
                novo.TOTAL_PRODUTOS_NFE  = Convert.ToDecimal(dados["TOTAL_PRODUTOS_NFE"]);
                novo.VALOR_FRETE_NFE     = Convert.ToDecimal(dados["VALOR_FRETE_NFE"]);
                novo.VALOR_SEGURO_NFE    = Convert.ToDecimal(dados["VALOR_SEGURO_NFE"]);
                novo.OUTRAS_DESP_NFE     = Convert.ToDecimal(dados["OUTRAS_DESP_NFE"]);
                novo.TOTAL_IPI_NFE       = Convert.ToDecimal(dados["TOTAL_IPI_NFE"]);
                novo.TOTAL_NFE           = Convert.ToDecimal(dados["TOTAL_NFE"]);
                novo.OBS_NFE             = dados["OBS_NFE"].ToString();
                novo.CANCELADA_NFE       = 0;
                novo.FRETE_NFE           = Convert.ToDecimal(dados["FRETE_NFE"]);
                novo.STATUS_NFE          = 1;

                novo.PESO_LIQUIDO_NFE = Convert.ToDecimal(dados["PESO_LIQUIDO_NFE"]);
                novo.PESO_BRUTO_NFE   = Convert.ToDecimal(dados["PESO_BRUTO_NFE"]);

                novo.CODIGO_EMITENTE_NFE = ID_EMPRESA;

                Entidade.InsertOnSubmit(novo);

                Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), ID_USUARIO);

                ctx.SubmitChanges();

                return(novo.NUMERO_SEQ_NFE);
            }
        }
Пример #17
0
        public void GravaNovoStatus(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_STATUS_PEDIDO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_STATUS_PEDIDO>();

                    Doran_Servicos_ORM.TB_STATUS_PEDIDO novo = new Doran_Servicos_ORM.TB_STATUS_PEDIDO();

                    novo.DESCRICAO_STATUS_PEDIDO = dados["DESCRICAO_STATUS_PEDIDO"].ToString();
                    novo.COR_STATUS                   = dados["COR_STATUS"].ToString();
                    novo.COR_FONTE_STATUS             = dados["COR_FONTE_STATUS"].ToString();
                    novo.NAO_IMPRIMIR_PEDIDO          = Convert.ToDecimal(dados["NAO_IMPRIMIR_PEDIDO"]);
                    novo.NAO_CANCELAR_PEDIDO          = Convert.ToDecimal(dados["NAO_CANCELAR_PEDIDO"]);
                    novo.STATUS_ESPECIFICO            = Convert.ToDecimal(dados["STATUS_ESPECIFICO"]);
                    novo.APARECE_NO_PORTAL_DE_CLIENTE = Convert.ToDecimal(dados["APARECE_NO_PORTAL_DE_CLIENTE"]);
                    novo.INICIO_FIM_DE_FASE           = Convert.ToDecimal(dados["INICIO_FIM_DE_FASE"]);

                    if (dados["SENHA_STATUS_PEDIDO"].ToString().Trim().Length > 0)
                    {
                        Th2_Seguranca.Principal sen = new Th2_Seguranca.Principal(Th2_Seguranca.classes.EncryptionAlgorithm.Des,
                                                                                  ConfigurationManager.AppSettings["ID_Sistema"]);

                        sen.CriptografaDados(dados["SENHA_STATUS_PEDIDO"].ToString().Trim());

                        novo.SENHA_STATUS_PEDIDO = sen.SenhaEncriptada_;
                    }
                    else
                    {
                        novo.SENHA_STATUS_PEDIDO = "";
                    }

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #18
0
        private void InsertTemperatureSensor(string name, DateTime time, SensorType sensorType, bool isActive)
        {
            int coreSize = 5;

            CoreNumber [] coreIndex = new CoreNumber[coreSize];
            for (int i = 0; i < coreSize; ++i)
            {
                coreIndex[i] = CoreNumber.None;
            }

            if (this.CoreOneCheck.Checked)
            {
                coreIndex[1] = CoreNumber.Core_1;
            }
            if (this.CoreTwoCheck.Checked)
            {
                coreIndex[2] = CoreNumber.Core_2;
            }
            if (this.CoreThreeCheck.Checked)
            {
                coreIndex[3] = CoreNumber.Core_3;
            }
            if (this.CoreFourCheck.Checked)
            {
                coreIndex[4] = CoreNumber.Core_4;
            }
            for (byte i = 1; i < coreSize; ++i)
            {
                if (coreIndex[i] != CoreNumber.None)
                {
                    TempertaureSensorConfig tempConfig = new TempertaureSensorConfig()
                    {
                        Name       = name,
                        MadeTime   = time,
                        SensorType = sensorType,
                        IsActive   = isActive,
                        CoreIndex  = coreIndex[i]
                    };
                    System.Data.Linq.Table <BaseSensorConfig> table = dbManager.dc.BaseSensorConfigs;
                    table.InsertOnSubmit(tempConfig);
                }
            }
        }
Пример #19
0
        public void CadastraDireitosParaUmUsuario(decimal ID_USUARIO, decimal ID_USUARIO_ORIGINAL)
        {
            try
            {
                TB_USUARIO _usuario = new TB_USUARIO();

                ArrayList arr1 = arrayMenu;

                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    for (int i = 0; i < arr1.Count; i++)
                    {
                        var query = from linha in ctx.TB_ACESSO_COMERCIALs
                                    where linha.ID_USUARIO == ID_USUARIO &&
                                    linha.MENU == arr1[i].ToString()
                                    select linha;

                        if (query.Count() == 0)
                        {
                            System.Data.Linq.Table <TB_ACESSO_COMERCIAL> Entidade = ctx.GetTable <TB_ACESSO_COMERCIAL>();

                            TB_ACESSO_COMERCIAL novo = new TB_ACESSO_COMERCIAL();

                            novo.ID_USUARIO = ID_USUARIO;
                            novo.MENU       = arr1[i].ToString();

                            Entidade.InsertOnSubmit(novo);

                            Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), ID_USUARIO_ORIGINAL);
                        }
                    }

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, ID_USUARIO_ORIGINAL);
                throw ex;
            }
        }
Пример #20
0
        public void CadastraStatusParaUmUsuario(decimal ID_USUARIO)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    var query = (from linha in ctx.TB_STATUS_PEDIDOs
                                 orderby linha.CODIGO_STATUS_PEDIDO
                                 select linha).ToList();

                    foreach (var item in query)
                    {
                        var existe = (from linha in ctx.TB_STATUS_PEDIDO_USUARIOs
                                      where linha.CODIGO_STATUS_PEDIDO == item.CODIGO_STATUS_PEDIDO &&
                                      linha.ID_USUARIO_STATUS == ID_USUARIO
                                      select linha).Count();

                        if (existe == 0)
                        {
                            System.Data.Linq.Table <Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO>();

                            Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO novo = new Doran_Servicos_ORM.TB_STATUS_PEDIDO_USUARIO();

                            novo.CODIGO_STATUS_PEDIDO = item.CODIGO_STATUS_PEDIDO;
                            novo.ID_USUARIO_STATUS    = ID_USUARIO;

                            Entidade.InsertOnSubmit(novo);

                            Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), ID_USUARIO);
                        }
                    }

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, ID_USUARIO);
                throw ex;
            }
        }
Пример #21
0
        public void GravaNovoServico(List <decimal> NUMEROS_PEDIDO, List <decimal> NUMEROS_ITEM, List <decimal> IDS_CICLISTAS, decimal ID_USUARIO)
        {
            try
            {
                for (int i = 0; i < IDS_CICLISTAS.Count; i++)
                {
                    for (int n = 0; n < NUMEROS_PEDIDO.Count; n++)
                    {
                        using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                        {
                            if (!(from linha in ctx.TB_SERVICO_CICLISTAs
                                  where linha.NUMERO_PEDIDO_VENDA == NUMEROS_PEDIDO[n] &&
                                  linha.NUMERO_ITEM_VENDA == NUMEROS_ITEM[n] &&
                                  linha.ID_CICLISTA == IDS_CICLISTAS[i]
                                  select linha).Any())
                            {
                                System.Data.Linq.Table <Doran_Servicos_ORM.TB_SERVICO_CICLISTA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_SERVICO_CICLISTA>();

                                Doran_Servicos_ORM.TB_SERVICO_CICLISTA novo = new Doran_Servicos_ORM.TB_SERVICO_CICLISTA();

                                novo.NUMERO_PEDIDO_VENDA = NUMEROS_PEDIDO[n];
                                novo.NUMERO_ITEM_VENDA   = NUMEROS_ITEM[n];
                                novo.ID_CICLISTA         = IDS_CICLISTAS[i];

                                Entidade.InsertOnSubmit(novo);

                                Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, "TB_SERVICO_CICLISTA", ID_USUARIO);
                            }

                            ctx.SubmitChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, ID_USUARIO);
                throw ex;
            }
        }
Пример #22
0
        public void GravaNovoConfig(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <TB_CONFIG_VENDA> Entidade = ctx.GetTable <TB_CONFIG_VENDA>();

                    TB_CONFIG_VENDA novo = new TB_CONFIG_VENDA();

                    novo.ID_CONFIGURACAO_VENDAS             = 1;
                    novo.ANALISAR_PRIMEIRA_COMPRA           = Convert.ToDecimal(dados["ANALISAR_PRIMEIRA_COMPRA"]);
                    novo.ANALISAR_INATIVIDADE               = Convert.ToDecimal(dados["ANALISAR_INATIVIDADE"]);
                    novo.ANALISAR_COND_PAGTO                = Convert.ToDecimal(dados["ANALISAR_COND_PAGTO"]);
                    novo.ANALISAR_MARGEM_VENDA              = Convert.ToDecimal(dados["ANALISAR_MARGEM_VENDA"]);
                    novo.ANALISAR_LIMITE_CREDITO            = Convert.ToDecimal(dados["ANALISAR_LIMITE_CREDITO"]);
                    novo.ANALISAR_INADIMPLENCIA             = Convert.ToDecimal(dados["ANALISAR_INADIMPLENCIA"]);
                    novo.DIAS_INATIVIDADE                   = Convert.ToDecimal(dados["DIAS_INATIVIDADE"]);
                    novo.LOGOTIPO_ORCAMENTO_VENDAS          = dados["LOGOTIPO_ORCAMENTO_VENDAS"].ToString();
                    novo.ANALISAR_FATURAMENTO_MINIMO        = Convert.ToDecimal(dados["ANALISAR_FATURAMENTO_MINIMO"]);
                    novo.VALOR_FATURAMENTO_MINIMO           = Convert.ToDecimal(dados["VALOR_FATURAMENTO_MINIMO"]);
                    novo.ANALISAR_IMPOSTO                   = Convert.ToDecimal(dados["ANALISAR_IMPOSTO"]);
                    novo.PRAZO_DIAS_ORCAMENTO               = Convert.ToDecimal(dados["PRAZO_DIAS_ORCAMENTO"]);
                    novo.NAO_GERAR_PEDIDO_HAVENDO_RESTRICAO = Convert.ToDecimal(dados["NAO_GERAR_PEDIDO_HAVENDO_RESTRICAO"]);
                    novo.TRABALHAR_COM_MARGEM_GROS          = Convert.ToDecimal(dados["TRABALHAR_COM_MARGEM_GROS"]);


                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #23
0
        public void GravaNovoAcesso(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    object[] MENU = (object[])dados["MENU"];

                    for (int i = 0; i < MENU.Length; i++)
                    {
                        var existe = (from linha in ctx.TB_ACESSO_COMERCIALs
                                      where (linha.ID_USUARIO == Convert.ToDecimal(dados["ID_USUARIO"]) &&
                                             linha.MENU == MENU[i].ToString())
                                      select linha).Any();

                        if (!existe)
                        {
                            System.Data.Linq.Table <TB_ACESSO_COMERCIAL> Entidade = ctx.GetTable <TB_ACESSO_COMERCIAL>();

                            TB_ACESSO_COMERCIAL novo = new TB_ACESSO_COMERCIAL();

                            novo.ID_USUARIO = Convert.ToDecimal(dados["ID_USUARIO"]);
                            novo.MENU       = MENU[i].ToString();

                            Entidade.InsertOnSubmit(novo);

                            Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));
                        }
                    }

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO_ORIGINAL"]));
                throw ex;
            }
        }
Пример #24
0
        public void GravaNovaCondPagto(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <TB_COND_PAGTO> Entidade = ctx.GetTable <TB_COND_PAGTO>();

                    TB_COND_PAGTO novo = new TB_COND_PAGTO();

                    novo.DESCRICAO_CP          = dados["DESCRICAO_CP"].ToString();
                    novo.QTDE_PARCELAS_CP      = Convert.ToDecimal(dados["QTDE_PARCELAS_CP"]);
                    novo.DIAS_PARCELA1_CP      = Convert.ToDecimal(dados["DIAS_PARCELA1_CP"]);
                    novo.DIAS_PARCELA2_CP      = Convert.ToDecimal(dados["DIAS_PARCELA2_CP"]);
                    novo.DIAS_PARCELA3_CP      = Convert.ToDecimal(dados["DIAS_PARCELA3_CP"]);
                    novo.DIAS_PARCELA4_CP      = Convert.ToDecimal(dados["DIAS_PARCELA4_CP"]);
                    novo.DIAS_PARCELA5_CP      = Convert.ToDecimal(dados["DIAS_PARCELA5_CP"]);
                    novo.DIAS_PARCELA6_CP      = Convert.ToDecimal(dados["DIAS_PARCELA6_CP"]);
                    novo.DIAS_PARCELA7_CP      = Convert.ToDecimal(dados["DIAS_PARCELA7_CP"]);
                    novo.DIAS_PARCELA8_CP      = Convert.ToDecimal(dados["DIAS_PARCELA8_CP"]);
                    novo.DIAS_PARCELA9_CP      = Convert.ToDecimal(dados["DIAS_PARCELA9_CP"]);
                    novo.DIAS_PARCELA10_CP     = Convert.ToDecimal(dados["DIAS_PARCELA10_CP"]);
                    novo.CONDICAO_CLIENTE_NOVO = Convert.ToDecimal(dados["CONDICAO_CLIENTE_NOVO"]);
                    novo.CUSTO_FINANCEIRO      = Convert.ToDecimal(dados["CUSTO_FINANCEIRO"]);
                    novo.CONDICAO_ATIVA        = Convert.ToDecimal(dados["CONDICAO_ATIVA"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #25
0
        public void GravaNovaAlcada(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    var existe = (from linha in ctx.TB_ALCADA_APROVACAO_PEDIDOs
                                  where linha.CODIGO_STATUS_COMPRA == Convert.ToDecimal(dados["CODIGO_STATUS_COMPRA"]) &&
                                  linha.ID_USUARIO == Convert.ToDecimal(dados["ID_USUARIO"])
                                  select linha).Any();

                    if (existe)
                    {
                        throw new Exception("J&aacute; existe uma al&ccedil;ada cadastrada com essa fase e usu&aacute;rio");
                    }

                    System.Data.Linq.Table <TB_ALCADA_APROVACAO_PEDIDO> Entidade = ctx.GetTable <TB_ALCADA_APROVACAO_PEDIDO>();

                    TB_ALCADA_APROVACAO_PEDIDO novo = new TB_ALCADA_APROVACAO_PEDIDO();

                    novo.CODIGO_STATUS_COMPRA   = Convert.ToDecimal(dados["CODIGO_STATUS_COMPRA"]);
                    novo.ID_USUARIO             = Convert.ToDecimal(dados["ID_USUARIO"]);
                    novo.VALOR_MAXIMO_APROVACAO = Convert.ToDecimal(dados["VALOR_MAXIMO_APROVACAO"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, "TB_ALCADA_APROVACAO_PEDIDO", Convert.ToDecimal(dados["ID_USUARIO_ORIGINAL"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO_ORIGINAL"]));
                throw ex;
            }
        }
Пример #26
0
        public void GravaNovoDocumento(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <Doran_Servicos_ORM.TB_CLIENTE_DOCUMENTO> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CLIENTE_DOCUMENTO>();

                    Doran_Servicos_ORM.TB_CLIENTE_DOCUMENTO novo = new Doran_Servicos_ORM.TB_CLIENTE_DOCUMENTO();

                    string arquivo = ConfigurationManager.AppSettings["Pasta_Fisica_Documento_Cliente"].EndsWith("\\") ?
                                     ConfigurationManager.AppSettings["Pasta_Fisica_Documento_Cliente"] + dados["ARQUIVO"].ToString() :
                                     ConfigurationManager.AppSettings["Pasta_Fisica_Documento_Cliente"] + "\\" + dados["ARQUIVO"].ToString();

                    byte[] Conteudo_do_Anexo = Doran_Base.ApoioXML.ReadFile(arquivo);

                    novo.ID_CLIENTE     = Convert.ToDecimal(dados["ID_CLIENTE"]);
                    novo.NOME_DOCUMENTO = dados["ARQUIVO"].ToString();
                    novo.CONTEUDO       = Conteudo_do_Anexo;
                    novo.DATA_DOCUMENTO = DateTime.Now;

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();

                    try { File.Delete(arquivo); }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                Th2_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #27
0
        public void GravaNovoPlano(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    string pai = dados["PAI_PLANO"].ToString();

                    if (pai.Trim().Length > 0)
                    {
                        if (!ExisteID(pai))
                        {
                            throw new Exception("O Campo [Pertencente ao plano] deve ser um ID de plano previamente cadastrado");
                        }
                    }

                    System.Data.Linq.Table <TB_PLANO_CONTA> Entidade = ctx.GetTable <TB_PLANO_CONTA>();

                    TB_PLANO_CONTA novo = new TB_PLANO_CONTA();

                    novo.ID_PLANO        = dados["ID_PLANO"].ToString();
                    novo.DESCRICAO_PLANO = dados["DESCRICAO_PLANO"].ToString();
                    novo.PAI_PLANO       = pai;

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria.Th2_Auditoria.Audita_Insert(ctx, novo, "TB_PLANO_CONTAS", Convert.ToDecimal(dados["ID_USUARIO"]));

                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #28
0
        public void GravaNovoVendedor(Dictionary <string, object> dados)
        {
            try
            {
                using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
                {
                    System.Data.Linq.Table <TB_VENDEDORE> Entidade = ctx.GetTable <TB_VENDEDORE>();

                    TB_VENDEDORE novo = new TB_VENDEDORE();

                    novo.NOME_VENDEDOR          = dados["NOME_VENDEDOR"].ToString();
                    novo.CELULAR_VENDEDOR       = dados["CELULAR_VENDEDOR"].ToString();
                    novo.EMAIL_VENDEDOR         = dados["EMAIL_VENDEDOR"].ToString();
                    novo.SKYPE_VENDEDOR         = dados["SKYPE_VENDEDOR"].ToString();
                    novo.PERC_COMISSAO_VENDEDOR = Convert.ToDecimal(dados["PERC_COMISSAO_VENDEDOR"]);
                    novo.CODIGO_EMITENTE        = Convert.ToDecimal(dados["CODIGO_EMITENTE"]);
                    novo.OBS_VENDEDOR           = dados["OBS_VENDEDOR"].ToString();
                    novo.SUPERVISOR_LIDER       = Convert.ToDecimal(dados["SUPERVISOR_LIDER"]);
                    novo.VENDEDOR_ATIVO         = Convert.ToDecimal(dados["VENDEDOR_ATIVO"]);

                    novo.CODIGO_EMITENTE = Convert.ToDecimal(dados["ID_EMPRESA"]);

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), Convert.ToDecimal(dados["ID_USUARIO"]));


                    ctx.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Doran_Base.Auditoria_ERP_Servicos.Doran_Exception.GravaErro(ex, Convert.ToDecimal(dados["ID_USUARIO"]));
                throw ex;
            }
        }
Пример #29
0
        private void GravaCustos(decimal SEQUENCIA_ITEM, decimal NUMERO_ITEM_ORCAMENTO, DateTime entrega, decimal ID_USUARIO)
        {
            using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
            {
                var item = (from linha in ctx.TB_ITEM_ORCAMENTO_VENDAs
                            orderby linha.NUMERO_ORCAMENTO, linha.NUMERO_ITEM
                            where linha.NUMERO_ORCAMENTO == NOVO_NUMERO_ORCAMENTO
                            select linha).ToList().Skip((int)SEQUENCIA_ITEM).First();

                var query = (from linha in ctx.TB_CUSTO_ITEM_ORCAMENTO_VENDAs
                             orderby linha.NUMERO_ORCAMENTO, linha.NUMERO_ITEM_ORCAMENTO
                             where linha.NUMERO_ORCAMENTO == NUMERO_ORCAMENTO &&
                             linha.NUMERO_ITEM_ORCAMENTO == NUMERO_ITEM_ORCAMENTO
                             select linha).ToList();

                foreach (var item1 in query)
                {
                    System.Data.Linq.Table <TB_CUSTO_ITEM_ORCAMENTO_VENDA> Entidade = ctx.GetTable <TB_CUSTO_ITEM_ORCAMENTO_VENDA>();

                    TB_CUSTO_ITEM_ORCAMENTO_VENDA novo = new TB_CUSTO_ITEM_ORCAMENTO_VENDA();

                    novo.NUMERO_ORCAMENTO      = NOVO_NUMERO_ORCAMENTO;
                    novo.NUMERO_ITEM_ORCAMENTO = item.NUMERO_ITEM;
                    novo.NUMERO_CUSTO_VENDA    = item1.NUMERO_CUSTO_VENDA;
                    novo.CUSTO_ITEM_ORCAMENTO  = item1.CUSTO_ITEM_ORCAMENTO;
                    novo.PREVISAO_ENTREGA      = entrega;
                    novo.OBS_CUSTO_VENDA       = item1.OBS_CUSTO_VENDA;

                    Entidade.InsertOnSubmit(novo);

                    Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), ID_USUARIO);
                }

                ctx.SubmitChanges();
            }
        }
Пример #30
0
        public void Adiciona_Percentual_Representante(decimal PERCENTUAL)
        {
            using (Doran_ERP_Servicos_DadosDataContext ctx = new Doran_ERP_Servicos_DadosDataContext())
            {
                var query = (from linha in ctx.TB_ITEM_ORCAMENTO_VENDAs
                             orderby linha.NUMERO_ORCAMENTO
                             where linha.NUMERO_ORCAMENTO == NUMERO_ORCAMENTO
                             select linha).ToList();

                var TOTAL_PRODUTOS = query.Sum(d => d.VALOR_TOTAL);

                decimal TOTAL_REPRESENTANTE = TOTAL_PRODUTOS.HasValue ? Math.Round((decimal)TOTAL_PRODUTOS * (PERCENTUAL / 100), 2) : 0;

                foreach (var item in query)
                {
                    decimal ADICIONAL_ITEM = Math.Round((decimal)item.VALOR_TOTAL * (PERCENTUAL / 100), 2);

                    ADICIONAL_ITEM = ADICIONAL_ITEM / (decimal)item.QTDE_PRODUTO;

                    var CUSTO_REPRESENTANTE = (from linha in ctx.TB_CUSTO_ITEM_ORCAMENTO_VENDAs
                                               orderby linha.NUMERO_ORCAMENTO, linha.NUMERO_ITEM_ORCAMENTO

                                               where (linha.NUMERO_ORCAMENTO == item.NUMERO_ORCAMENTO &&
                                                      linha.NUMERO_ITEM_ORCAMENTO == item.NUMERO_ITEM)

                                               && linha.NUMERO_CUSTO_VENDA == 26

                                               select linha).ToList();

                    if (CUSTO_REPRESENTANTE.Any())
                    {
                        foreach (var item1 in CUSTO_REPRESENTANTE)
                        {
                            item1.CUSTO_ITEM_ORCAMENTO = ADICIONAL_ITEM;
                            item1.CODIGO_FORNECEDOR    = 486;

                            Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Update(ctx, ctx.TB_CUSTO_ITEM_ORCAMENTO_VENDAs.GetModifiedMembers(item1),
                                                                                            ctx.TB_CUSTO_ITEM_ORCAMENTO_VENDAs.ToString(), ID_USUARIO);
                        }
                    }
                    else
                    {
                        System.Data.Linq.Table <Doran_Servicos_ORM.TB_CUSTO_ITEM_ORCAMENTO_VENDA> Entidade = ctx.GetTable <Doran_Servicos_ORM.TB_CUSTO_ITEM_ORCAMENTO_VENDA>();

                        Doran_Servicos_ORM.TB_CUSTO_ITEM_ORCAMENTO_VENDA novo = new Doran_Servicos_ORM.TB_CUSTO_ITEM_ORCAMENTO_VENDA();

                        novo.NUMERO_ORCAMENTO      = item.NUMERO_ORCAMENTO;
                        novo.NUMERO_ITEM_ORCAMENTO = item.NUMERO_ITEM;
                        novo.NUMERO_CUSTO_VENDA    = 26;
                        novo.CUSTO_ITEM_ORCAMENTO  = ADICIONAL_ITEM;
                        novo.PREVISAO_ENTREGA      = item.DATA_ENTREGA;
                        novo.OBS_CUSTO_VENDA       = "";
                        novo.CODIGO_FORNECEDOR     = 486;

                        Entidade.InsertOnSubmit(novo);

                        Doran_Base.Auditoria_ERP_Servicos.Doran_Auditoria.Audita_Insert(ctx, novo, Entidade.ToString(), ID_USUARIO);
                    }
                }

                ctx.SubmitChanges();
            }

            Recalcula_Custos(0);
        }