예제 #1
0
        private MapeoHoteles ObtenerParamsBDHotel(string IdHotelOB)
        {
            UConnection  DB  = new UConnection(Properties.Settings.Default.ipBD, Properties.Settings.Default.serverBD, Properties.Settings.Default.usuarioBD, Properties.Settings.Default.passBD);
            string       sql = "select * from obhotelmap where oh_hotel_ob = '" + IdHotelOB + "'";
            MapeoHoteles mh  = new MapeoHoteles();

            try
            {
                if (DB.EjecutaSQL(sql))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        mh.Desc_ob      = Convert.ToString(DB.ora_DataReader["OH_DESC_OB"]);
                        mh.Hotel_os     = Convert.ToString(DB.ora_DataReader["OH_HOTEL_OS"]);
                        mh.Hotel_un     = Convert.ToString(DB.ora_DataReader["OH_HOTEL_UN"]);
                        mh.Hotel_pw     = Convert.ToString(DB.ora_DataReader["OH_HOTEL_PW"]);
                        mh.Hotel_cn     = Convert.ToString(DB.ora_DataReader["OH_HOTEL_CN"]);
                        mh.Hotel_siglas = Convert.ToString(DB.ora_DataReader["OH_HOTEL_SIGLAS"]);
                        mh.Hotel_fase   = Convert.ToString(DB.ora_DataReader["OH_HOTEL_FASE"]);
                        mh.Hotel_ip     = Convert.ToString(DB.ora_DataReader["OH_HOTEL_IP"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //rv.Rva_error = ex.Message;
            }
            finally
            {
                DB.Dispose();
            }

            return(mh);
        }
예제 #2
0
        private Agencia ObtenerDatosAgencia(string Agencia, MapeoHoteles mph)
        {
            Agencia     ag  = new Agencia();
            UConnection DB  = new UConnection(mph.Hotel_ip, mph.Hotel_cn, mph.Hotel_un, mph.Hotel_pw);
            string      sql = "select AG_MAYORISTA, AG_PAIS, AG_REGIM_ALIM, AG_DIAS_PREPAGO from FRAGEN where AG_AGENCIA = '" + Agencia + "'";

            try
            {
                if (DB.EjecutaSQL(sql))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        ag.Mayorista    = Convert.ToString(DB.ora_DataReader["AG_MAYORISTA"]);
                        ag.Pais         = Convert.ToString(DB.ora_DataReader["AG_PAIS"]);
                        ag.Regim_alim   = Convert.ToString(DB.ora_DataReader["AG_REGIM_ALIM"]);
                        ag.Dias_prepago = Convert.ToInt16(DB.ora_DataReader["AG_DIAS_PREPAGO"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //rv.Rva_error = ex.Message;
            }
            finally
            {
                DB.Dispose();
            }
            return(ag);
        }
예제 #3
0
        private string ObtenerCodigoAgencia(string Canal, string PlanAlimentos)
        {
            string      CodigoAgencia = "";
            UConnection DB            = new UConnection(Properties.Settings.Default.ipBD, Properties.Settings.Default.serverBD, Properties.Settings.Default.usuarioBD, Properties.Settings.Default.passBD);
            string      sql           = "select CODIGO from OBAGENCIA where CANAL = '" + Canal + "' and PLAN = '" + PlanAlimentos + "'";

            try
            {
                if (DB.EjecutaSQL(sql))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        CodigoAgencia = Convert.ToString(DB.ora_DataReader["CODIGO"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //rv.Rva_error = ex.Message;
            }
            finally
            {
                DB.Dispose();
            }
            return(CodigoAgencia);
        }
예제 #4
0
        private bool GuardaReservaOMNI(Reservacion res)
        {
            DateTime Hoy = DateTime.Today;

            fecha_actual = Hoy.ToString("dd/MM/yy", CultureInfo.CreateSpecificCulture("en-US"));
            hora_actual  = DateTime.Now.ToString("hh:mm");
            int    filas     = 0;
            string fecha_rev = res.Rva_create_datetime.ToString("dd/MM/yy", CultureInfo.CreateSpecificCulture("en-US"));
            string hora_rev  = res.Rva_create_datetime.ToString("hh:mm");
            bool   ok        = false;

            //string theXml = System.Net.WebUtility.HtmlEncode(sw.ToString().Trim());

            string sql = string.Format("insert into OBOMNIBEES (OO_UNIQUEID, OO_ACTION, OO_AGENCIA, OO_MAYORISTA, OO_LLEGADA, OO_SALIDA, OO_TIPO_HAB, OO_PLAN, OO_GRUPO, OO_TARIFA, OO_MONEDA, "
                                       + "OO_ADULTO, OO_MENOR, OO_HOTEL_RENTA, OO_NOTA, OO_RVAHOTEL, OO_FECHA, OO_HORA, OO_NOTAS, OO_PAIS, OO_FECREV, OO_HORREV, oo_importe, oo_meal_plan,oo_garantia, oo_tipo_precio"
                                       + ") VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}',{22},'{23}','{24}','{25}')",
                                       res.Rva_uniqueID, res.Rva_action, res.Rva_agencia_obees, res.Rva_may, res.Rva_llegada, res.Rva_salida,
                                       res.Rva_hab_renta, res.Rva_plan, res.Rva_grupo, res.Rva_tarifa, res.Rva_moneda, res.Rva_adulto, res.Rva_menor, res.Rva_hotel_renta,
                                       res.Rva_notas, null, fecha_actual, hora_actual, res.Rva_notas, res.Rva_pais, fecha_rev, hora_rev, Convert.ToDouble(res.Rva_importe).ToString(CultureInfo.InvariantCulture),
                                       res.Rva_plancode, res.Rva_tipo_garantia, res.Rva_serv_price_type);

            UConnection DB = new UConnection(Properties.Settings.Default.ipBD, Properties.Settings.Default.serverBD, Properties.Settings.Default.usuarioBD, Properties.Settings.Default.passBD);

            ok = DB.EjecutaSQL(sql, ref filas);
            DB.Dispose();
            return(ok);
        }
예제 #5
0
        ///////////////////////////////////////////////
        public Int32 M_Eliminar_Producto(Int16 idProducto)
        {
            Int32         result = 0;    // retorno de mi metodo insertar
            SqlConnection con    = null; // para conectarme a mi BD.

            try
            {
                // apunta a la conexion de mi BD (direccion, BD, user,clave,)
                con = UConnection.getConnection();

                // abrimos la coneccion a la BD
                con.Open();

                // procedimiento almacenado para insertar cliente
                string sql = "sp_producto_eliminar";

                // creamos un objeto comando para ejecutar el Procedimiento a.
                SqlCommand cmd = new SqlCommand(sql, con);

                //definir que estamos trabajando con procedimiento almacenados
                cmd.CommandType = CommandType.StoredProcedure;


                // pasar los parametros a mi procedimiento almacenado

                // parametros de entrada

                cmd.Parameters.Add("@idproducto", SqlDbType.SmallInt).Value = idProducto;


                //---ejecutar el comando
                result = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //el flujo del codigo
                //entra a este bloque si
                //es que hay una excepcion

                Logger log = new Logger();
                log.setException(ex);
                //throw new Exception("Error al acceder a la BD");
                if (ex.Message.Contains("R_6"))
                {
                    throw new Exception("Este producto no puede ser elimindano, por que esta registrado en una venta");
                }
                else
                {
                    throw;
                }
            }
            finally
            {
                //--flujo del codigo SIEMPRE
                // para por este bloque
                con.Close();
            }

            return(result);
        }
예제 #6
0
        public void EvaluarEstadoVehiculoYAgregarBDE(int id, Vehicle vehiculo)
        {
            float Kilo    = (float)Convert.ToDouble(vehiculo.Kilometraje);
            float UMantto = (float)Convert.ToDouble(vehiculo.KUMantto);
            float dif     = Kilo - UMantto;

            vehiculo.Estado = 0;

            if (dif > 4800 && dif <= 5000)
            {
                vehiculo.Estado = 1;
            }
            else if (dif > 5000)
            {
                vehiculo.Estado = 2;
            }

            vehiculo.Buscador = vehiculo.Placa + "@" + vehiculo.Marca + "@" + vehiculo.Modelo + "@" + vehiculo.Responsable + "@" + vehiculo.Area + "@" + vehiculo.Encargado + "@" + vehiculo.Central;

            if (UConnection.conectadoWifi())
            {
                if (id != 0)
                {
                    mInteractor.actualizarVehiculo_SQLServer(this, vehiculo);
                }
                else
                {
                    mInteractor.agregarVehiculo_SQLServer(this, vehiculo);
                }
            }
            else
            {
                mView.ShowDialog("Debes encender la antena Wifi", "Ok", "False");
            }
        }
예제 #7
0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////


        public frodriguezDataSet1 M_listar_ProductosStock()
        {
            SqlConnection      con     = null; // para conectarme a mi BD.
            SqlDataAdapter     adapter = new SqlDataAdapter();
            frodriguezDataSet1 ds      = new frodriguezDataSet1();

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = @"
                             SELECT categoriapro,
                                 nombrepro, 
                                 stockpro,
                                  diseño,
                                  material,
                                  tamaño 
                                  FROM [dbo].[producto]
                                where stockpro <=5
                             ";
                SqlCommand cmd = new SqlCommand(sql, con);
                adapter.SelectCommand = cmd;
                adapter.Fill(ds, "reporteStockProductos");
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(ds);
        }
예제 #8
0
        private double ObtenerTipoCambio(string Moneda, MapeoHoteles mph)
        {
            double   TipoCambio = 0.0;
            DateTime Hoy        = DateTime.Today;

            fecha_actual = Hoy.ToString("dd/mm/yy", CultureInfo.CreateSpecificCulture("en-US"));
            UConnection DB  = new UConnection(mph.Hotel_ip, mph.Hotel_cn, mph.Hotel_un, mph.Hotel_pw);
            string      sql = "select TC_FRONT from frtipoca where TC_FECHA = '" + fecha_actual + "' and TC_MONEDA = '" + Moneda + "'";

            try
            {
                if (DB.EjecutaSQL(sql))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        TipoCambio = Convert.ToDouble(DB.ora_DataReader["TC_FRONT"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //rv.Rva_error = ex.Message;
            }
            finally
            {
                DB.Dispose();
            }
            return(TipoCambio);
        }
예제 #9
0
        /**private bool OnFristTimer()
         * {
         *  Log.Info(TAG, "\n\n\n\nSe realizo el primer intento por " + time1 / 1000 + " segundos\n\n\n\n");
         *
         *  return true;
         * }*/

        public void DescargarValoresNecesarios()
        {
            if (UConnection.conectadoWifi() == true)
            {
                /**if (UConnection.conextadoRedInterna() == true)
                 * {*/
                if (user.Nombre != String.Empty && user.Perfil == PERFIL_DESARROLLADOR)
                {
                    downloadUsers();
                    downloadVehicles();
                    downloadCheckLists();
                }
                else if (user.Nombre != String.Empty && (user.Perfil == PERFIL_SUPERVISOR || user.Perfil == PERFIL_RESPONSABLE))
                {
                    downloadUsers();
                    downloadVehicles();
                    downloadCheckLists();
                }
                else if (user.Nombre != String.Empty && user.Perfil == PERFIL_VIGILANTE)
                {
                    bandera1  = true;
                    descarga1 = true;
                    bandera2  = true;
                    descarga2 = true;
                    downloadCheckLists();
                    downloadVehicles();
                }
                else if (user.Nombre != String.Empty && user.Perfil == PERFIL_CONDUCTOR)
                {
                    bandera1  = true;
                    descarga1 = true;
                    bandera3  = true;
                    descarga3 = true;
                    downloadVehicles();
                }
                else
                {
                    DeleteUserPreferences();
                }

                /**}
                 * else
                 * {
                 *  Log.Info(TAG, "No está conectado a " + UServices.Wifi_Name);
                 *  DataConfirmationDialog frag = DataConfirmationDialog
                 *  .NewInstance("No estas conectado a '"+ UServices.Wifi_Name +"' ¿Deseas continuar?", "Continuar", "Finalizar", this);
                 *  frag.Show(FragmentManager, "TAG: continuar fuera de la red '" + UServices.Wifi_Name + "'");
                 * }*/
            }
            else
            {
                Log.Info(TAG, "No hay conexión Wifi");
                DataConfirmationDialog frag = DataConfirmationDialog
                                              .NewInstance(CODE_DIALOG_REFRESH, "No hay conexión Wifi ¿Deseas continuar sin conexión?", "Continuar", "Finalizar", this);
                frag.Show(FragmentManager, "TAG: continuar sin Wifi");
            }
        }
예제 #10
0
 public void ObtenerListaVehiculosBDE()
 {
     if (UConnection.conectadoWifi())
     {
         mInteractor.descargarListaVehiculos_SQLServer(this);
     }
     else
     {
         mView.ShowDialog("Debes encender la antena Wifi", "Ok", "False");
     }
 }
예제 #11
0
 public void BorrarrVehiculoBDE(int id)
 {
     if (UConnection.conectadoWifi())
     {
         mInteractor.eliminarVehiculo_SQLServer(this, id);
     }
     else
     {
         mView.ShowDialog("Debes encender la antena Wifi", "Ok", "False");
     }
 }
예제 #12
0
 public void ConsultarUsuarioBDE(User user)
 {
     if (UConnection.conectadoWifi())
     {
         mInteractor.consultarUsuario_SQLServer(user, this);
     }
     else
     {
         mView.showDialog("Debes encender la antena Wifi", "Ok", "False");
     }
 }
예제 #13
0
        private bool booking(Reservacion res)
        {
            // funcion que voy a procesar
            string sp = "FNRVA_OBEES";
            bool   ok;

            UConnection     DB     = new UConnection(Properties.Settings.Default.ipBD, Properties.Settings.Default.serverBD, Properties.Settings.Default.usuarioBD, Properties.Settings.Default.passBD);
            OracleCommand   cmd    = new OracleCommand();
            OracleParameter retval = new OracleParameter("V_RESERVA", OracleDbType.Varchar2, 50);

            retval.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(retval);
            //res.Rva_oasis_rva = Convert.ToString(retval.Value);
            OracleParameter inval = new OracleParameter("inval", OracleDbType.Varchar2);

            inval.Direction = ParameterDirection.Input;
            inval.Value     = res.Rva_action;
            cmd.Parameters.Add(inval);
            OracleParameter inval2 = new OracleParameter("inval2", OracleDbType.Varchar2);

            inval2.Direction = ParameterDirection.Input;
            inval2.Value     = res.Rva_uniqueID;
            cmd.Parameters.Add(inval2);
            OracleParameter inval3 = new OracleParameter("inval3", OracleDbType.Varchar2);

            inval3.Direction = ParameterDirection.Input;
            inval3.Value     = fecha_actual;
            cmd.Parameters.Add(inval3);
            OracleParameter inval4 = new OracleParameter("inval4", OracleDbType.Varchar2);

            inval4.Direction = ParameterDirection.Input;
            inval4.Value     = hora_actual;
            cmd.Parameters.Add(inval4);
            OracleParameter outval = new OracleParameter("outval", OracleDbType.Varchar2, 50);

            outval.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(outval);
            //res.Rva_oasis_errcode = Convert.ToString(outval.Value);
            OracleParameter outval2 = new OracleParameter("outval2", OracleDbType.Varchar2, 50);

            outval2.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(outval2);
            //res.Rva_oasis_errdesc = Convert.ToString(outval2.Value);

            ok = DB.EjecutaSP(ref cmd, sp);
            if (ok)
            {
                Reserva   = cmd.Parameters["V_RESERVA"].Value.ToString();
                ErrorCode = cmd.Parameters["ERRCODE"].Value.ToString();
                ErrDesc   = cmd.Parameters["ERRDESC"].Value.ToString();
            }
            return(ok);
        }
예제 #14
0
        public void validarOpcion(int mPosition, bool guardado, int validateOption)
        {
            switch (validateOption)
            {
            case VALIDATE_OPTION_NEXT:
                if (guardado == true)
                {
                    if (mPosition + 1 == 5)
                    {
                        CheckList checkList = obtenerPreferenciasCheckList();
                        Log.Info(TAG, "Los datos del PreUso son: " + checkList);
                        if (UConnection.conectadoWifi())
                        {
                            mInteractor.agregarPreUso_SQLServer(checkList, this);
                        }
                        else
                        {
                            mView.showDialog(TablesActivityView.CODE_DIALOG_SET, "No hay conexión Wifi ¿Deseas guardar los datos para cuando tengas conexión?", "Aceptar", "Cancelar");
                        }
                    }
                    else if (mPosition + 1 != 5)
                    {
                        if (mPosition + 1 == 1)
                        {
                            string placa = mCheckListPreferences.GetString("Placa", String.Empty);
                            Log.Info(TAG, "la placa es: " + placa);
                            if (UConnection.conectadoWifi())
                            {
                                mInteractor.descargarDocumentosDeVehiculo_SQLServer(placa, this);
                            }
                            else
                            {
                                mView.showDialog(TablesActivityView.CODE_DIALOG_GET, "Debes encender la antena Wifi", "Ok", "False");
                            }
                        }
                        mView.goNext();
                    }
                }
                break;

            case VALIDATE_OPTION_PREVIOUS:
                if (mPosition + 1 == 1)
                {
                    mView.showDialog(TablesActivityView.CODE_DIALOG_DISCART, "¿Desea descartar los datos ingresados?", "Aceptar", "Cancelar");
                }
                else if (mPosition + 1 != 1)
                {
                    mView.goPrevious();
                }
                break;
            }
        }
예제 #15
0
 public void RefreshChecKListBDE(CheckListSummary resumen, string comments, int state)
 {
     resumen.ComentariosVigilancia = comments;
     resumen.Estado = state;
     if (UConnection.conectadoWifi())
     {
         mInteractor.actualizarResumenPreUso_SQLServer(resumen, this);
     }
     else
     {
         mView.showDialog("Debes encender la antena Wifi", "Ok", "False");
     }
 }
예제 #16
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        public Empleado M_buscarPorId_empleado(Int16 idEmpleado)
        {
            Empleado      empleado = new Empleado();; // retorno de mi metodo buscarPorEntidad
            SqlConnection con      = null;            // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_empleado_buscar_por_id";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@idempleado", SqlDbType.SmallInt).Value = idEmpleado;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        empleado.Idempleado      = Convert.ToInt16(reader["idempleado"]);
                        empleado.Nombre          = Convert.ToString(reader["nombree"]);
                        empleado.Direccion       = Convert.ToString(reader["direccione"]);
                        empleado.Apellido        = Convert.ToString(reader["apellidoe"]);
                        empleado.Cargo           = Convert.ToString(reader["cargoe"]);
                        empleado.Telefono        = Convert.ToString(reader["telefonoe"]);
                        empleado.Dni             = Convert.ToString(reader["DNI"]);
                        empleado.Fechanacimiento = Convert.ToDateTime(reader["fechanacimiento"]);
                        empleado.Fechaentrada    = Convert.ToDateTime(reader["fechaentrada"]);
                        // empleado.Contraseña = Convert.ToString(reader["contraseña"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //el flujo del codigo
                //entra a este bloque si
                //es que hay una excepcion

                Logger log = new Logger();
                log.setException(ex);

                throw;
            }
            finally
            {
                //--flujo del codigo SIEMPRE
                // para por este bloque
                con.Close();
            }

            return(empleado);
        }
예제 #17
0
        public void ObtenerListaPreUsosBDE()
        {
            string fecha = PrepareDateToBrowser(DateTime.Now);

            Log.Info(TAG, "se solicitarán Pre-Usos del día: " + fecha);
            if (UConnection.conectadoWifi())
            {
                mInteractor.descargarListaPreUsosDelDia_SQLServer(fecha, this);
            }
            else
            {
                mView.ShowDialog("Debes encender la antena Wifi", "Ok", "False");
            }
        }
예제 #18
0
        private bool InsertarNombre(Freserno frn, MapeoHoteles mph)
        {
            UConnection DB    = new UConnection(mph.Hotel_ip, mph.Hotel_cn, mph.Hotel_un, mph.Hotel_pw);
            string      sql   = "";
            int         filas = 0;

            sql = "insert into freserno (VN_RESERVA,VN_SECUENCIA,VN_APELLIDO,VN_NOMBRE) VALUES (" + "'"
                  + frn.Vn_reserva + "'," + "'" + frn.Vn_secuencia + "'," + "'" + frn.Vn_apellido + "'," + "'"
                  + frn.Vn_nombre + "')";
            bool ok = DB.EjecutaSQL(sql, ref filas);

            DB.Dispose();
            return(filas > 0);
        }
예제 #19
0
        private bool GuardarSuceso(string Hotel, string Reservacion, string Suceso)
        {
            DateTime Hoy = DateTime.Today;

            fecha_actual = Hoy.ToString("dd/MM/yy", CultureInfo.CreateSpecificCulture("en-US"));
            hora_actual  = DateTime.Now.ToString("hh:mm");
            int filas = 0;

            string sql = string.Format("insert into obmodifi (hotel, reservacion, suceso, fecha, hora) VALUES ('{0}','{1}','{2}','{3}','{4}')",
                                       Hotel, Reservacion, Suceso, fecha_actual, hora_actual);

            UConnection DB = new UConnection(Properties.Settings.Default.ipBD, Properties.Settings.Default.serverBD, Properties.Settings.Default.usuarioBD, Properties.Settings.Default.passBD);
            bool        ok = DB.EjecutaSQL(sql, ref filas);

            DB.Dispose();
            return(ok);
        }
예제 #20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public bool M_validar_empleado(Empleado empleado)
        {
            bool          resp = false;
            SqlConnection con  = null;

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_empleado_validar_empleado";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.CommandText = "SELECT* FROM sp_empleado_validar_empleado WHERE user = @dni";

                cmd.Parameters.Add("@dni", SqlDbType.VarChar, 8).Value = empleado.Dni;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    string claveAlmacenada = "";
                    while (reader.Read())
                    {
                        empleado.Dni             = Convert.ToString(reader["DNI"]);
                        empleado.Idempleado      = Convert.ToInt16(reader["idempleado"]);
                        empleado.Nombre          = Convert.ToString(reader["nombree"]);
                        empleado.Apellido        = Convert.ToString(reader["apellidoe"]);
                        claveAlmacenada          = Convert.ToString(reader["contrasenia"]);
                        empleado.Telefono        = Convert.ToString(reader["telefonoe"]);
                        empleado.Fechanacimiento = Convert.ToDateTime(reader["fechanacimiento"]);
                        empleado.Fechaentrada    = Convert.ToDateTime(reader["fechaentrada"]);
                        empleado.Direccion       = Convert.ToString(reader["direccione"]);
                        empleado.Cargo           = Convert.ToString(reader["cargoe"]);
                    }
                    resp = BCrypt.Net.BCrypt.Verify(empleado.Contraseña, claveAlmacenada);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(resp);
        }
예제 #21
0
        //////////////////////////////////////////////


        public frodriguezDataSet1 M_Top_ProductosPorFechas(DateTime fechaIni, DateTime fechaFin)
        {
            SqlConnection      con     = null; // para conectarme a mi BD.
            SqlDataAdapter     adapter = new SqlDataAdapter();
            frodriguezDataSet1 ds      = new frodriguezDataSet1();

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = @"
                          
                             SELECT top 10 
							 producto.idproducto as id,
                             producto.nombrepro as nombre, 
                             producto.diseño as diseño,
                             producto.material as material,
                             producto.categoriapro as categoria,
                             producto.color as color,
                             sum(ventadetalle.cantidad)as cantidad 
                             FROM   [dbo].[producto]  INNER JOIN [dbo].[ventadetalle] 
                             ON ventadetalle.idproducto= producto.idproducto
							 inner join venta v on v.idventa = ventadetalle.idventa

							 WHERE v.fechaventa BETWEEN @fechaIni AND @fechaFin
                             group by producto.idproducto,producto.nombrepro,producto.diseño,producto.material,producto.categoriapro,producto.color 
         
                             ORDER BY cantidad  DESC      
                                            ";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.Parameters.Add("@fechaini", SqlDbType.DateTime).Value = fechaIni;
                cmd.Parameters.Add("@fechafin", SqlDbType.DateTime).Value = fechaFin;
                adapter.SelectCommand = cmd;
                adapter.Fill(ds, "reporteTopProductos");
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(ds);
        }
예제 #22
0
        private string ObtenerIdReservacion(MapeoHoteles mh)
        {
            string      Existe = "";
            int         filas = 0, Reservacion = 0;
            UConnection DB  = new UConnection(mh.Hotel_ip, mh.Hotel_cn, mh.Hotel_un, mh.Hotel_pw);
            string      sql = "select pr_reserva from frparam";

            try
            {
                if (DB.EjecutaSQL(sql))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        Reservacion = Convert.ToInt32(DB.ora_DataReader["PR_RESERVA"]);
                        Reservacion = Reservacion + 1;
                        string sql2 = string.Format("update frparam set pr_reserva = '{0}'", Reservacion);
                        bool   ok   = DB.EjecutaSQL(sql2, ref filas);
                    }
                }

                string sql3 = "select RV_RESERVA from freserva where RV_RESERVA = '" + Convert.ToString(Reservacion) + "'";
                if (DB.EjecutaSQL(sql3))
                {
                    while (DB.ora_DataReader.Read())
                    {
                        Existe = Convert.ToString(DB.ora_DataReader["RV_RESERVA"]);
                    }
                }

                if (!string.IsNullOrEmpty(Existe))
                {
                    Reservacion = 0;
                }
            }
            catch (Exception ex)
            {
                //rv.Rva_error = ex.Message;
            }
            finally
            {
                DB.Dispose();
            }
            return(Convert.ToString(Reservacion));
        }
예제 #23
0
        //////////////////////////////////////////////



        public frodriguezDataSet1 M_listar_ClientesNatural(DateTime fechaIni, DateTime fechaFin)
        {
            SqlConnection      con     = null; // para conectarme a mi BD.
            SqlDataAdapter     adapter = new SqlDataAdapter();
            frodriguezDataSet1 ds      = new frodriguezDataSet1();

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string sql = @"
                             Select
                                cliente.idcliente as id,
                                cliente.DNIc as dni,
                                cliente.nombrec as nombre,
                                cliente.apellidoc as apellidos,
                                cliente.direccion as direccion,
                                cliente.telefonoc as telefono
                                  from [dbo].[cliente]  inner join [dbo].[venta] on cliente.idcliente = venta.idcliente

                                WHERE venta.fechaventa BETWEEN @fechaIni AND @fechaFin  and cliente.DNIc <> ''
                                GROUP BY cliente.idcliente, cliente.DNIc, cliente.nombrec, cliente.apellidoc, cliente.direccion, cliente.telefonoc, cliente.correoc




                                            ";

                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.Parameters.Add("@fechaini", SqlDbType.DateTime).Value = fechaIni;
                cmd.Parameters.Add("@fechafin", SqlDbType.DateTime).Value = fechaFin;
                adapter.SelectCommand = cmd;
                adapter.Fill(ds, "reporteClientesNatural");
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(ds);
        }
예제 #24
0
        ////////////////////////////////////
        public List <Venta> M_BoletaBuscar_PorNombreCliente(string nombre)
        {
            List <Venta>  ventas = new List <Venta>(); // retorno de mi metodo buscarPorEntidad
            SqlConnection con    = null;               // para conectarme a mi BD.

            try{
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_boleta_buscar_por_nombre_cliente";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@nombre", SqlDbType.DateTime).Value = nombre;

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Venta venta = new Venta();
                        venta.IdVenta     = Convert.ToInt16(reader["idventa"]);
                        venta.Comprobante = Convert.ToString(reader["comprobante"]);

                        //venta.Cliente.Idcliente = Convert.ToInt16(reader["idcliente"]);

                        venta.FechaVenta = Convert.ToDateTime(reader["fechaventa"]);
                        //venta.Telefono = Convert.ToString(reader["telefonoc"]);
                        //venta.Correo = Convert.ToString(reader["correoc"]);
                        ventas.Add(venta);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw new Exception();
            }
            finally
            {
                con.Close();
            }
            return(ventas);
        }
예제 #25
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        public Cliente M_buscarPorId_cliente(Int16 idCliente)
        {
            Cliente       cliente = new Cliente();; // retorno de mi metodo buscarPorEntidad
            SqlConnection con     = null;           // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_cliente_buscar_por_id";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@idcliente", SqlDbType.SmallInt).Value = idCliente;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        cliente.Idcliente   = Convert.ToInt16(reader["idcliente"]);
                        cliente.Dni         = Convert.ToString(reader["DNIc"]);
                        cliente.Nombre      = Convert.ToString(reader["nombrec"]);
                        cliente.Apellido    = Convert.ToString(reader["apellidoc"]);
                        cliente.Direccion   = Convert.ToString(reader["direccion"]);
                        cliente.Telefono    = Convert.ToString(reader["telefonoc"]);
                        cliente.Correo      = Convert.ToString(reader["correoc"]);
                        cliente.Ruc         = Convert.ToString(reader["ruc"]);
                        cliente.Razonsocial = Convert.ToString(reader["razonsocial"]);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw new Exception("Error al acceder a la BD");
            }
            finally
            {
                con.Close();
            }
            return(cliente);
        }
예제 #26
0
        public List <Producto> M_ListaTopProductos_Fechas(DateTime fechaIni, DateTime fechaFin)
        {
            List <Producto> productos = new List <Producto>(); // retorno de mi metodo buscarPorEntidad
            SqlConnection   con       = null;                  // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_producto_top_entre_fechas";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@parFechaDeRegistroDesde", SqlDbType.DateTime).Value = fechaIni;
                cmd.Parameters.AddWithValue("@parFechaDeRegistroHasta", SqlDbType.DateTime).Value = fechaFin;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Producto producto = new Producto();
                        producto.Idproducto = Convert.ToInt16(reader["idproducto"]);
                        producto.Nombre     = Convert.ToString(reader["nombrepro"]);
                        producto.Diseño     = Convert.ToString(reader["diseño"]);
                        producto.Material   = Convert.ToString(reader["material"]);
                        producto.Categoria  = Convert.ToString(reader["categoriapro"]);
                        producto.Color      = Convert.ToString(reader["color"]);
                        producto.Cantidad   = Convert.ToInt32(reader["cantidad"]);
                        productos.Add(producto);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw new Exception("Error al acceder a la BD");
            }
            finally
            {
                con.Close();
            }
            return(productos);
        }
예제 #27
0
        ////////////////////////////////////
        public List <Venta> M_FacturaBuscar_PorRazonSocial(string razonsocial)
        {
            List <Venta>  ventas = new List <Venta>(); // retorno de mi metodo buscarPorEntidad
            SqlConnection con    = null;               // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_factura_buscar_por_razon_social";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@razonsocial", SqlDbType.DateTime).Value = razonsocial;

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Venta venta = new Venta();
                        venta.IdVenta     = Convert.ToInt16(reader["idventa"]);
                        venta.Comprobante = Convert.ToString(reader["comprobante"]);
                        //venta.Cliente.Idcliente = Convert.ToInt16(reader["idcliente"]);
                        venta.FechaVenta = Convert.ToDateTime(reader["fechaventa"]);
                        //venta.Cliente.Ruc = Convert.ToString(reader["ruc"]);
                        //venta.Cliente.Razonsocial = Convert.ToString(reader["razonsocial"]);
                        ventas.Add(venta);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw new Exception();
            }
            finally
            {
                con.Close();
            }
            return(ventas);
        }
예제 #28
0
        ////////////////////////////////////////////////////////////////



        public Empleado M_buscarDNIRepetido_empleado(string dni)
        {
            Empleado      empleado = new Empleado();; // retorno de mi metodo buscarPorEntidad
            SqlConnection con      = null;            // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_empleado_buscar_dni_repetido";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@dniRepetido", SqlDbType.VarChar, 8).Value = dni;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        empleado.Dni = Convert.ToString(reader["DNI"]);
                    }
                }
            }
            catch (Exception ex)
            {
                //el flujo del codigo
                //entra a este bloque si
                //es que hay una excepcion

                Logger log = new Logger();
                log.setException(ex);

                throw;
            }
            finally
            {
                //--flujo del codigo SIEMPRE
                // para por este bloque
                con.Close();
            }

            return(empleado);
        }
