Exemplo n.º 1
0
        public void AgregarRetrabajo(int idUnidad)
        {
            arz_detunidadretrabajo detunidadretrabajo = new arz_detunidadretrabajo();

            detunidadretrabajo.arz_unidades_Id   = idUnidad;
            detunidadretrabajo.arz_retrabajos_Id = 4;
            db.arz_detunidadretrabajo.Add(detunidadretrabajo);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public ActionResult ActualizarDetalle(int idProceso, int idUnidad, int retrabajo)
        {
            try
            {
                DateTime fechahora = DateTime.Now.AddHours(2);

                if (idProceso == 7)
                {
                    //Sin Retrabajos
                    arz_detunidadproceso inicioretrabajo = db.arz_detunidadproceso.Where(x => x.arz_proceso_Id == 3 && x.arz_unidades_Id == idUnidad).FirstOrDefault();
                    inicioretrabajo.CheckIn         = true;
                    inicioretrabajo.FechaHoraInicio = fechahora;

                    arz_detunidadproceso finretrabajo = db.arz_detunidadproceso.Where(x => x.arz_proceso_Id == 4 && x.arz_unidades_Id == idUnidad).FirstOrDefault();
                    finretrabajo.CheckIn         = true;
                    finretrabajo.FechaHoraInicio = fechahora;
                }
                else if (idProceso == 6)
                {
                    arz_unidades unidad = db.arz_unidades.Where(x => x.Id == idUnidad).FirstOrDefault();
                    unidad.arz_statusunidad_Id = 3;

                    arz_detunidadproceso detunidadproceso = db.arz_detunidadproceso.Where(x => x.arz_proceso_Id == idProceso && x.arz_unidades_Id == idUnidad).FirstOrDefault();
                    detunidadproceso.CheckIn         = true;
                    detunidadproceso.FechaHoraInicio = fechahora;
                }
                else
                {
                    arz_detunidadproceso detunidadproceso = db.arz_detunidadproceso.Where(x => x.arz_proceso_Id == idProceso && x.arz_unidades_Id == idUnidad).FirstOrDefault();
                    detunidadproceso.CheckIn         = true;
                    detunidadproceso.FechaHoraInicio = fechahora;

                    arz_unidades unidad = db.arz_unidades.Where(x => x.Id == idUnidad).FirstOrDefault();
                    unidad.arz_statusunidad_Id = 2;
                }

                if (retrabajo > 0)
                {
                    arz_detunidadretrabajo detunidadretrabajo = db.arz_detunidadretrabajo.Where(x => x.arz_unidades_Id == idUnidad).FirstOrDefault();
                    detunidadretrabajo.arz_retrabajos_Id = retrabajo;
                }

                db.SaveChanges();

                return(Json(new { respuesta = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { respuesta = false }, JsonRequestBehavior.AllowGet));
            }
        }