Exemple #1
0
        public ResponseModel AutenticarUsuario(string usuarioLogin, string Password)
        {
            var rm = new ResponseModel();

            try
            {
                using (var ctx = new DBContexto()) {
                    Password = HashHelper.MD5(Password);
                    var usuario = ctx.Usuario.Where(x => x.UsuarioLogin == usuarioLogin).Where(x => x.Password == Password).SingleOrDefault();


                    if (usuario != null)
                    {
                        SessionHelper.AddUserToSession(usuario.IdUsuario.ToString());
                        rm.SetResponse(true);
                    }
                    else
                    {
                        rm.SetResponse(false, "Usuario o Contraseña Invalidos Intentelo nuevamente!");
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(rm);
        }
Exemple #2
0
        public string  AutenticacionPersonalizada(string usuarioLogin, string Password)
        {
            var estado = "";

            try
            {
                using (var ctx = new DBContexto()) {
                    Password = HashHelper.MD5(Password);
                    var usuario = ctx.Usuario.Where(x => x.UsuarioLogin == usuarioLogin).Where(x => x.Password == Password).SingleOrDefault();


                    if (usuario != null)
                    {
                        SessionHelper.AddUserToSession(usuario.IdUsuario.ToString());
                        estado = "OK";
                    }
                    else
                    {
                        estado = "Usuario o Contraseña Invalidos Intentelo nuevamente!";
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(estado);
        }
Exemple #3
0
        public string CerrarSeguimientoPosterior(int IdDetalleMovimiento, string Logros)
        {
            using (var ctx = new DBContexto())
            {
                string result = "";


                try
                {
                    var objeto = ctx.Database.SqlQuery <DetalleMovimiento>("SP_CerrarSeguimiento @IdDetalleMovimiento,@Logros", new SqlParameter("@IdDetalleMovimiento", IdDetalleMovimiento), new SqlParameter("@Logros", Logros)).FirstOrDefaultAsync();
                    if (objeto != null)
                    {
                        result = "OK";
                    }
                    else
                    {
                        result = "ERROR";
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                return(result);
            }
        }
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Estado es = new Estado();

            es.Nome       = tbNome.Text;
            es.Sigla      = tbSigla.Text;
            es.CodigoIBGE = Convert.ToInt32(tbCodigoIBGE.Text);
            es.PaisId     = Convert.ToInt32(cbCodigoPais.SelectedValue);

            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    es = ctx.Estados.Find(Convert.ToInt32(tbCodigo.Text));
                    if (es != null)
                    {
                        es.Nome       = tbNome.Text;
                        es.Sigla      = tbSigla.Text;
                        es.CodigoIBGE = Convert.ToInt32(tbCodigoIBGE.Text);
                        es.PaisId     = Convert.ToInt32(cbCodigoPais.SelectedValue);
                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Estados.Add(es);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Medicamento m = new Medicamento();

            m.Nome           = tbNome.Text;
            m.Descricao      = tbDescricao.Text;
            m.NumeroRegistro = Convert.ToInt32(tbNumeroRegistro.Text);

            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    m = ctx.Medicamentos.Find(Convert.ToInt32(tbCodigo.Text));
                    if (m != null)
                    {
                        m.Nome           = tbNome.Text;
                        m.Descricao      = tbDescricao.Text;
                        m.NumeroRegistro = Convert.ToInt32(tbNumeroRegistro.Text);

                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Medicamentos.Add(m);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
Exemple #6
0
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Cep c = new Cep();

            c.NumeroCep = tbNumeroCep.Text;
            c.CidadeId  = Convert.ToInt32(cbCodigoCidade.SelectedValue);
            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    c = ctx.Ceps.Find(Convert.ToInt32(tbCodigo.Text));
                    if (c != null)
                    {
                        c.NumeroCep = tbNumeroCep.Text;
                        c.CidadeId  = Convert.ToInt32(cbCodigoCidade.SelectedValue);
                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Ceps.Add(c);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
        private void BtnFatura_Click(object sender, RoutedEventArgs e)
        {
            Faturamento f = new Faturamento();


            f.Tipo           = cbTipo.Text;
            f.DataConsulta   = dpDataConsulta.SelectedDate.Value;
            f.HorarioConsuta = tpHoraConsulta.Text;
            f.MedicoId       = Convert.ToInt32(cbCodigoMedico.SelectedValue);
            f.PessoaId       = Convert.ToInt32(cbCodigoPessoa.SelectedValue);
            f.PlanoId        = Convert.ToInt32(cbCodigoPlano.SelectedValue);
            f.Valor          = Convert.ToDecimal(tbValor.Text);
            f.TipoPagamento  = cbTipoPagamento.Text;
            f.Status         = "Faturado";

            using (DBContexto ctx = new DBContexto())
            {
                Agendamento a = ctx.Agendamentos.Find(Convert.ToInt32(tbCodigoAgendamento.Text));

                ctx.Agendamentos.Remove(a);
                ctx.Faturamentos.Add(f);
                ctx.SaveChanges();
            }
            this.Close();
        }
Exemple #8
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            DBContexto dbContexto)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseCors("MyCors");
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            InicializaDB.Initialize(dbContexto);
        }
Exemple #9
0
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Banco b = new Banco();

            b.Nome   = tbNome.Text;
            b.Codigo = Convert.ToInt32(tbCodigoBanco.Text);

            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    b = ctx.Bancos.Find(Convert.ToInt32(tbCodigo.Text));
                    if (b != null)
                    {
                        b.Nome   = tbNome.Text;
                        b.Codigo = Convert.ToInt32(tbCodigoBanco.Text);
                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Bancos.Add(b);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Cidade ci = new Cidade();

            ci.Nome       = tbNome.Text;
            ci.CodigoIBGE = Convert.ToInt32(tbCodigoIBGE.Text);
            ci.EstadoId   = Convert.ToInt32(cbCodigoEstado.SelectedValue);
            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    ci = ctx.Cidades.Find(Convert.ToInt32(tbCodigo.Text));
                    if (ci != null)
                    {
                        ci.Nome       = tbNome.Text;
                        ci.CodigoIBGE = Convert.ToInt32(tbCodigoIBGE.Text);
                        ci.EstadoId   = Convert.ToInt32(cbCodigoEstado.SelectedValue);
                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Cidades.Add(ci);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
Exemple #11
0
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            Plano p = new Plano();

            p.Nome   = tbNome.Text;
            p.Numero = tbNumero.Text;

            if (op == "alterar")
            {
                using (DBContexto ctx = new DBContexto())
                {
                    p = ctx.Planos.Find(Convert.ToInt32(tbCodigo.Text));
                    if (p != null)
                    {
                        p.Nome   = tbNome.Text;
                        p.Numero = tbNumero.Text;
                        ctx.SaveChanges();
                    }
                }
            }
            else
            {
                using (var ctx = new DBContexto())
                {
                    ctx.Planos.Add(p);
                    ctx.SaveChanges();
                }
            }

            this.Close();
        }
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.ContasPagar;
         dgMostraContasPagar.ItemsSource = consulta.ToList();
     }
 }
Exemple #13
0
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.Paises;
         dgMostraPais.ItemsSource = consulta.ToList();
     }
 }
Exemple #14
0
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.Estados
                        .Include(p => p.Pais);
         dgMostraEstados.ItemsSource = consulta.ToList();
     }
 }
Exemple #15
0
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.Cidades
                        .Include(e => e.Estado);
         dgMostraCidade.ItemsSource = consulta.ToList();
     }
 }
Exemple #16
0
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.Ceps
                        .Include(c => c.Cidade);
         dgMostraCep.ItemsSource = consulta.ToList();
     }
 }