예제 #29
0
        //-------------------------------------------
        public Int32 M_insertar_empleado(Empleado empleado)
        {
            Int32         result = 0;
            SqlConnection con    = null;

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_empleado_insertar";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@nombree", SqlDbType.VarChar, 50).Value      = empleado.Nombre;
                cmd.Parameters.Add("@direccione", SqlDbType.VarChar, 100).Value  = empleado.Direccion;
                cmd.Parameters.Add("@apellidoe", SqlDbType.VarChar, 50).Value    = empleado.Apellido;
                cmd.Parameters.Add("@cargoe", SqlDbType.VarChar, 50).Value       = empleado.Cargo;
                cmd.Parameters.Add("@telefonoe ", SqlDbType.VarChar, 20).Value   = empleado.Telefono;
                cmd.Parameters.Add("@DNI", SqlDbType.VarChar, 8).Value           = empleado.Dni;
                cmd.Parameters.Add("@fechanacimiento", SqlDbType.DateTime).Value = empleado.Fechanacimiento;
                cmd.Parameters.Add("@fechaentrada", SqlDbType.DateTime).Value    = empleado.Fechaentrada;
                string claveEncriptada = BCrypt.Net.BCrypt.HashPassword(
                    empleado.Contraseña
                    , BCrypt.Net.BCrypt.GenerateSalt()
                    );
                cmd.Parameters.Add("@contrasenia", SqlDbType.VarChar, 100).Value = claveEncriptada;
                SqlParameter outParam = cmd.Parameters.Add("@idempleado", SqlDbType.SmallInt);
                outParam.Direction  = ParameterDirection.Output;
                result              = cmd.ExecuteNonQuery();
                empleado.Idempleado = Convert.ToInt16(cmd.Parameters["@idempleado"].Value);
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw;
            }
            finally
            {
                con.Close();
            }
            return(result);
        }
