コード例 #1
0
        /// <summary>
        /// Tipo Droga Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BeTipoDroga Find(int?id)
        {
            var data = new List <BeTipoDroga>();

            try
            {
                using (var db = new EstG2Contex())
                {
                    data.AddRange(from tn in db.TipoDroga
                                  .Where(t => t.TipoDrogaID == id)
                                  select new BeTipoDroga()

                    {
                        ID               = tn.TipoDrogaID,
                        Nombre           = tn.Nombre,
                        EstatusID        = tn.EstatusID,
                        UsuarioCreo      = tn.UsuarioCreo,
                        FechaCreo        = tn.FechaCreo,
                        UsuarioActualizo = tn.UsuarioActualizo,
                        FechaActualizo   = tn.FechaActualizo
                    });
                };
                return(data.FirstOrDefault());
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        //Probando GitHub
        public List <BeTipoDroga> FindAll()
        {
            var data = new List <BeTipoDroga>();

            try
            {
                using (var db = new EstG2Contex())
                {
                    data.AddRange(from tn in db.TipoDroga
                                  where tn.EstatusID != 3
                                  select new BeTipoDroga()

                    {
                        ID               = tn.TipoDrogaID,
                        Nombre           = tn.Nombre,
                        EstatusID        = tn.EstatusID,
                        UsuarioCreo      = tn.UsuarioCreo,
                        FechaCreo        = tn.FechaCreo,
                        UsuarioActualizo = tn.UsuarioActualizo,
                        FechaActualizo   = tn.FechaActualizo
                    });
                };
                return(data.ToList());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Edit Tipo Novedad
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Edit(BeCausaHerida item)
        {
            try
            {
                using (var db = new EstG2Contex())
                {
                    var ch = new CausaHerida();


                    ch.UsuarioActualizo = "gbrito";
                    ch.FechaActualizo   = DateTime.Now;
                    ch.Nombre           = item.Nombre;
                    ch.CausaHeridaID    = item.ID;
                    ch.EstatusID        = (int)item.EstatusID;
                    db.CausaHerida.Attach(ch);
                    db.Entry(ch).Property(x => x.Nombre).IsModified           = true;
                    db.Entry(ch).Property(x => x.EstatusID).IsModified        = true;
                    db.Entry(ch).Property(x => x.UsuarioActualizo).IsModified = true;
                    db.Entry(ch).Property(x => x.FechaActualizo).IsModified   = true;
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
コード例 #4
0
        /// <summary>
        /// Edit Tipo Droga
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Edit(BeTipoDroga item)
        {
            try
            {
                using (var db = new EstG2Contex())
                {
                    var tn = new TipoDroga();


                    tn.UsuarioActualizo = "gbrito";
                    tn.FechaActualizo   = DateTime.Now;
                    tn.Nombre           = item.Nombre;
                    tn.TipoDrogaID      = item.ID;
                    tn.EstatusID        = (int)item.EstatusID;
                    db.TipoDroga.Attach(tn);
                    db.Entry(tn).Property(x => x.Nombre).IsModified           = true;
                    db.Entry(tn).Property(x => x.EstatusID).IsModified        = true;
                    db.Entry(tn).Property(x => x.UsuarioActualizo).IsModified = true;
                    db.Entry(tn).Property(x => x.FechaActualizo).IsModified   = true;
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
コード例 #5
0
 public bool Edit(BeTipoApresamientos item)
 {
     try
     {
         using (var db = new EstG2Contex())
         {
             var tn = new TipoApresamientos();
             tn.UsuarioActualizo = "MJimenez";
             tn.FechaActualizo   = DateTime.Now;
             tn.Nombre           = item.Nombre;
             tn.ApresamientoID   = item.ID;
             tn.EstatusID        = item.EstatusID;
             db.TipoApresamientos.Attach(tn);
             db.Entry(tn).Property(x => x.Nombre).IsModified           = true;
             db.Entry(tn).Property(x => x.EstatusID).IsModified        = true;
             db.Entry(tn).Property(x => x.UsuarioActualizo).IsModified = true;
             db.Entry(tn).Property(x => x.FechaActualizo).IsModified   = true;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #6
0
        public BeTipoApresamientos Find(int?id)
        {
            var data = new List <BeTipoApresamientos>();

            try
            {
                using (var db = new EstG2Contex())
                {
                    data.AddRange(from tn in db.TipoApresamientos
                                  .Where(t => t.ApresamientoID == id)
                                  select new BeTipoApresamientos()
                    {
                        ID               = tn.ApresamientoID,
                        Nombre           = tn.Nombre,
                        UsuarioCreo      = tn.UsuarioCreo,
                        FechaCreo        = tn.FechaCreo,
                        UsuarioActualizo = tn.UsuarioActualizo,
                        FechaActualizo   = tn.FechaActualizo,
                        TipoNovedadID    = tn.TipoNovedadID
                    }); return(data.FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #7
0
        public List <BeTipoApresamientos> FindAll()
        {
            var data = new List <BeTipoApresamientos>();

            try
            {
                using (var db = new EstG2Contex())
                {
                    data.AddRange(from tn in db.TipoApresamientos
                                  where tn.EstatusID != 3
                                  select new BeTipoApresamientos()
                    {
                        ID               = tn.ApresamientoID,
                        Nombre           = tn.Nombre,
                        UsuarioCreo      = tn.UsuarioCreo,
                        FechaCreo        = tn.FechaCreo,
                        UsuarioActualizo = tn.UsuarioActualizo,
                        FechaActualizo   = tn.FechaActualizo,
                        TipoNovedadID    = tn.TipoNovedadID,
                        EstatusID        = tn.EstatusID
                    }); return(data.ToList());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #8
0
 /// <summary>
 /// Elimina Tipo Droga
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Delete(int?id)
 {
     try
     {
         using (var db = new EstG2Contex())
         {
             var tn = db.TipoDroga.Find(id);
             if (tn != null)
             {
                 db.TipoDroga.Remove(tn);
             }
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #9
0
        /// <summary>
        /// Find All
        /// </summary>
        /// <returns></returns>
        public List <BeEstatus> FindAll()
        {
            List <BeEstatus> data = new List <BeEstatus>();

            try
            {
                using (var db = new EstG2Contex())
                {
                    data.AddRange(from e in db.Estatus
                                  select new BeEstatus()
                    {
                        EstatusID = e.EstatusID,
                        Nombre    = e.Nombre
                    });
                }
                return(data);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #10
0
 public bool Create(BeTipoApresamientos item)
 {
     try
     {
         using (var db = new EstG2Contex())
         {
             var tn = new TipoApresamientos();
             tn.Nombre        = item.Nombre;
             tn.EstatusID     = (int)item.EstatusID;
             tn.UsuarioCreo   = "MJimenez";
             tn.TipoNovedadID = 9;
             tn.FechaCreo     = DateTime.Now;
             db.TipoApresamientos.Add(tn);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #11
0
        /// <summary>
        /// Create Tipo Droga
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Create(BeTipoDroga item)
        {
            try
            {
                using (var db = new EstG2Contex())
                {
                    var tn = new TipoDroga();
                    tn.Nombre      = item.Nombre;
                    tn.EstatusID   = (int)item.EstatusID;
                    tn.UsuarioCreo = "gbrito";
                    tn.FechaCreo   = DateTime.Now;
                    db.TipoDroga.Add(tn);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }