Ejemplo n.º 1
0
        public ActionResult BuscarPlantilla(int pID)
        {
            string tipoDevol = null;
            object DataDevol = null;

            object jsonResponse;
            try
            {
                objPlantillaLogic = new PlantillaLogic();
                var registro = objPlantillaLogic.BuscarPlantilla((DateTime.Now.Year) + 1, pID);

                tipoDevol = "C";
                DataDevol = registro;
            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("BuscarPlantilla", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse);
        }
Ejemplo n.º 2
0
 protected object ListarPartidas()
 {
     PlantillaLogic objPlantillaLogic = new PlantillaLogic();
     IEnumerable<PartidaEntity> lstPartidas;
     lstPartidas = objPlantillaLogic.ListarPartida();
     object lstParaCombos = from item in lstPartidas
                            select new
                            {
                                value = item.Codigo,
                                text = item.desNombre
                            };
     return lstParaCombos;
 }
Ejemplo n.º 3
0
 protected SelectList ListarPresupuestosAnios()
 {
     PlantillaLogic objPlantillaLogic = new PlantillaLogic();
     List<PresupuestoEntity> lstPresupuestoEntity = new List<PresupuestoEntity>();
     lstPresupuestoEntity = objPlantillaLogic.ListarPresupuesto(null);
     List<PresupuestoEntity> lstPresupuestoEntitySelec = new List<PresupuestoEntity>();
     foreach (PresupuestoEntity item in lstPresupuestoEntity)
     {
         if (item.numAnio <= (DateTime.Now.Year))
             lstPresupuestoEntitySelec.Add(item);
     }
     SelectList lstParaCombos = new SelectList(lstPresupuestoEntitySelec, "numAnio", "desNombre");
     return lstParaCombos;
 }
Ejemplo n.º 4
0
        public ActionResult PlantillaTerminarIngreso(int pID)
        {
            string tipoDevol = null;
            object DataDevol = null;
            object jsonResponse;
            try
            {
                objPlantillaLogic = new PlantillaLogic();
                PlantillaEntity objPlantillaEntity = new PlantillaEntity
                {
                    Codigo = pID,
                    segUsuarioEdita = HttpContext.User.Identity.Name,
                    segUsuarioCrea = HttpContext.User.Identity.Name,
                    segMaquinaOrigen = GetIPAddress(),
                    codRegEstado = Convert.ToInt32(HelpRegEstado.Plantilla.TERMINADA_INGRESO)
                };
                returnValor = objPlantillaLogic.ActualizarPlantillaEstado(objPlantillaEntity);

                DataDevol = returnValor.Message;
                tipoDevol = returnValor.Exitosa ? "C" : "I";

            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("PlantillaTerminarIngreso", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 5
0
 public ActionResult BuscarPresupuesto(int pID)
 {
     string tipoDevol = null;
     object DataDevol = null;
     object jsonResponse;
     try
     {
         objPlantillaLogic = new PlantillaLogic();
         var registro = objPlantillaLogic.BuscarPresupuesto(pID);
         tipoDevol = "C";
         DataDevol = registro;
     }
     catch (Exception ex)
     {
         tipoDevol = "E";
         DataDevol = ex.Message;
     }
     finally
     {
         jsonResponse = new
         {
             Type = tipoDevol,
             Data = DataDevol,
         };
     }
     return Json(jsonResponse);
 }
Ejemplo n.º 6
0
        public ActionResult GuardarPlantillaDetallePorRefer(List<PlantillaDetaEntity> lstPlantillaDeta)
        {
            string tipoDevol = null;
            object DataDevol = null;
            object jsonResponse;
            try
            {
                foreach (PlantillaDetaEntity detalle in lstPlantillaDeta)
                {
                    detalle.segMaquinaOrigen = GetIPAddress();
                    detalle.segUsuarioCrea = User.Identity.Name;
                    detalle.segUsuarioEdita = User.Identity.Name;
                }
                objPlantillaLogic = new PlantillaLogic();
                returnValor = objPlantillaLogic.RegistrarPlantillaDetaPorReferencia(lstPlantillaDeta);

                DataDevol = returnValor.Message;
                tipoDevol = returnValor.Exitosa ? "C" : "I";
            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("GuardarPlantillaDetallePorRefer", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol
                };
            }
            return Json(jsonResponse);
        }
Ejemplo n.º 7
0
 public ActionResult EliminarPlantillaDetalle(int pID)
 {
     string tipoDevol = null;
     object DataDevol = null;
     object jsonResponse;
     try
     {
         objPlantillaLogic = new PlantillaLogic();
         Parametro objParametro = new Parametro
         {
             codPlantillaDeta = pID,
             segUsuElimina = User.Identity.Name,
             segMaquinaPC = GetIPAddress()
         };
         /*Borra el registro de la tabla*/
         returnValor = objPlantillaLogic.EliminarPlantillaDeta(objParametro);
         DataDevol = returnValor.Message;
         tipoDevol = returnValor.Exitosa ? "C" : "I";
     }
     catch (Exception ex)
     {
         tipoDevol = "E";
         log.Error(String.Concat("EliminarPlantillaDetalle", " | ", ex.Message));
         DataDevol = ex.Message;
     }
     finally
     {
         jsonResponse = new
         {
             Type = tipoDevol,
             Data = DataDevol,
         };
     }
     return Json(jsonResponse, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 8
0
        public ActionResult GuardarPlantillaDetalle(PlantillaDetaEntity pPlantillaDeta)
        {
            string tipoDevol = null;
            object DataDevol = null;
            object jsonResponse;
            try
            {
                objPlantillaLogic = new PlantillaLogic();
                pPlantillaDeta.segUsuarioEdita = HttpContext.User.Identity.Name;
                pPlantillaDeta.segUsuarioCrea = HttpContext.User.Identity.Name;
                pPlantillaDeta.segMaquinaOrigen = GetIPAddress();
                if (pPlantillaDeta.Codigo != 0)
                    returnValor = objPlantillaLogic.ActualizarPlantillaDeta(pPlantillaDeta);
                else
                    returnValor = objPlantillaLogic.RegistrarPlantillaDeta(pPlantillaDeta);

                DataDevol = returnValor.Message;
                tipoDevol = returnValor.Exitosa ? "C" : "I";

            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("GuardarPlantillaDetalle", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 9
0
        public ActionResult BuscarPlantillaDetalle(int pID)
        {
            string tipoDevol = null;
            object DataDevol = null;
            object partidas = null;
            object jsonResponse;
            try
            {
                objPlantillaLogic = new PlantillaLogic();
                var registro = objPlantillaLogic.BuscarPlantillaDetalle(pID);
                if (registro == null)
                    registro = InicializarPlantillaDeta(registro);
                registro.indPlantilla = string.IsNullOrEmpty(registro.indPlantilla) ? "1" : registro.indPlantilla;
                partidas = ListarPartidas();

                tipoDevol = "C";
                DataDevol = registro;
            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("BuscarPlantillaDetalle", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Partidas = partidas,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse);
        }
Ejemplo n.º 10
0
        public ActionResult ListarPlantillaDetalleAntes(Parametro parametro)
        {
            string tipoDevol = null;
            object DataDevol = null;

            object jsonResponse;
            try
            {
                objPlantillaLogic = new PlantillaLogic();
                var lista = objPlantillaLogic.ListarPlantillaDetallePaginado(new Parametro
                {
                    p_NumPagina = parametro.p_NumPagina,
                    p_TamPagina = parametro.p_TamPagina,
                    p_OrdenPor = parametro.p_OrdenPor,
                    p_OrdenTipo = parametro.p_OrdenTipo,

                    numAnio = parametro.numAnio,
                    codArea = parametro.codArea,
                });
                long totalRecords = lista.Select(x => x.TOTALROWS).FirstOrDefault();
                int totalPages = (int)Math.Ceiling((float)totalRecords / (float)parametro.p_TamPagina);

                var jsonGrid = new
                {
                    PageCount = totalPages,
                    CurrentPage = parametro.p_NumPagina,
                    RecordCount = totalRecords,
                    Items = (
                        from item in lista
                        select new
                        {
                            ID = item.Codigo,
                            Row = new string[] {"","",""
                                              , item.objPlantilla.objArea.desNombre
                                              , item.objPartida.desNombre
                                              , item.gloDescripcion
                                              , item.cntCantidad.ToString("N2")
                                              , item.monEstimado.ToString("N2")
                                              , item.fecEjecucion.HasValue ? item.fecEjecucion.Value.ToShortDateString() : string.Empty
                                              , item.codRegEstadoNombre
                                              , item.indPlantilla
                                              , item.segFechaEdita.HasValue ? item.segFechaEdita.Value.ToString() : item.segFechaCrea.ToString()
                                              , string.IsNullOrEmpty(item.segUsuarioEdita) ? item.segUsuarioCrea : item.segUsuarioEdita
                            }
                        }).ToArray()
                };

                tipoDevol = "C";
                DataDevol = jsonGrid;
            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("ListarPlantillaDetalleAntes", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse);
        }