Esempio n. 1
0
        /// <summary>
        /// Retorna un LISTA de registros de la Entidad Presupuesto.Gasto
        /// En la BASE de DATO la Tabla : [Presupuesto.Gasto]
        /// <summary>
		/// <param name="pFiltro"></param>
		/// <returns></returns>
		public List<GastoEntity> Listar(Parametro pFiltro)
        {
            List<GastoEntity> lstGastoEntity = new List<GastoEntity>();
            try
            {
                using (_DBMLPresupuestoDataContext SQLDC = new _DBMLPresupuestoDataContext(conexion))
                {
                    var resul = SQLDC.pa_S_Gasto(pFiltro.codGasto, 
                                                 pFiltro.codPlantillaDeta,
                                                 pFiltro.codArea, 
                                                 pFiltro.numAnio);
                    foreach (var item in resul)
                    {
                        GastoEntity objGastoEntity = new GastoEntity();
                        objGastoEntity.Codigo = item.codGasto;
                        objGastoEntity.codPlantillaDeta = item.codPlantillaDeta;
                        objGastoEntity.monTotal = item.monTotal;
                        objGastoEntity.cntCantidad = item.cntCantidad;
                        objGastoEntity.numDocumento = item.numDocumento;
                        objGastoEntity.gloObservacion = item.gloObservacion;
                        objGastoEntity.fecGasto = item.fecGasto;
                        objGastoEntity.codEmpleadoResp = item.codEmpleadoResp;
                        objGastoEntity.objEmpleadoResp.desNombre = item.codEmpleadoRespNombre;
                        objGastoEntity.segUsuarioEdita = item.segUsuarioEdita;
                        objGastoEntity.segFechaEdita = item.segFechaCrea;
                        objGastoEntity.segUsuarioEdita = item.segUsuarioEdita;
                        objGastoEntity.segFechaEdita = item.segFechaCrea;
                        objGastoEntity.segMaquinaOrigen = item.segMaquinaOrigen;
                        objGastoEntity.objEmpleadoResp.codArea = item.codArea.HasValue ? item.codArea.Value : 0;
                        objGastoEntity.objEmpleadoResp.objArea.desNombre = item.codAreaNombre;
                        objGastoEntity.objPlantillaDeta.objPlantilla.codPresupuesto = item.codPresupuesto.HasValue ? item.codPresupuesto.Value : 0;
                        objGastoEntity.objPlantillaDeta.objPlantilla.objPresupuesto.desNombre = item.codPresupuestoNombre;

                        lstGastoEntity.Add(objGastoEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(String.Concat("Listar", " | ", ex.Message.ToString()));
                throw ex;
            }
            return lstGastoEntity;
        }
Esempio n. 2
0
 public ReturnValor RegistrarGasto(GastoEntity objPlantillaDetaEntity)
 {
     try
     {
         //using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
         //{
         oGastoData = new GastoData();
         oReturnValor.Exitosa = oGastoData.Registrar(objPlantillaDetaEntity);
         if (oReturnValor.Exitosa)
         {
             oReturnValor.Message = HelpMessages.Evento_NEW;
             //tx.Complete();
         }
         //}
     }
     catch (Exception ex)
     {
         oReturnValor = HelpException.mTraerMensaje(ex);
     }
     return oReturnValor;
 }
        public ActionResult GuardarGasto(GastoEntity pGasto)
        {
            string tipoDevol = null;
            object DataDevol = null;
            object jsonResponse;
            try
            {
                objGastoLogic = new GastoLogic();
                pGasto.segUsuarioEdita = HttpContext.User.Identity.Name;
                pGasto.segUsuarioCrea = HttpContext.User.Identity.Name;
                pGasto.segMaquinaOrigen = GetIPAddress();
                if (pGasto.Codigo != 0)
                    returnValor = objGastoLogic.ActualizarGasto(pGasto);
                else
                    returnValor = objGastoLogic.RegistrarGasto(pGasto);

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

            }
            catch (Exception ex)
            {
                tipoDevol = "E";
                log.Error(String.Concat("GuardarGasto", " | ", ex.Message));
                DataDevol = ex.Message;
            }
            finally
            {
                jsonResponse = new
                {
                    Type = tipoDevol,
                    Data = DataDevol,
                };
            }
            return Json(jsonResponse, JsonRequestBehavior.AllowGet);
        }
 private GastoEntity InicializarGasto(GastoEntity registro)
 {
     registro = new GastoEntity();
     registro.segUsuarioEdita = User.Identity.Name;
     registro.fecGasto = DateTime.Now;
     registro.segFechaEdita = DateTime.Now;
     return registro;
 }
Esempio n. 5
0
		/// <summary>
		/// Almacena el registro de una ENTIDAD de registro de Tipo Gasto
		/// En la BASE de DATO la Tabla : [Presupuesto.Gasto]
		/// <summary>
		/// <param name = >itemGasto</param>
        public bool Actualizar(GastoEntity itemGasto)
        {
            int codigoRetorno = -1;
            try
            {
                using (_DBMLPresupuestoDataContext SQLDC = new _DBMLPresupuestoDataContext(conexion))
                {
                    SQLDC.pa_U_Gasto(
                        itemGasto.Codigo,
                        itemGasto.monTotal,
                        itemGasto.cntCantidad,
                        itemGasto.numDocumento,
                        itemGasto.gloObservacion,
                        itemGasto.fecGasto,
                        itemGasto.codEmpleadoResp,
                        itemGasto.segUsuarioEdita,
                        itemGasto.segMaquinaOrigen);
                    codigoRetorno = 0;
                }
            }
            catch (Exception ex)
            {
                log.Error(String.Concat("Actualizar", " | ", ex.Message.ToString()));
                throw ex;
            }
            return codigoRetorno == 0 ? true : false;
        }
Esempio n. 6
0
		/// <summary>
		/// Almacena el registro de una ENTIDAD de registro de Tipo Gasto
		/// En la BASE de DATO la Tabla : [Presupuesto.Gasto]
		/// <summary>
		/// <param name = >itemGasto</param>
		public bool Registrar( GastoEntity pGasto )
		{
			int? codigoRetorno = -1;
			try
			{
				using (_DBMLPresupuestoDataContext SQLDC = new _DBMLPresupuestoDataContext(conexion))
				{
					 SQLDC.pa_I_Gasto(
						ref codigoRetorno,
						pGasto.codPlantillaDeta,
						pGasto.monTotal,
						pGasto.cntCantidad,
						pGasto.numDocumento,
						pGasto.gloObservacion,
						pGasto.fecGasto,
						pGasto.codEmpleadoResp,
						pGasto.segUsuarioCrea,
						pGasto.segMaquinaOrigen);
				}
			}
			catch (Exception ex)
			{
                log.Error(String.Concat("Registrar", " | ", ex.Message.ToString()));
                throw ex;
			}
			return codigoRetorno > 0 ? true : false;
		}
Esempio n. 7
0
        /// <summary>
        /// Retorna una ENTIDAD de registro de la Entidad Presupuesto.Gasto
        /// En la BASE de DATO la Tabla : [Presupuesto.Gasto]
        /// <summary>
		/// <param name="pcodGasto"></param>
		/// <returns></returns>
		public GastoEntity Buscar(int pcodGasto)
		{
            GastoEntity objGastoEntity = null;
            try
            {
                using (_DBMLPresupuestoDataContext SQLDC = new _DBMLPresupuestoDataContext(conexion))
                {
                    var resul = SQLDC.pa_S_Gasto(pcodGasto, null, null, null);
                    foreach (var item in resul)
                    {
                        objGastoEntity = new GastoEntity();
                        objGastoEntity.Codigo = item.codGasto;
                        objGastoEntity.codPlantillaDeta = item.codPlantillaDeta;
                        objGastoEntity.monTotal = item.monTotal;
                        objGastoEntity.cntCantidad = item.cntCantidad;
                        objGastoEntity.numDocumento = item.numDocumento;
                        objGastoEntity.gloObservacion = item.gloObservacion;
                        objGastoEntity.fecGasto = item.fecGasto;
                        objGastoEntity.codEmpleadoResp = item.codEmpleadoResp;
                        objGastoEntity.objEmpleadoResp.desNombre = item.codEmpleadoRespNombre;
                        objGastoEntity.segUsuarioEdita = item.segUsuarioEdita;
                        objGastoEntity.segFechaEdita = item.segFechaCrea;
                        objGastoEntity.segUsuarioEdita = item.segUsuarioEdita;
                        objGastoEntity.segFechaEdita = item.segFechaCrea;
                        objGastoEntity.segMaquinaOrigen = item.segMaquinaOrigen;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(String.Concat("Buscar", " | ", ex.Message.ToString()));
                throw ex;
            }
		return objGastoEntity;
}