Exemple #1
0
        public int Guardar(CA_Areas areas)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (areas.Id_CA_Area > 0)
                    {
                        context.Entry(areas).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(areas).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #2
0
        public bool Exist(CA_Areas areas)
        {
            bool val = false;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    val = context.CA_Areas.Any(x => x.Nombre_Area.Equals(areas.Nombre_Area));
                }
            }
            catch (Exception ex) {
            }
            return(val);
        }
Exemple #3
0
        public CA_Areas ObtenerArea(int id)
        {
            CA_Areas area = new CA_Areas();

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    area = context.CA_Areas.Where(x => x.Id_CA_Area == id).SingleOrDefault();
                }
            }
            catch (Exception)
            {
            }
            return(area);
        }
        public IEnumerable <CA_Areas> ListAreas()
        {
            List <CA_Areas> list = new List <CA_Areas>();
            CA_Areas        item = new CA_Areas();

            item.Id_CA_Area  = -1;
            item.Nombre_Area = "* Área a la que se dirige el ticket";
            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    list = context.CA_Areas.OrderBy(x => x.Nombre_Area).ToList();
                    list.Add(item);
                }
            }
            catch (Exception ex)
            {
            }
            return(list);
        }
        public IEnumerable <CA_Areas> GetListAreas()
        {
            List <CA_Areas> list = new List <CA_Areas>();
            CA_Areas        item = new CA_Areas();

            item.Id_CA_Area  = -1;
            item.Nombre_Area = "* Selecciona el área a la que está destinado el manual";

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    list = context.CA_Areas.OrderBy(x => x.Nombre_Area).ToList();
                    list.Add(item);
                }
            }
            catch (Exception ex)
            {
            }
            return(list);
        }