예제 #1
0
 private void Limpiar()
 {
     LLamadaId_Text.Text   = "0";
     Descripcion_Text.Text = string.Empty;
     llamadas = new Llamadas();
     Actualizar();
 }
        public bool Modificar(Llamadas Llamadas)
        {
            bool     paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                var anterior = Buscar(Llamadas.LlamadasId);

                foreach (var item in Llamadas.LlamadasDetalles)
                {
                    if (item.LlamadaDetalleId == 0)
                    {
                        contexto.Entry(item).State = EntityState.Added;
                    }
                }

                foreach (var item in anterior.LlamadasDetalles)
                {
                    if (!Llamadas.LlamadasDetalles.Any(A => A.LlamadaDetalleId == item.LlamadaDetalleId))
                    {
                        contexto.Entry(item).State = EntityState.Deleted;
                    }
                }

                contexto.Entry(Llamadas).State = EntityState.Modified;
                paso = contexto.SaveChanges() > 0;
            }
            catch
            {
                throw;
            }
            return(paso);
        }
        public bool Guardar(Llamadas llamadas)
        {
            Contexto contexto = new Contexto();
            bool     paso     = true;

            try
            {
                if (llamadas.LlamadasId == 0)
                {
                    Insertar(llamadas);
                }
                else if (Buscar(llamadas.LlamadasId) == null)
                {
                    paso = false;
                }
                else
                {
                    Modificar(llamadas);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
예제 #4
0
        public static bool Modificar(Llamadas llamadas)
        {
            Contexto db   = new Contexto();
            bool     paso = false;

            try
            {
                db.Database.ExecuteSqlRaw($"DELETE FROM LlamadasDetalle WHERE LlamadaId={llamadas.LlamadaId}");

                foreach (var item in llamadas.LlamadasDetalle)
                {
                    db.Entry(item).State = EntityState.Added;
                }

                db.Entry(llamadas).State = EntityState.Modified;
                paso = (db.SaveChanges() > 0);
            }
            catch
            {
                throw;
            }
            finally
            {
                db.Dispose();
            }

            return(paso);
        }
예제 #5
0
        public static bool Modificar(Llamadas llamada)
        {
            bool     paso = false;
            Contexto db   = new Contexto();

            try
            {
                db.Database.ExecuteSqlRaw($"Delete FROM LlamadaDetalle Where LlamadaId = {llamada.Llamadaid}");
                foreach (var item in llamada.Telefono)
                {
                    db.Entry(item).State = EntityState.Added;
                }
                db.Entry(llamada).State = EntityState.Modified;
                paso = (db.SaveChanges() > 0);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                db.Dispose();
            }
            return(paso);
        }
예제 #6
0
        public static bool Modificar(Llamadas llamadas)
        {
            bool     paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                contexto.Database.ExecuteSqlRaw($"DELETE FROM LlamadasDetalles Where LlamadaId={llamadas.LlamadaId}");
                foreach (var anterior in llamadas.LlamadasDetalles)
                {
                    contexto.Entry(anterior).State = EntityState.Added;
                }
                contexto.Entry(llamadas).State = EntityState.Modified;
                paso = (contexto.SaveChanges() > 0);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }

            return(paso);
        }
예제 #7
0
        public static bool Modificar(Llamadas Llamada)
        {
            bool     Paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                contexto.Database.ExecuteSqlRaw($"Delete From LlamadasDetalles where LlamadaId={Llamada.LlamadaId}");

                foreach (var item in Llamada.Detalle)
                {
                    contexto.Entry(item).State = EntityState.Added;
                }

                contexto.Llamadas.Add(Llamada);
                contexto.Entry(Llamada).State = EntityState.Modified;
                Paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }

            return(Paso);
        }
예제 #8
0
 private void Limpiar()
 {
     /*LlamadaIdTextBox.Text = "0";
      * DescripcionTextBox.Text = string.Empty;*/
     llamada = new Llamadas();
     DetalleDataGrid.ItemsSource = new List <LlamadaDetalle>();
     Actualizar();
 }
예제 #9
0
 private void Limpiar()
 {
     IdTextBox.Text           = "0";
     DescripcionTextBox.Text  = string.Empty;
     ProblemaTextBox.Text     = string.Empty;
     SolucionTextBox.Text     = string.Empty;
     llamadas.LlamadasDetalle = new List <LlamadasDetalle>();
     llamadas = new Llamadas();
     Cargar();
 }
예제 #10
0
 private void Limpiar()
 {
     LlamadaIdtextblock.Text    = "0";
     Despcripciontextblock.Text = string.Empty;
     Problemtextblock.Text      = string.Empty;
     Soluciotextblock.Text      = string.Empty;
     llamada          = new Llamadas();
     llamada.Telefono = new List <LlamadasDetalles>();
     reCargar();
 }
        private void Limpiar()
        {
            LLamadasIdTex.Text      = "0";
            DescripcionTex.Text     = string.Empty;
            ProblemaTex.Text        = string.Empty;
            SolucionTex.Text        = string.Empty;
            llamadas                = new Llamadas();
            llamadas.LlamadaDetalle = new List <LLamadasDetalle>();

            LLenar();
        }
예제 #12
0
 public virtual void Guardar(Llamadas llamadas)
 {
     if (llamadas.LlamadaId == 0)
     {
         Insertar(llamadas);
     }
     else
     {
         Modificar(llamadas);
     }
 }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamada = LlamadasBLL.Buscar(contenedor.llamada.LlamadaId);

            if (llamada != null)
            {
                contenedor.llamada = llamada;
                reCargar();
            }
            else
            {
                MessageBox.Show("Llamada no encontrada");
            }
        }
