Exemplo n.º 1
0
        public int InsertConcepto(TrvRepConceptos concepto)
        {
            int val = 0;

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

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemplo n.º 2
0
        public TrvRepConceptos GetConceptos(int travelId = 0)
        {
            TrvRepConceptos c = new TrvRepConceptos();

            try
            {
                if (travelId == 0)
                {
                    c.Id_Moneda = 1;
                    c.IdTrvReq  = -1;
                    return(c);
                }
                else
                {
                    using (ClusmextContext context = new ClusmextContext())
                    {
                        c = context.TrvRepConceptos.Where(x => x.IdTrvReq == travelId).SingleOrDefault();
                        if (c == null)
                        {
                            c = new TrvRepConceptos();
                            c.IdTrvConceptos = -1;
                            c.Monto          = 0;
                            c.Creadopor      = -1;
                            c.Id_Moneda      = 1;
                            c.IdTrvReq       = -1;
                            return(c);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(c);
        }
Exemplo n.º 3
0
        public TrvRepConceptos GetConcepto(int ID)
        {
            TrvRepConceptos c = new TrvRepConceptos();

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    c = context.TrvRepConceptos.Include("Ca_Moneda").Where(x => x.IdTrvRepConceptos == ID).SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
            }
            return(c);
        }
Exemplo n.º 4
0
        public int DeleteConcepto(TrvRepConceptos concepto)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    context.Entry(concepto).State = EntityState.Deleted;
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }