public bool Delete(int id)
        {
            RangoFechas rf = this.FindById(id);

            //return (rf != null && rf.Delete());
            return(false);
        }
Ejemplo n.º 2
0
        private bool ValidarRangoFechas(RangoFechas rangoFechas)
        {
            string mensajeError = null;

            if (rangoFechas == null)
            {
                mensajeError = "Debe especificar el rango de fechas";
            }
            else
            {
                rangoFechas.EsValido(out mensajeError);
            }

            if (!String.IsNullOrWhiteSpace(mensajeError))
            {
                if (ViewBag.Errores == null)
                {
                    ViewBag.Errores = new string[] { mensajeError };
                }
                else
                {
                    var errores = new List <string>((IEnumerable <string>)ViewBag.Errores);
                    errores.Add(mensajeError);

                    ViewBag.Errores = errores;
                }

                return(false);
            }

            return(true);
        }
        public List <RangoFechas> FindAll()
        {
            string             cadenaFindAll     = "SELECT fecha_ini, fecha_fin FROM RangoFechas";
            List <RangoFechas> listaRangoFechass = new List <RangoFechas>();

            using (SqlConnection cn = BdSQL.Conectar())
            {
                using (SqlCommand cmd = new SqlCommand(cadenaFindAll, cn))
                {
                    cn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            RangoFechas unRF = new RangoFechas();
                            //unRF.Load(reader);
                            if (unRF.Validar())
                            {
                                listaRangoFechass.Add(unRF);
                            }
                        }
                    }
                }
            }
            return(listaRangoFechass);
        }
Ejemplo n.º 4
0
        public Anuncio FindById(int id)
        {
            string             cadenaFind         = "SELECT id,publicado,nombre,descripcion FROM Anuncio WHERE id=@id";
            Anuncio            a                  = null;
            List <Habitacion>  lista_habitaciones = new List <Habitacion>();
            List <Foto>        lista_fotos        = new List <Foto>();
            List <RangoFechas> lista_rangos       = new List <RangoFechas>();

            using (SqlConnection cn = BdSQL.Conectar())
            {
                using (SqlCommand cmd = new SqlCommand(cadenaFind, cn))
                {
                    cmd.Parameters.AddWithValue("@id", id);
                    cn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null && reader.Read())
                    {
                        a = new Anuncio();
                        a.Load(reader);

                        cmd.CommandText = "SELECT id_habitacion FROM HabitacionesAnuncio WHERE id_anuncio = @id";
                        SqlDataReader readerHabitaciones = cmd.ExecuteReader();
                        while (readerHabitaciones.Read())
                        {
                            Habitacion unaH = new RepositorioHabitacionesSQL().FindById(Convert.ToInt32(readerHabitaciones["id_habitacion"].ToString()));
                            lista_habitaciones.Add(unaH);
                        }
                        cmd.CommandText = "SELECT ruta FROM Foto WHERE id_anuncio = @id";
                        SqlDataReader readerFotos = cmd.ExecuteReader();
                        while (readerFotos.Read())
                        {
                            Foto unaF = new Foto
                            {
                                Ruta = readerFotos["ruta"].ToString()
                            };
                            lista_fotos.Add(unaF);
                        }
                        cmd.CommandText = "SELECT fecha_ini,fecha_fin FROM RangoFechaAnuncio WHERE id_anuncio = @id";
                        SqlDataReader readerFechas = cmd.ExecuteReader();
                        while (readerFechas.Read())
                        {
                            RangoFechas unR = new RangoFechas
                            {
                                Fecha_ini = Convert.ToDateTime(readerFechas["fecha_ini"].ToString()),
                                Fecha_fin = Convert.ToDateTime(readerFechas["fecha_fin"].ToString())
                            };
                            lista_rangos.Add(unR);
                        }
                        a.Habitaciones = lista_habitaciones;
                        a.ListaRangos  = lista_rangos;
                        a.Fotos        = lista_fotos;
                    }
                }
            }
            return(a);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime    f_ini = Calendar1.SelectedDate;
            DateTime    f_fin = Calendar2.SelectedDate;
            RangoFechas unRF  = new RangoFechas {
                Fecha_ini = f_ini, Fecha_fin = f_fin
            };

            ((List <RangoFechas>)Session["rangoFechasAnuncio"]).Add(unRF);
            this.lstRangos.DataSource = ((List <RangoFechas>)Session["rangoFechasAnuncio"]);
            this.lstRangos.DataBind();
        }
Ejemplo n.º 6
0
 public FiltroFecha(RangoFechas rango, DateTime desdeFecha, DateTime hastaFecha) : base()
 {
     try
     {
         this._desdeFecha = desdeFecha;
         this._hastaFecha = hastaFecha;
         this.Rango       = rango;
     }
     catch //(Exception e)
     {
         setToday();
     }
 }
Ejemplo n.º 7
0
 private void calcValues(RangoFechas rango, DateTime desdeFecha, DateTime hastaFecha)
 {
     try
     {
         this._rango      = rango;
         this._desdeFecha = ObjectNames.DefaultDateCalcTable[rango].CalcDesdeFecha(desdeFecha, hastaFecha);
         this._hastaFecha = ObjectNames.DefaultDateCalcTable[rango].CalcHastaFecha(desdeFecha, hastaFecha);
     }
     catch //(Exception e)
     {
         setToday();
     }
 }
Ejemplo n.º 8
0
 public FiltroFecha(XElement xml) : base()
 {
     try
     {
         this._desdeFecha = (xml.Attribute("desdeFecha") != null) ? DateTime.Parse(xml.Attribute("desdeFecha").Value) : DateTime.Today;
         this._hastaFecha = (xml.Attribute("hastaFecha") != null) ? DateTime.Parse(xml.Attribute("hastaFecha").Value) : DateTime.Today.EndOfDay();
         RangoFechas rango = (xml.Attribute("rango") != null) ? (RangoFechas)Enum.Parse(typeof(RangoFechas), xml.Attribute("rango").Value) : RangoFechas.Ninguno;
         Rango = rango;
     }
     catch //(Exception e)
     {
         setToday();
     }
 }
Ejemplo n.º 9
0
        public ActionResult CajaDeAhorros(
            string desde           = null,
            string hasta           = null,
            string tipoComprobante = null,
            int p    = 1,
            bool exp = false,
            string f = null)
        {
            var rangoFechas = new RangoFechas(desde, hasta,
                                              cantMaxMeses: CantMaxMesesDetalleCajaAhorros);

            var viewModel = new DetalleCajaDeAhorrosViewModel
            {
                Desde                      = rangoFechas.Desde,
                Hasta                      = rangoFechas.Hasta,
                TipoComprobante            = tipoComprobante ?? Socio.TipoCuenta,
                TiposComprobanteSelectList = ListasHelper.CrearTiposCuentaSelectList()
            };

            if (ValidarRangoFechas(rangoFechas))
            {
                CargarItemsCajaDeAhorrosViewModel(viewModel, p, exp);
            }

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteCajaDeAhorrosPdfFileResult(viewModel.Items));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelCajaDeAhorros(viewModel.Items));
                }
            }
            else
            {
                return(View(viewModel));
            }
        }
        public RangoFechas FindById(int id)
        {
            string      cadenaFind = "SELECT fecha_ini, fecha_fin FROM RangoFechas WHERE id = @id";
            RangoFechas unRF       = null;

            using (SqlConnection cn = BdSQL.Conectar())
            {
                using (SqlCommand cmd = new SqlCommand(cadenaFind, cn))
                {
                    cmd.Parameters.AddWithValue("@id", id);
                    cn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null && reader.Read())
                    {
                        unRF = new RangoFechas();
                        //unRF.Load(reader);
                    }
                }
            }
            return(unRF);
        }
Ejemplo n.º 11
0
        public ActionResult ServiciosCuotas(
            string desde = null,
            string hasta = null,
            int p        = 1,
            bool exp     = false,
            string f     = null)
        {
            var rangoFechas = new RangoFechas(desde, hasta);

            var viewModel = new ServiciosCuotasViewModel
            {
                Desde = rangoFechas.Desde,
                Hasta = rangoFechas.Hasta,
            };

            if (ValidarRangoFechas(rangoFechas))
            {
                CargarServiciosCuotasViewModel(viewModel, p, exp);
            }

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteServiciosCuotasPdfFileResult(viewModel.Items,
                                                                                        viewModel.CuotasPendientes, viewModel.CuotasImpagas, viewModel.CuotasPagas, viewModel.TotalPagado));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelServiciosCuotas(viewModel.Items,
                                                                                       viewModel.CuotasPendientes, viewModel.CuotasImpagas, viewModel.CuotasPagas, viewModel.TotalPagado));
                }
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 12
0
        public ActionResult CuotasSocietarias(
            string desde = null,
            string hasta = null,
            int p        = 1,
            bool exp     = false,
            string f     = null)
        {
            var rangoFechas = new RangoFechas(desde, hasta,
                                              cantMesesDefault: 12);

            var viewModel = new DetalleViewModelBase <CuotaSocietaria>
            {
                Desde = rangoFechas.Desde,
                Hasta = rangoFechas.Hasta,
            };

            if (ValidarRangoFechas(rangoFechas))
            {
                CargarItemsCuotasSocietariasViewModel(viewModel, p, exp);
            }

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteCuotasSocietariasPdfFileResult(viewModel.Items));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelCuotasSocietarias(viewModel.Items));
                }
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 13
0
        public ActionResult ValoresNegociados(
            string desde = null,
            string hasta = null,
            int p        = 1,
            bool exp     = false,
            string f     = null)
        {
            var rangoFechas = new RangoFechas(desde, hasta);

            var viewModel = new DetalleViewModelBase <DetalleValorNegociadoAyuda>
            {
                Desde = rangoFechas.Desde,
                Hasta = rangoFechas.Hasta,
            };

            if (ValidarRangoFechas(rangoFechas))
            {
                CargarItemsValoresNegociadosViewModel(viewModel, p, exp);
            }

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteValoresNegociadosPdfFileResult(viewModel.Items));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelValoresNegociados(viewModel.Items));
                }
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 14
0
        public ActionResult AhorroATerminoEnDolares(
            string desde = null,
            string hasta = null,
            int p        = 1,
            bool exp     = false,
            string f     = null)
        {
            var rangoFechas = new RangoFechas(desde, hasta);

            var viewModel = new DetalleViewModelBase <AhorroTerminoVigente>
            {
                Desde = rangoFechas.Desde,
                Hasta = rangoFechas.Hasta,
            };

            if (ValidarRangoFechas(rangoFechas))
            {
                CargarItemsAhorroATerminoEnDolaresViewModel(viewModel, p, exp);
            }

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteAhorrosATerminoEnDolaresPdfFileResult(viewModel.Items));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelAhorroATerminoEnDolares(viewModel.Items));
                }
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 15
0
 public void Add(RangoFechas rango, DateTime desdeFecha, DateTime hastaFecha)
 {
     this.list.Add(new FiltroFecha(rango, desdeFecha, hastaFecha));
 }
 public bool Add(RangoFechas obj)
 {
     //return obj != null && obj.Add();
     return(false);
 }
 public bool Update(RangoFechas obj)
 {
     //return obj != null && obj.Update();
     return(false);
 }
Ejemplo n.º 18
0
 private void setToday()
 {
     this._rango      = RangoFechas.Hoy;
     this._desdeFecha = DateTime.Today;
     this._hastaFecha = DateTime.Today;
 }