예제 #14
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas anterior = LlamadasBLL.Buscar(Convert.ToInt32(IdTextBox.Text));

            if (anterior != null)
            {
                llamadas = anterior;
                Actualizar();
            }
            else
            {
                MessageBox.Show("llamadas no encontrada");
            }
        }
예제 #15
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamadasAnterior = LlamadasBLL.Buscar(llamadas.LlamadaId);

            if (llamadasAnterior != null)
            {
                llamadas = llamadasAnterior;
                Actualizar();
            }
            else
            {
                MessageBox.Show("No se Encontro la Llamada");
            }
        }
예제 #16
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas l = LlamadasBLL.Buscar(llamadas.LlamadaId);

            if (l != null)
            {
                llamadas = l;
                Cargar();
            }
            else
            {
                MessageBox.Show("No se encontro", "ERROR");
            }
        }
        public Llamadas Buscar(int id)
        {
            Contexto contexto = new Contexto();
            Llamadas llamadas = new Llamadas();

            try
            {
                llamadas = contexto.Llamadas.Where(A => A.LlamadasId == id).Include(A => A.LlamadasDetalles).FirstOrDefault();
            }
            catch (Exception)
            {
                throw;
            }
            return(llamadas);
        }
예제 #18
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas LlamadaAnterior = LlamadaBLL.Buscar(Convert.ToInt32(LlamadaIdtextblock.Text));

            if (LlamadaAnterior != null)
            {
                llamada = LlamadaAnterior;
                reCargar();
            }
            else
            {
                Limpiar();
                MessageBox.Show("Persona no encontrada");
            }
        }
        private void buscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamadalocal = LlamadasBLL.Buscar(llamadas.LlamadaId);

            if (llamadalocal != null)
            {
                llamadas = llamadalocal;
                Llenar();
            }
            else
            {
                LimpiarCampos();
                MessageBox.Show("Llamada no Encontrada!!");
            }
        }
예제 #20
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamadaBuscada = LlamadasBLL.Buscar(Convert.ToInt32(LlamadaIdTextBox.Text));

            if (llamadaBuscada != null)
            {
                llamada = llamadaBuscada;
                Actualizar();
            }
            else
            {
                MessageBox.Show("Llamada no encontrada");
                Limpiar();
            }
        }
예제 #21
0
        public static bool Insertar(Llamadas llamadas)
        {
            bool     paso     = false;
            Contexto Database = new Contexto();

            try
            {
                Database.Llamadas.Add(llamadas);
                paso = Database.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
        public bool Guardar(Llamadas llamadas)
        {
            bool     paso = false;
            Contexto db   = new Contexto();

            try
            {
                db.llamadas.Add(llamadas);
                paso = db.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamadasAnterio = LLamadasBLL.Buscar(llamadas.LlamadasId);

            Limpiar();
            if (llamadasAnterio != null)
            {
                llamadas = llamadasAnterio;
                LLenar();
            }
            else
            {
                Limpiar();
                MessageBox.Show("LLamada no Existe...");
            }
        }
        private bool Insertar(Llamadas llamada)
        {
            Contexto contexto = new Contexto();
            bool     paso     = false;

            try
            {
                contexto.Llamadas.Add(llamada);
                paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Llamadas llamadaAnterior = LlamadasBLL.Buscar(llamadas.LlamadaId);

            if (llamadaAnterior != null)
            {
                MessageBox.Show("Llamada Encontrada");
                llamadas = llamadaAnterior;
                Refrescar();
            }
            else
            {
                Limpiar();
                MessageBox.Show("Llamada no encontrada");
            }
        }
        public bool Insertar(Llamadas Llamadas)
        {
            bool     paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                contexto.Add(Llamadas);
                paso = contexto.SaveChanges() > 0;
            }
            catch
            {
                throw;
            }
            return(paso);
        }
예제 #27
0
        public static bool Modificar(Llamadas llamadas)
        {
            bool     paso     = false;
            Contexto Database = new Contexto();

            try
            {
                Database.Entry(llamadas).State = EntityState.Modified;
                paso = Database.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
예제 #28
0
        public static bool Eliminar(int Id)
        {
            Contexto DataBase = new Contexto();
            Llamadas llamada  = new Llamadas();
            bool     paso     = false;

            try
            {
                llamada = DataBase.Llamadas.Find(Id);
                DataBase.Llamadas.Remove(llamada);
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
예제 #29
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            int id;

            int.TryParse(LlamadaIdTextBox.Text, out id);

            llamada = LlamadasBLL.Buscar(id);

            if (llamada != null)
            {
                this.DataContext = llamada;
                Actualizar();
            }
            else
            {
                MessageBox.Show("No encontrado", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public bool Eliminar(int id)
        {
            Contexto contexto = new Contexto();
            Llamadas llamadas = new Llamadas();
            bool     paso     = false;

            try
            {
                llamadas = contexto.Llamadas.Find(id);
                contexto.Entry(llamadas).State = EntityState.Deleted;
                paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }