Ejemplo n.º 1
0
        //public void ActualuzarUltimaVersion(int Id, int Version)
        //{
        //    using (ASIS_PRODEntities entities = new ASIS_PRODEntities())
        //    {
        //        var poReporte = entities.REPORTE_MAESTRO.FirstOrDefault(x => x.IdReporteMaestro == Id);
        //        if (poReporte != null)
        //        {
        //            poReporte.UltimaVersion = Version;
        //            entities.SaveChanges();
        //        }
        //    }
        //}

        public void GuardarModificarReporteMaestroDetalle(REPORTE_DETALLE model)
        {
            using (ASIS_PRODEntities entities = new ASIS_PRODEntities())
            {
                var poReporte = entities.REPORTE_DETALLE.FirstOrDefault(x => x.IdReporteDetalle == model.IdReporteDetalle);
                if (poReporte != null)
                {
                    poReporte.Version = model.Version;
                    if (!string.IsNullOrEmpty(model.Imagen))
                    {
                        poReporte.Imagen = model.Imagen;
                    }
                    poReporte.Rotacion = model.Rotacion;

                    poReporte.TerminalModificacionLog = model.TerminalIngresoLog;
                    poReporte.UsuarioModificacionLog  = model.UsuarioIngresoLog;
                    poReporte.FechaModificacionLog    = model.FechaIngresoLog;
                }
                else
                {
                    entities.REPORTE_DETALLE.Add(model);
                }
                entities.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public void EliminarReporteMaestroDetalle(REPORTE_DETALLE model)
 {
     using (ASIS_PRODEntities entities = new ASIS_PRODEntities())
     {
         var poReporte = entities.REPORTE_DETALLE.FirstOrDefault(x => x.IdReporteDetalle == model.IdReporteDetalle);
         if (poReporte != null)
         {
             poReporte.EstadoRegistro          = clsAtributos.EstadoRegistroInactivo;
             poReporte.TerminalModificacionLog = model.TerminalIngresoLog;
             poReporte.UsuarioModificacionLog  = model.UsuarioIngresoLog;
             poReporte.FechaModificacionLog    = model.FechaIngresoLog;
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 3
0
        public ActionResult EliminarReporteDetalle(REPORTE_DETALLE model)
        {
            try
            {
                lsUsuario = User.Identity.Name.Split('_');
                if (string.IsNullOrEmpty(lsUsuario[0]))
                {
                    return(Json("101", JsonRequestBehavior.AllowGet));
                }
                clsDReporte              = new clsDReporte();
                model.EstadoRegistro     = clsAtributos.EstadoRegistroInactivo;
                model.FechaIngresoLog    = DateTime.Now;
                model.TerminalIngresoLog = Request.UserHostAddress;
                model.UsuarioIngresoLog  = lsUsuario[0];

                clsDReporte.EliminarReporteMaestroDetalle(model);
                return(Json("Registro Eliminado con Éxito", JsonRequestBehavior.AllowGet));
            }
            catch (DbEntityValidationException e)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                clsDError           = new clsDError();
                lsUsuario           = User.Identity.Name.Split('_');
                string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                        "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e);
                return(Json(Mensaje, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                clsDError           = new clsDError();
                lsUsuario           = User.Identity.Name.Split('_');
                string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                        "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null);
                return(Json(Mensaje, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 4
0
        public ActionResult ReporteDetalle(REPORTE_DETALLE model, HttpPostedFileBase dataImg, bool UltimaVersion = false)
        {
            try
            {
                lsUsuario = User.Identity.Name.Split('_');
                if (string.IsNullOrEmpty(lsUsuario[0]))
                {
                    return(Json("101", JsonRequestBehavior.AllowGet));
                }
                if (model.Version < 1 || model.IdReporteMaestro == 0)
                {
                    return(Json("0", JsonRequestBehavior.AllowGet));
                }
                string path      = string.Empty;
                string NombreImg = string.Empty;
                if (dataImg != null)
                {
                    path = Server.MapPath("~/ImagenSiaa/REPORTE/");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    var  date = DateTime.Now;
                    long n    = long.Parse(date.ToString("yyyyMMddHHmmss"));
                    var  ext2 = dataImg.FileName.Split('.');
                    var  cont = ext2.Length;
                    NombreImg    = "REPORTE/ReporteVersion" + n.ToString() + "." + ext2[cont - 1];
                    model.Imagen = NombreImg;
                }

                clsDReporte              = new clsDReporte();
                model.EstadoRegistro     = clsAtributos.EstadoRegistroActivo;
                model.FechaIngresoLog    = DateTime.Now;
                model.TerminalIngresoLog = Request.UserHostAddress;
                model.UsuarioIngresoLog  = lsUsuario[0];
                //if (UltimaVersion)
                //{
                //    clsDReporte.ActualuzarUltimaVersion(model.IdReporteMaestro, model.Version);
                //}
                //else
                //{
                //    clsDReporte.ActualuzarUltimaVersion(model.IdReporteMaestro, "");

                //}
                clsDReporte.GuardarModificarReporteMaestroDetalle(model);
                if (dataImg != null)
                {
                    dataImg.SaveAs(path + Path.GetFileName(NombreImg));
                }
                return(Json("Registro Exitoso", JsonRequestBehavior.AllowGet));
            }
            catch (DbEntityValidationException e)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                clsDError           = new clsDError();
                lsUsuario           = User.Identity.Name.Split('_');
                string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                        "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e);
                return(Json(Mensaje, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                clsDError           = new clsDError();
                lsUsuario           = User.Identity.Name.Split('_');
                string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                        "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null);
                return(Json(Mensaje, JsonRequestBehavior.AllowGet));
            }
        }