Exemple #17
0
        public SP_ObtenerDatosUsuarioLogin ObtenerDatosDeUsuario(int IdUsuario)
        {
            using (var ctx = new DBContexto())
            {
                var UsuarioLogin = new SP_ObtenerDatosUsuarioLogin();
                UsuarioLogin = ctx.Database.SqlQuery <SP_ObtenerDatosUsuarioLogin>("SP_ObtenerDatosUsuarioLogin @IdUsuario", new SqlParameter("@IdUsuario", IdUsuario)).First();

                return(UsuarioLogin);
            }
        }
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = ctx.Agendamentos
                        .Include(a => a.Pessoa)
                        .Include(a => a.Medico)
                        .Include(a => a.Plano);
         dgMostraAgendamentos.ItemsSource = consulta.ToList();
     }
 }
Exemple #19
0
 public NotasController(DBContexto context, ILogger <NotasController> logger)
 {
     _context       = context;
     _logger        = logger;
     dTransposicion = new Dictionary <string, int>()
     {
         { "SaxoAlto", 2 },
         { "SaxoTenor", 1 },
         { "Piano", 0 },
     };
 }
Exemple #20
0
 public void PreencherTabela()
 {
     using (DBContexto ctx = new DBContexto())
     {
         var consulta = from c in ctx.Agendamentos
                        .Include(c => c.Pessoa)
                        where c.DataConsulta.Equals(DateTime.Today) && c.Status != "Finalizada"
                        select c;
         dgMostraAgendametosDoDia.ItemsSource = consulta.ToList();
     }
 }
 private void BtnPesquisaBanco_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var consulta = from b in ctx.Bancos where b.Nome.Contains(tbPesquisa.Text) select b;
             dgMostraBanco.ItemsSource = consulta.ToList();
         }
     }
     catch { }
 }
 private void BtnPesquisaUsuario_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var consulta = from c in ctx.Usuarios where c.Login.Contains(tbPesquisa.Text)
                            select c;
             dgMostraUsuarios.ItemsSource = consulta.ToList();
         }
     }
     catch { }
 }
