Exemplo n.º 1
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            LLamada anterior = LlamadasBLL.Buscar(Convert.ToInt32(LlamadaIdTextBox.Text));

            if (anterior != null)
            {
                llamada = anterior;
                Recargar();
            }
            else
            {
                MessageBox.Show("llamadas no encontrada");
            }
        }
Exemplo n.º 2
0
        public static LLamada Buscar(int id)
        {
            Contexto db      = new Contexto();
            LLamada  llamada = new LLamada();

            try
            {
                llamada = db.Llamadas.Where(x => x.LlamadaId == id).Include(o => o.Llamadas).FirstOrDefault();
            }catch (Exception)
            {
                throw;
            }finally
            {
                db.Dispose();
            }
            return(llamada);
        }
Exemplo n.º 3
0
        public static bool Guardar(LLamada llamada)
        {
            bool     paso = false;
            Contexto db   = new Contexto();

            try
            {
                if (db.Llamadas.Add(llamada) != null)
                {
                    paso = db.SaveChanges() > 0;
                }
            }catch (Exception)
            {
                throw;
            }finally
            {
                db.Dispose();
            }
            return(paso);
        }
Exemplo n.º 4
0
        public static bool Modificar(LLamada llamada)
        {
            bool     paso = false;
            Contexto db   = new Contexto();

            try
            {
                db.Database.ExecuteSqlRaw($"DELETE FROM LlamadaDetalle Where LlamadaId = {llamada.LlamadaId}");
                foreach (var item in llamada.Llamadas)
                {
                    db.Entry(item).State = EntityState.Added;
                }
                db.Entry(llamada).State = EntityState.Modified;
                paso = (db.SaveChanges() > 0);
            }catch (Exception)
            {
                throw;
            }finally
            {
                db.Dispose();
            }
            return(paso);
        }
Exemplo n.º 5
0
        private bool ExisteBD()
        {
            LLamada LlamadaAnterior = LlamadasBLL.Buscar(llamada.LlamadaId);

            return(LlamadaAnterior != null);
        }