Exemple #1
0
        public int Insert(DateTime fechaEntrega, DateTime fechaSolicitud, int idSIM, int idGerente)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    SIMS_GERENTE sIMS_GERENTE = new SIMS_GERENTE();

                    sIMS_GERENTE.FECHA_ENTREGA   = fechaEntrega;
                    sIMS_GERENTE.FECHA_SOLICITUD = fechaSolicitud;
                    sIMS_GERENTE.ID_SIM          = idSIM;
                    sIMS_GERENTE.ID_GERENTE      = idGerente;

                    Conexion.SIMS_GERENTE.Add(sIMS_GERENTE);

                    Conexion.SaveChanges();

                    return(sIMS_GERENTE.ID_SIM_GERENTE);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Exemple #2
0
        public int Update(int id, string codigoNomina, string nombre, string entidad, bool activo, DateTime fechaInicio, DateTime fechaTermino, string cargo)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    Gerente gerente = Conexion.Gerente.Where(x => x.Id == id).FirstOrDefault();

                    gerente.CodigoNomina = codigoNomina;
                    gerente.Nombre       = nombre;
                    gerente.Cargo        = cargo;
                    gerente.Entidad      = entidad;
                    gerente.Activo       = activo;
                    gerente.FechaInicio  = fechaInicio;
                    gerente.FechaTermino = fechaTermino;

                    Conexion.Entry(gerente).State = EntityState.Modified;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Exemple #3
0
        public int Insert(string codigoNomina, string nombre, string entidad, bool activo, DateTime fechaInicio, DateTime fechaTermino, string cargo)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    Gerente gerente = new Gerente();

                    gerente.CodigoNomina = codigoNomina;
                    gerente.Nombre       = nombre;
                    gerente.Cargo        = cargo;
                    gerente.Entidad      = entidad;
                    gerente.Activo       = activo;
                    gerente.FechaInicio  = fechaInicio;

                    if (fechaTermino != DateTime.MinValue)
                    {
                        gerente.FechaTermino = fechaTermino;
                    }

                    Conexion.Gerente.Add(gerente);

                    Conexion.SaveChanges();

                    return(gerente.Id);
                }
            }
            catch (System.Exception er)
            {
                return(0);
            }
        }
Exemple #4
0
 public IList GetAllGerente()
 {
     try
     {
         using (var Conexion = new EntitiesMKT())
         {
             var ListaGerentes = (from a in Conexion.Gerente
                                  select a).ToList();
             return(ListaGerentes);
         }
     }
     catch (Exception er)
     {
         throw;
     }
 }
Exemple #5
0
        public IList GetGerente(int idGerente)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    var lista = (from a in Conexion.Gerente
                                 where a.Id == idGerente
                                 select a).ToList();

                    return(lista);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #6
0
        public IList GetGerente(string codigoNomina)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    var lista = (from a in Conexion.Gerente
                                 where a.CodigoNomina == codigoNomina
                                 select a).ToList();

                    return(lista);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #7
0
        public int Delete(int id)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    Gerente gerente = Conexion.Gerente.Where(x => x.Id == id).FirstOrDefault();

                    Conexion.Entry(gerente).State = EntityState.Deleted;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception er)
            {
                return(0);
            }
        }
Exemple #8
0
        public int Insert(int idOperador, string sim)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    SIMS sIMS = new SIMS();

                    sIMS.ID_OPERADOR = idOperador;
                    sIMS.SIM         = sim;

                    Conexion.SIMS.Add(sIMS);

                    Conexion.SaveChanges();

                    return(sIMS.ID_SIMS);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Exemple #9
0
        public int Update(DateTime fechaEntrega, DateTime fechaSolicitud, int idSIM, int idGerente, int idSIMGerente)
        {
            try
            {
                using (var Conexion = new EntitiesMKT())
                {
                    SIMS_GERENTE sIMS_GERENTE = Conexion.SIMS_GERENTE.Where(x => x.ID_SIM_GERENTE == idSIMGerente).FirstOrDefault();

                    sIMS_GERENTE.FECHA_ENTREGA   = fechaEntrega;
                    sIMS_GERENTE.FECHA_SOLICITUD = fechaSolicitud;
                    sIMS_GERENTE.ID_SIM          = idSIM;
                    sIMS_GERENTE.ID_GERENTE      = idGerente;

                    Conexion.Entry(sIMS_GERENTE).State = EntityState.Modified;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }