Пример #1
0
 public CC_CUCHILLOS_PREPARACION_CTRL ConsultarCabecera(DateTime fecha, int idControlCuchillo, int turno)
 {
     using (ASIS_PRODEntities db = new ASIS_PRODEntities())
     {
         CC_CUCHILLOS_PREPARACION_CTRL lista;
         if (idControlCuchillo == 0)
         {
             lista = db.CC_CUCHILLOS_PREPARACION_CTRL.FirstOrDefault(x => x.Fecha.Year == fecha.Year && x.Fecha.Month == fecha.Month && x.Fecha.Day == fecha.Day && x.EstadoRegistro == clsAtributos.EstadoRegistroActivo && x.Turno == turno);
         }
         else
         {
             lista = db.CC_CUCHILLOS_PREPARACION_CTRL.FirstOrDefault(x => x.IdControlCuchillo == idControlCuchillo && x.EstadoRegistro == clsAtributos.EstadoRegistroActivo);
         }
         CC_CUCHILLOS_PREPARACION_CTRL cabecera = new CC_CUCHILLOS_PREPARACION_CTRL();
         if (lista != null)
         {
             cabecera.IdControlCuchillo = lista.IdControlCuchillo;
             cabecera.Fecha             = lista.Fecha;
             cabecera.EstadoReporte     = lista.EstadoReporte;
             cabecera.Observacion       = lista.Observacion;
             cabecera.AprobadoPor       = lista.AprobadoPor;
             cabecera.FechaAprobado     = lista.FechaAprobado;
             return(cabecera);
         }
         return(lista);
     }
 }
Пример #2
0
 public int EliminarControlCuchilloPreparacion(CC_CUCHILLOS_PREPARACION_CTRL Eliminar)
 {
     using (ASIS_PRODEntities db = new ASIS_PRODEntities())
     {
         var model = db.CC_CUCHILLOS_PREPARACION_CTRL.FirstOrDefault(x => x.IdControlCuchillo == Eliminar.IdControlCuchillo);
         if (model != null)
         {
             model.EstadoRegistro          = clsAtributos.EstadoRegistroInactivo;
             model.FechaModificacionLog    = Eliminar.FechaModificacionLog;
             model.TerminalModificacionLog = Eliminar.TerminalModificacionLog;
             model.UsuarioModificacionLog  = Eliminar.UsuarioModificacionLog;
             db.SaveChanges();
             return(1);
         }
         return(0);
     }
 }
Пример #3
0
        //-----------------------------------------CONTROL CUCHILLO----------------------------------------------------------------------------
        public int GuardarModificarControlCuchilloPreparacion(CC_CUCHILLOS_PREPARACION_CTRL GuardarModigicar, bool siAprobar)
        {
            int valor = 0;

            using (ASIS_PRODEntities db = new ASIS_PRODEntities())
            {
                var validarNombreRepetido = db.CC_CUCHILLOS_PREPARACION_CTRL.FirstOrDefault(x => x.Fecha.Day == GuardarModigicar.Fecha.Day && x.Fecha.Month == GuardarModigicar.Fecha.Month && x.Fecha.Year == GuardarModigicar.Fecha.Year &&
                                                                                            x.Turno == GuardarModigicar.Turno && x.EstadoRegistro == clsAtributos.EstadoRegistroActivo);
                if (!siAprobar && validarNombreRepetido != null && GuardarModigicar.IdControlCuchillo != validarNombreRepetido.IdControlCuchillo)
                {
                    valor = 4;
                    return(valor);
                }

                var model = db.CC_CUCHILLOS_PREPARACION_CTRL.FirstOrDefault(x => x.IdControlCuchillo == GuardarModigicar.IdControlCuchillo && x.EstadoRegistro == GuardarModigicar.EstadoRegistro);
                if (model != null)
                {
                    if (siAprobar)
                    {
                        model.AprobadoPor   = GuardarModigicar.UsuarioIngresoLog;
                        model.FechaAprobado = GuardarModigicar.FechaAprobado;
                        model.EstadoReporte = GuardarModigicar.EstadoReporte;
                        valor = 2;
                    }
                    else
                    {
                        model.Turno       = GuardarModigicar.Turno;
                        model.Fecha       = GuardarModigicar.Fecha;
                        model.Observacion = GuardarModigicar.Observacion;
                        valor             = 1;
                    }
                    model.FechaModificacionLog    = GuardarModigicar.FechaIngresoLog;
                    model.TerminalModificacionLog = GuardarModigicar.TerminalIngresoLog;
                    model.UsuarioModificacionLog  = GuardarModigicar.UsuarioIngresoLog;
                }
                else
                {
                    db.CC_CUCHILLOS_PREPARACION_CTRL.Add(GuardarModigicar);
                }
                db.SaveChanges();
                return(valor);
            }
        }
Пример #4
0
 public List <CC_CUCHILLOS_PREPARACION_CTRL> ConsultarcabeceraFechaID(DateTime fechaDesde, DateTime fechaHasta, bool estado, int op = 0)
 {
     using (ASIS_PRODEntities db = new ASIS_PRODEntities())
     {
         var lista = (from c in db.CC_CUCHILLOS_PREPARACION_CTRL
                      where (c.Fecha >= fechaDesde && c.Fecha <= fechaHasta && c.EstadoRegistro == clsAtributos.EstadoRegistroActivo && c.EstadoReporte == estado)
                      orderby c.Fecha descending
                      select new { c.IdControlCuchillo, c.Fecha, c.EstadoReporte, c.Observacion, c.FechaIngresoLog, c.UsuarioIngresoLog, c.FechaAprobado, c.AprobadoPor, c.Turno }).OrderByDescending(x => x.Fecha).ToList();
         if (op == 1)
         {
             lista = (from c in db.CC_CUCHILLOS_PREPARACION_CTRL
                      where (c.Fecha >= fechaDesde && c.Fecha <= fechaHasta && c.EstadoRegistro == clsAtributos.EstadoRegistroActivo)
                      orderby c.Fecha descending
                      select new { c.IdControlCuchillo, c.Fecha, c.EstadoReporte, c.Observacion, c.FechaIngresoLog, c.UsuarioIngresoLog, c.FechaAprobado, c.AprobadoPor, c.Turno }).OrderByDescending(x => x.Fecha).ToList();
         }
         if (op == 2)
         {
             lista = (from c in db.CC_CUCHILLOS_PREPARACION_CTRL
                      where (c.EstadoReporte == clsAtributos.EstadoReportePendiente && c.EstadoRegistro == clsAtributos.EstadoRegistroActivo)
                      orderby c.Fecha descending
                      select new { c.IdControlCuchillo, c.Fecha, c.EstadoReporte, c.Observacion, c.FechaIngresoLog, c.UsuarioIngresoLog, c.FechaAprobado, c.AprobadoPor, c.Turno }).OrderByDescending(x => x.Fecha).ToList();
         }
         List <CC_CUCHILLOS_PREPARACION_CTRL> listacabecera = new List <CC_CUCHILLOS_PREPARACION_CTRL>();
         CC_CUCHILLOS_PREPARACION_CTRL        cabecera;
         foreach (var item in lista)
         {
             cabecera = new CC_CUCHILLOS_PREPARACION_CTRL();
             cabecera.IdControlCuchillo = item.IdControlCuchillo;
             cabecera.Fecha             = item.Fecha;
             cabecera.EstadoReporte     = item.EstadoReporte;
             cabecera.Observacion       = item.Observacion;
             cabecera.FechaIngresoLog   = item.FechaIngresoLog;
             cabecera.UsuarioIngresoLog = item.UsuarioIngresoLog;
             cabecera.FechaAprobado     = item.FechaAprobado;
             cabecera.AprobadoPor       = item.AprobadoPor;
             cabecera.Turno             = item.Turno;
             listacabecera.Add(cabecera);
         }
         return(listacabecera);
     }
 }