Пример #1
0
 public async Task Create(BitacoraITFSolicitudDescarga model)
 {
     try
     {
         _db.dbSetBitacoraITFSolicitudDescarga.Add(model);
         await _db.SaveChangesAsync();
     }catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
 public async Task CreateSolicitudAccesoITF(SolicitudAccesoITF model)
 {
     try
     {
         _db.dbSetSolicitudAccesoITF.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
 public async Task Create(AutorSoftware model)
 {
     try
     {
         _db.dbSetAutorSoftware.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #4
0
 public async Task Create(TipoCurso model)
 {
     try
     {
         _db.dbSetCAT_TipoCurso.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #5
0
 public async Task Create(ProyFuturo model)
 {
     try
     {
         _db.dbSetProyFuturos.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #6
0
 public async Task Create(Resultados model)
 {
     try
     {
         _db.dbSetResultados.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #7
0
 public async Task Create(AdjuntoITFInsumo model)
 {
     try
     {
         _db.dbSetAdjuntoITFInsumos.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
 public async Task Create(CalificacionPersonal model)
 {
     try
     {
         _db.dbSetCAT_CalificacionPersonal.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #9
0
 public async Task Create(EstadoSolicitud model)
 {
     try
     {
         _db.dbSetCAT_EstadoSolicitud.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #10
0
 public async Task Create(SatisCte model)
 {
     try
     {
         _db.dbSetSatisCtes.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
 public async Task Create(InformeBecario model)
 {
     try
     {
         _db.dbSetInformeBecario.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
        //public async Task<IEnumerable<EditoresCapitulo>> GetAllColaboracion(string clave)
        //{
        //    try
        //    {
        //        var result = await _ctx.dbSetEditoresCapitulo.Where(e => e.ClavePersona == clave).AsNoTracking()
        //                                         .ToListAsync();
        //        return result;
        //    }
        //    catch (Exception e)
        //    {
        //        throw new Exception(e.Message, e);
        //    }
        //}

        public async Task <EditoresCapitulo> Create(EditoresCapitulo Obj)
        {
            try
            {
                var result = _ctx.dbSetEditoresCapitulo.Add(Obj);
                await _ctx.SaveChangesAsync();

                return(result);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Пример #13
0
        public async Task <Boolean> CreateAllSeg(List <AdjuntoITF> lista)
        {
            try
            {
                foreach (var model in lista)
                {
                    try
                    {
                        _db.dbSetAdjuntosITF.Add(model);
                        await _db.SaveChangesAsync();
                    }
                    catch (Exception e)
                    {
                        _db = new MT_Context();
                    }
                }
                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                //throw new Exception(e.Message, e);
                return(false);
            }
        }
        public async Task Update(SoftwarePersonal model)
        {
            try
            {
                model.TipoAccesoCat = null;
                model.TipoSoftware  = null;
                var _model = await _db.dbSetSoftwarePersonal.Where(x => x.SoftwarePersonalId == model.SoftwarePersonalId).FirstOrDefaultAsync();

                try
                {
                    if (model.ManualUsuario == null)
                    {
                        if (_model.ManualUsuario != null)
                        {
                            var id = _model.ManualUsuario;
                            _model.ManualUsuario = null;
                            await _db.SaveChangesAsync();

                            await new AdjuntoRepository().Delete(id);
                        }
                        var idManuUsuario = await CreateAdjuntoSwMT(model.AdjuntoManualUsuario);

                        model.ManualUsuario = idManuUsuario;
                    }
                    else
                    {
                        _db.dbSetAdjuntoOfMT.Attach(model.AdjuntoManualUsuario);
                        _db.Entry(model.AdjuntoManualUsuario).State = EntityState.Modified;
                        await _db.SaveChangesAsync();
                    }
                }
                catch (Exception ex) {
                    _db = new MT_Context();
                }
                try
                {
                    if (model.ManualTecnico == null)
                    {
                        if (_model.ManualTecnico != null)
                        {
                            var id = _model.ManualTecnico;
                            _model.ManualTecnico = null;
                            await _db.SaveChangesAsync();

                            await new AdjuntoRepository().Delete(id);
                        }
                        var idManuTecnico = await CreateAdjuntoSwMT(model.AdjuntoManualTecnico);

                        model.ManualTecnico = idManuTecnico;
                    }
                    else
                    {
                        _db.dbSetAdjuntoOfMT.Attach(model.AdjuntoManualTecnico);
                        _db.Entry(model.AdjuntoManualTecnico).State = EntityState.Modified;
                        await _db.SaveChangesAsync();
                    }
                }
                catch (Exception ex) { _db = new MT_Context(); }
                try
                {
                    if (model.CodigoFuente == null)
                    {
                        if (_model.CodigoFuente != null)
                        {
                            var id = _model.CodigoFuente;
                            _model.CodigoFuente = null;
                            await _db.SaveChangesAsync();

                            await new AdjuntoRepository().Delete(id);
                        }
                        var idcodFuente = await CreateAdjuntoSwMT(model.AdjuntoCodigoFuente);

                        model.CodigoFuente = idcodFuente;
                    }
                    else
                    {
                        _db.dbSetAdjuntoOfMT.Attach(model.AdjuntoCodigoFuente);
                        _db.Entry(model.AdjuntoCodigoFuente).State = EntityState.Modified;
                        await _db.SaveChangesAsync();
                    }
                }
                catch (Exception ex) { _db = new MT_Context(); }

                foreach (var a in model.Autores)
                {
                    if (a.AutorSoftwareId < 1)
                    {
                        try
                        {
                            a.SoftwarePersonalId = model.SoftwarePersonalId;
                            _db.dbSetAutorSoftware.Add(a);
                            await _db.SaveChangesAsync();
                        }
                        catch (Exception ex1)
                        {
                            _db = new MT_Context();
                        }
                    }
                }


                if (model != null)
                {
                    _db.dbSetSoftwarePersonal.Attach(_model);
                    _db.Entry(model).State = EntityState.Detached;
                    _db.Entry(_model).CurrentValues.SetValues(model);

                    //_db.Entry(_model).State = EntityState.Detached;
                    //_db.dbSetSoftwarePersonal.Attach(model);
                    //_db.Entry(model).State = EntityState.Modified;

                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Пример #15
0
        public async Task <Capitulos> Create(Capitulos model)
        {
            try
            {
                var result = _db.dbSetCapitulos.Add(model);
                await _db.SaveChangesAsync();

                return(result);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }