Esempio n. 1
0
        /* Obtiene la informacion general que toda consulta necesita y la carga en common output view pasado
         * como parametro */
        public bool getFillCommonInfo(View self, bool rango_de_fechas, bool fecha_de_jornada, ref string error)
        {
            // Campos en la tabla que se van a actualizar
            TextView textView_reporte     = self.FindViewById <TextView>(Resource.Id.textViewNombreDelReporte);
            TextView textView_user        = self.FindViewById <TextView>(Resource.Id.textViewUsuario);
            TextView textView_office      = self.FindViewById <TextView>(Resource.Id.textViewOficina);
            TextView textView_fecha_hora  = self.FindViewById <TextView>(Resource.Id.textViewFechaHora);
            TextView textView_fecha_rango = self.FindViewById <TextView>(Resource.Id.textViewRangoFechas);
            TextView textView_fecha_label = self.FindViewById <TextView>(Resource.Id.textViewFechasLabel);

            textView_reporte.Text = reportName;

            try
            {
                Helpers.SQLiteConeccion dbConeccion;
                dbConeccion = new Helpers.SQLiteConeccion();
                dbConeccion.consultaDatos("SELECT CodigoNotificador FROM OficialNotificador", self.Context, ref loggin_usuario);

                dbConeccion = new Helpers.SQLiteConeccion();
                dbConeccion.consultaDatos("SELECT DespachoCodigo FROM OficialNotificador", self.Context, ref loggin_officina);

                string supervisor = "";
                dbConeccion = new Helpers.SQLiteConeccion();
                dbConeccion.consultaDatos("SELECT Supervisor FROM OficialNotificador", self.Context, ref supervisor);
                loggin_supervisor = String.Equals("True", supervisor);
            }
            catch (Exception)
            {
                error = "No fue posible obtener la información requerida para le reporte (ID)";
                return(false);
            }

            textView_user.Text       = loggin_usuario;
            textView_office.Text     = loggin_officina;
            textView_fecha_hora.Text = DateTime.Now.ToString("yyyy-MMM-dd hh:mm");
            if (fecha_de_jornada)
            {
                textView_fecha_label.Text = "Fecha jornada";
                textView_fecha_rango.Text = input_fecha_jornada.ToString("yyyy-MMM-dd");
            }
            else if (rango_de_fechas)
            {
                textView_fecha_label.Text  = "Rango de fechas";
                textView_fecha_rango.Text  = "De " + input_fecha_inicio.ToString("yyyy-MMM-dd");
                textView_fecha_rango.Text += "\na " + input_fecha_fin.ToString("yyyy-MMM-dd");
            }
            else
            {
                textView_fecha_label.Text = "Fecha";
                textView_fecha_rango.Text = input_fecha_inicio.ToString("yyyy-MMM-dd");
            }

            // FIXME, Se permite generar informe de más de 3 meses para encontrar datos validos facilmente
            if (!ReportUtils.validarFechas(input_fecha_inicio, input_fecha_fin, false, ref error))
            {
                return(false);
            }

            return(true);
        }