private static void ValidoDatos(FechaMensual desde, FechaMensual hasta) { //Me fijo si la fecha desde es menos q la fecha hasta y las fechas tengas meses validos if (desde.esMensualNulo()) { throw new NoValida("Fecha desde invalida"); } if (hasta.esMensualNulo()) { throw new NoValida("Fecha hasta invalida"); } if ((!desde.esMenorQue(hasta))) { throw new NoValida("Rango de mensuales incorrecto"); } }
public static DataSet BuscoNovedadesPorFechas(long idPrestador, int mensual) { Settings objCnn = new Settings(); SqlConnection objCon = new SqlConnection(); SqlParameter[] objPar = new SqlParameter[2]; DataSet novedades = new DataSet(); FechaMensual fecha = new FechaMensual(mensual); //try //{ // if (fecha.esMensualNulo()) // { // throw new NoValida("Mensual incorrecto"); // } // objCon = objCnn.Conectar(); // objPar[0] = new SqlParameter("@idPrestador", SqlDbType.BigInt); // objPar[0].Value = idPrestador; // objPar[1] = new SqlParameter("@mensual", SqlDbType.Int); // objPar[1].Value = mensual; // //Retorno un dataset conteniendo todas las novedades activas en el mensual del parametro // novedades = SqlHelper.ExecuteDataset(objCnn.ConectarString(), CommandType.StoredProcedure, "BuscoNovedadPorFechas_EntidadesPrivadas", objPar); return(novedades); //} //catch (NoValida e) //{ // //RETORNO MENSAJE DE ERROR // throw e; //} //catch (Exception err) //{ // throw err; //} //finally //{ // objCon.Dispose(); // objCnn = null; //} }
public static bool VerDisponible(long idPrestador, long idBeneficiario, double monto, int mensualDesde, int mensualHasta) { string resultado; int cuotas; double importe; FechaMensual desde = new FechaMensual(mensualDesde); FechaMensual hasta = new FechaMensual(mensualHasta); //Creo un objeto tipo novedad para reutilizar el codigo ya existente de verificacion de disponibilidad NovedadDAO oNov = new NovedadDAO(); try { //Valido los datos ingresados ValidoDatos(desde, hasta); //Saco la cantidad de cuotas por la diferencias de los mensuales, en meses cuotas = desde.cantidadDeMesesCon(hasta); importe = monto / cuotas; //El metodo de verificacion de disponibilidad retorna un string informando el resultado resultado = NovedadDAO.CtrolAlcanza(idBeneficiario, importe, idPrestador, 0); if (resultado == String.Empty) { return(true); } else { return(false); } } catch (NoValida e) { //RETORNO MENSAJE DE ERROR throw e; } }