Ejemplo n.º 1
0
        public int InsertRequest(TrvReq req)
        {
            int val = 0;

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

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Ejemplo n.º 2
0
        public TrvReq GetRequest(int id = 0)
        {
            TrvReq req = new TrvReq();

            try
            {
                if (id == 0)
                {
                    req.IdTrvReq     = 0;
                    req.Id_Empresa   = -1;
                    req.IdTransporte = -1;
                    req.IdTrvTurno   = -1;
                    return(req);
                }
                else
                {
                    using (ClusmextContext context = new ClusmextContext())
                    {
                        req          = context.TrvReq.Include("TrvTransporte").Include("TrvTurno").Include("Empresas").Where(x => x.IdTrvReq == id).SingleOrDefault();
                        req.FPartida = req.FPartida.Date;
                        req.FRetorno = req.FRetorno.Date;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(req);
        }
Ejemplo n.º 3
0
        public int ChangeStatus(TrvReq ticket)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    context.Entry(ticket).State = EntityState.Modified;
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Ejemplo n.º 4
0
        public TrvReq GetRawRequest(int id)
        {
            TrvReq req = new TrvReq();

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    req          = context.TrvReq.Where(x => x.IdTrvReq == id).SingleOrDefault();
                    req.FPartida = req.FPartida.Date;
                    req.FRetorno = req.FRetorno.Date;
                }
            }
            catch (Exception ex)
            {
            }
            return(req);
        }