Example #1
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);
            }
        }
Example #2
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);
            }
        }
Example #3
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);
     }
 }
Example #4
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);
     }
 }
Example #5
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);
     }
 }
Example #6
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);
            }
        }