Exemple #23
0
 private void PreencherComboBox()
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var item = ctx.Cidades.ToList();
             cid = item;
             cbCidade.DataContext = cid;
         }
     }
     catch { }
 }
 private void BtnPesquisaContasPagar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var consulta = from c in ctx.ContasPagar where c.Descricao.Contains(tbPesquisa.Text)
                            select c;
             dgMostraContasPagar.ItemsSource = consulta.ToList();
         }
     }
     catch { }
 }
Exemple #25
0
 private void BtnPesquisaBanco_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var consulta = from c in ctx.Medicamentos where c.Nome.Contains(tbPesquisa.Text) || c.Descricao.Contains(tbPesquisa.Text)
                            select c;
             dgMostraMedicamentos.ItemsSource = consulta.ToList();
         }
     }
     catch { }
 }
Exemple #26
0
 public IEnumerable <SP_ListarDetallesMovimientoPorEmpleado> ListarDetallesMovimientoPorEmpleado(int IdEmpleado)
 {
     using (var ctx = new DBContexto()){
         try
         {
             var Lista = ctx.Database.SqlQuery <SP_ListarDetallesMovimientoPorEmpleado>("SP_ListarDetallesMovimientoPorEmpleado @IdEmpleado", new SqlParameter("@IdEmpleado", IdEmpleado)).ToList();
             return(Lista);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
Exemple #27
0
 private void BtnPesquisaCep_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (DBContexto ctx = new DBContexto())
         {
             var consulta = from c in ctx.Ceps
                            .Include(c => c.Cidade)
                            where c.NumeroCep.Contains(tbPesquisa.Text) select c;
             dgMostraCep.ItemsSource = consulta.ToList();
         }
     }
     catch { }
 }
        private void PreencheComboBox()
        {
            try
            {
                using (DBContexto ctx = new DBContexto())
                {
                    var item = ctx.Paises.ToList();
                    paises = item;

                    cbCodigoPais.DataContext = paises;
                }
            }
            catch { }
        }
Exemple #29
0
 private void BtnExcluirContasReceber_Click(object sender, RoutedEventArgs e)
 {
     if (dgMostraContasReceber.SelectedIndex >= 0)
     {
         ContasReceber cr = (ContasReceber)dgMostraContasReceber.Items[dgMostraContasReceber.SelectedIndex];
         using (DBContexto ctx = new DBContexto())
         {
             cr = ctx.ContasReceber.Find(cr.ContasReceberId);
             ctx.ContasReceber.Remove(cr);
             ctx.SaveChanges();
         }
     }
     PreencherTabela();
 }
        private void PreencheComboBox()
        {
            try
            {
                using (DBContexto ctx = new DBContexto())
                {
                    var item = ctx.Estados.ToList();
                    Estados = item;

                    cbCodigoEstado.DataContext = Estados;
                }
            }
            catch { }
        }