예제 #30
0
        ////////////////////////////////////

        public List <Cliente> M_Buscar_clienteEmpresa(DateTime fechaIni, DateTime fechaFin)
        {
            List <Cliente> clientes = new List <Cliente>(); // retorno de mi metodo buscarPorEntidad
            SqlConnection  con      = null;                 // para conectarme a mi BD.

            try
            {
                con = UConnection.getConnection();
                con.Open();
                string     sql = "sp_cliente_listar_entre_fechas_empresa";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@parFechaDeRegistroDesde", SqlDbType.DateTime).Value = fechaIni;
                cmd.Parameters.AddWithValue("@parFechaDeRegistroHasta", SqlDbType.DateTime).Value = fechaFin;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Cliente cliente = new Cliente();
                        cliente.Idcliente   = Convert.ToInt16(reader["idcliente"]);
                        cliente.Ruc         = Convert.ToString(reader["ruc"]);
                        cliente.Razonsocial = Convert.ToString(reader["razonsocial"]);
                        cliente.Direccion   = Convert.ToString(reader["direccion"]);
                        cliente.Telefono    = Convert.ToString(reader["telefonoc"]);
                        cliente.Correo      = Convert.ToString(reader["correoc"]);
                        clientes.Add(cliente);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger log = new Logger();
                log.setException(ex);
                throw new Exception("Error al acceder a la BD");
            }
            finally
            {
                con.Close();
            }
            return(clientes);
        }