Exemplo n.º 1
0
        //Guarda una ubicacionProf
        public string Guardar(ClsUbicacionesProfesionales pvo_EntidadUbicacionProf)
        {
            string vlc_Mensaje = "";
            AccesoDatosUbicacionesProf vlo_AccesoUbicacionProf;

            try
            {
                vlo_AccesoUbicacionProf = new AccesoDatosUbicacionesProf();
                vlc_Mensaje             = vlo_AccesoUbicacionProf.Guardar(pvo_EntidadUbicacionProf);
            }
            catch (Exception)
            {
                throw;
            }
            return(vlc_Mensaje);
        }
Exemplo n.º 2
0
        public string Borrar(int ID_Usuario, int ID_Ubicacion)
        {
            string vlc_Mensaje = "";
            AccesoDatosUbicacionesProf  vlo_AccesoDatosUbicacionesProf;
            ClsUbicacionesProfesionales pvo_EntidadUbicacionProf = new ClsUbicacionesProfesionales(ID_Usuario, ID_Ubicacion, string.Empty);

            try
            {
                vlo_AccesoDatosUbicacionesProf = new AccesoDatosUbicacionesProf();
                vlc_Mensaje = vlo_AccesoDatosUbicacionesProf.Borrar(pvo_EntidadUbicacionProf);
            }
            catch (Exception)
            {
                throw;
            }
            return(vlc_Mensaje);
        }
Exemplo n.º 3
0
        public string Guardar(ClsUbicacionesProfesionales pvo_EntidadUbicacionProf)
        {
            MySqlConnection vlo_sqlConexion = new MySqlConnection(vgc_CadenaConexion);
            MySqlCommand    vlo_sqlCommand  = new MySqlCommand();
            //int vln_resultado = 0;
            string vlc_Mensaje   = "";
            string vlc_Sentencia = string.Empty; //tambien puede usar ""

            vlo_sqlCommand.Connection = vlo_sqlConexion;

            vlc_Sentencia = "SP_AgregarUbicacionProfecional";
            vlo_sqlCommand.CommandType = CommandType.StoredProcedure;
            vlo_sqlCommand.Parameters.AddWithValue("@_ID_USUARIO", pvo_EntidadUbicacionProf.ID_Usuario);
            //vlo_sqlCommand.Parameters["@_cod_sitio"].Direction = ParameterDirection.InputOutput;
            vlo_sqlCommand.Parameters.AddWithValue("@_ID_UBICACION", pvo_EntidadUbicacionProf.ID_Ubicacion1);
            vlo_sqlCommand.Parameters.AddWithValue("@_DETALLES", pvo_EntidadUbicacionProf.Detalles);
            vlo_sqlCommand.Parameters.Add("@_msj", MySqlDbType.VarChar, 100);
            vlo_sqlCommand.Parameters["@_msj"].Direction = ParameterDirection.Output;

            vlo_sqlCommand.CommandText = vlc_Sentencia;

            try
            {
                vlo_sqlConexion.Open();
                vlo_sqlCommand.ExecuteNonQuery();
                //pvo_EntidadWebSite.Cod_Sitio = Convert.ToInt32(vlo_sqlCommand.Parameters["@_cod_sitio"].Value);
                vlc_Mensaje = Convert.ToString(vlo_sqlCommand.Parameters["@_msj"].Value);
                vlo_sqlConexion.Close();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                vlo_sqlConexion.Dispose();
                vlo_sqlCommand.Dispose();
            }
            return(vlc_Mensaje);
        }
        //-----------------------> UBICACION ELIMINAR
        protected void lkn_EliminarUbicacion_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
        {
            int    cod_Ubicacion = int.Parse(e.CommandArgument.ToString());
            int    id_Usuario    = int.Parse(Session["ID_USUARIO_SESION"].ToString());
            string msg           = string.Empty;
            LogicaUbicacionProf         vlo_UbicacionProf = new LogicaUbicacionProf();
            ClsUbicacionesProfesionales UbicacionProf     = new ClsUbicacionesProfesionales();

            UbicacionProf.ID_Usuario    = id_Usuario;
            UbicacionProf.ID_Ubicacion1 = cod_Ubicacion;

            try
            {
                msg = vlo_UbicacionProf.Borrar(UbicacionProf);
                CargarGrdUbicaciones(Session["ID_USUARIO_SESION"].ToString());
            }
            catch (Exception)
            {
                //TODO: Mensaje de error
                throw;
            }
        }
        //----------------------> UBICACION GUARDAR
        protected void btnGuardarUbicacion_Click(object sender, EventArgs e)
        {
            LogicaUbicacionProf         Ubicacion      = new LogicaUbicacionProf();
            ClsUbicacionesProfesionales nuevaUbicacion = new ClsUbicacionesProfesionales
            {
                ID_Usuario    = int.Parse(Session["ID_USUARIO_SESION"].ToString()),
                ID_Ubicacion1 = int.Parse(ddlCanton.SelectedValue),
                Detalles      = txtDetalleDireccion.Text
            };

            try
            {
                Ubicacion.Guardar(nuevaUbicacion);
                CargarGrdUbicaciones(Session["ID_USUARIO_SESION"].ToString());
            }
            catch (Exception)
            {
                //TODO: Mensaje de error
                vgc_Script = string.Format("javascript:MostrarMensaje('Error al guardar ubicación.');");

                ScriptManager.RegisterStartupScript(this, typeof(string), "MensajeRetorno", vgc_Script, true);
            }
        }
Exemplo n.º 6
0
        public string Borrar(ClsUbicacionesProfesionales pvo_EntidadUbicacionProf)
        {
            MySqlConnection vlo_sqlConexion = new MySqlConnection(vgc_CadenaConexion);
            MySqlCommand    vlo_sqlCommand  = new MySqlCommand();
            string          vlc_Mensaje     = "";
            string          vlc_Sentencia   = string.Empty;

            vlo_sqlCommand.Connection = vlo_sqlConexion;

            vlc_Sentencia = "SP_EliminarUbicacionProfecional";
            vlo_sqlCommand.CommandType = CommandType.StoredProcedure;
            vlo_sqlCommand.Parameters.AddWithValue("@_ID_USUARIO", pvo_EntidadUbicacionProf.ID_Usuario);
            vlo_sqlCommand.Parameters.AddWithValue("@_ID_UBICACION", pvo_EntidadUbicacionProf.ID_Ubicacion1);
            vlo_sqlCommand.Parameters.Add("@_msj", MySqlDbType.VarChar, 100);
            vlo_sqlCommand.Parameters["@_msj"].Direction = ParameterDirection.Output;

            vlo_sqlCommand.CommandText = vlc_Sentencia;

            try
            {
                vlo_sqlConexion.Open();
                vlo_sqlCommand.ExecuteNonQuery();
                vlc_Mensaje = Convert.ToString(vlo_sqlCommand.Parameters["@_msj"].Value);
                vlo_sqlConexion.Close();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                vlo_sqlConexion.Dispose();
                vlo_sqlCommand.Dispose();
            }
            return(vlc_Mensaje);
        }