private void cargarComboComuna(int _id_provincia)
 {
     try
     {
         ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
         auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
         auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
         DataSet   ds = new DataSet();
         DataTable dt = new DataTable();
         ds = auxServiceComuna.TraerTodasComunasPorProvincia_Escritorio(_id_provincia);
         dt = ds.Tables[0];
         DataRow fila = dt.NewRow();
         fila["ID_COMUNA"]    = 0;
         fila["NOMBRE"]       = "SELECCIONE COMUNA";
         fila["ID_PROVINCIA"] = 1;
         dt.Rows.InsertAt(fila, 0);
         cbComuna.DropDownStyle = ComboBoxStyle.DropDownList;
         cbComuna.DataSource    = dt;
         cbComuna.DisplayMember = "NOMBRE";
         cbComuna.ValueMember   = "ID_COMUNA";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error al cargar Informacion cargarComboComuna, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public FormEmpresaModal(string _tituloModal, int _accion, string _rut_empresa, string _nombre, string _giro, string _direccion, string _estado, string _id_comuna)
        {
            InitializeComponent();
            try
            {
                //Modalidad de Modal segun Accion Padre 1 = modificar / 2 = nuevo / 3 = Ver
                if (_accion == 1)
                {
                    //Cambiar Titulo de Modal
                    lblTitulo.Text = _tituloModal;
                    //Instancia de Web service con credenciales NT
                    ServiceProcess_Provincia.Process_ProvinciaSoapClient auxServiceProvincia = new ServiceProcess_Provincia.Process_ProvinciaSoapClient();
                    auxServiceProvincia.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                    auxServiceProvincia.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                    ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
                    auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                    auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;

                    //Se cargan las clases de comuna provincia y region mediante web service
                    ServiceProcess_Comuna.Comuna       auxComuna    = new ServiceProcess_Comuna.Comuna();
                    ServiceProcess_Provincia.Provincia auxProvincia = new ServiceProcess_Provincia.Provincia();
                    ServiceProcess_Region.Region       auxRegion    = new ServiceProcess_Region.Region();
                    //Se trae informacion de comuna y provincia de la empresa selecciionada
                    auxComuna    = auxServiceComuna.TraerComunaConEntidad_Escritorio(Convert.ToInt32(_id_comuna));
                    auxProvincia = auxServiceProvincia.TraerProvinciaConEntidad_Escritorio(auxComuna.Id_provincia);
                    //Se almacena en variables
                    int _id_provincia = auxProvincia.Id_provincia;
                    int _region       = auxProvincia.Id_region;
                    //Se habilita Boton
                    btnGuardar.Visible  = true;
                    btnCancelar.Visible = true;
                    // desactivar boton acepatar
                    btnVolver.Visible = false;
                    //Se carga combos de estado y region
                    cargarComboRegion();
                    //bloquear combobox
                    cbRegion.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbProvincia.DropDownStyle = ComboBoxStyle.DropDownList;
                    cbComuna.DropDownStyle    = ComboBoxStyle.DropDownList;
                    //se inactiva txtbox de rut de empresa
                    txtRutEmpresa.ReadOnly = true;
                    txtRutEmpresa.Enabled  = false;
                    //se inactiva txtbox de ESTADO de empresa
                    txtEstado.ReadOnly = true;
                    txtEstado.Enabled  = false;
                    //desbloquear cajas de texto
                    txtNombreEmpresa.ReadOnly = false;
                    txtGiro.ReadOnly          = false;
                    txtDireccion.ReadOnly     = false;
                    //se pasan datos a cajas de texto de cuadro de datos
                    txtRutEmpresa.Text        = _rut_empresa;
                    txtNombreEmpresa.Text     = _nombre;
                    txtGiro.Text              = _giro;
                    txtDireccion.Text         = _direccion;
                    cbRegion.SelectedIndex    = _region;
                    cbProvincia.SelectedValue = _id_provincia;
                    cbComuna.SelectedValue    = _id_comuna;
                    if (_estado.Equals("1"))
                    {
                        txtEstado.Text = "ACTIVO";
                    }
                    else
                    {
                        txtEstado.Text = "DASACTIVADO";
                    }

                    //Variable para interaccion de botones (0 = ninguno) (1 = modificar) - (2 = guardar) - (3 = Ver)
                    _guardar = 1;
                }
                else if (_accion == 2)
                {
                    //Cambiar Titulo de Modal
                    lblTitulo.Text = _tituloModal;
                    //Se habilita Boton
                    btnGuardar.Visible  = true;
                    btnCancelar.Visible = true;
                    // desactivar boton acepatar
                    btnVolver.Visible = false;
                    //desbloquear cajas de texto
                    txtRutEmpresa.ReadOnly    = false;
                    txtNombreEmpresa.ReadOnly = false;
                    txtGiro.ReadOnly          = false;
                    txtDireccion.ReadOnly     = false;
                    //Cargar comobox de region
                    cargarComboRegion();
                    //vaciar textbox
                    txtRutEmpresa.Text    = string.Empty;
                    txtNombreEmpresa.Text = string.Empty;
                    txtGiro.Text          = string.Empty;
                    txtDireccion.Text     = string.Empty;
                    //bloquear combobox
                    cbRegion.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbProvincia.DropDownStyle = ComboBoxStyle.DropDownList;
                    cbComuna.DropDownStyle    = ComboBoxStyle.DropDownList;
                    //vaciar combobox
                    cbProvincia.DataSource = null;
                    cbProvincia.Items.Clear();
                    cbComuna.DataSource = null;
                    cbComuna.Items.Clear();
                    //Dasactivar estado
                    txtEstado.Visible = false;
                    lblEstado.Visible = false;
                    //Variable para interaccion de botones (0 = ninguno) (1 = modificar) - (2 = Nuevo) - (3 = Ver)
                    _guardar = 2;
                }
                else
                {
                    //Cambiar Titulo de Modal
                    lblTitulo.Text = _tituloModal;
                    //Instancia de Web service con credenciales NT
                    ServiceProcess_Provincia.Process_ProvinciaSoapClient auxServiceProvincia = new ServiceProcess_Provincia.Process_ProvinciaSoapClient();
                    auxServiceProvincia.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                    auxServiceProvincia.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                    ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
                    auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                    auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;

                    //Se cargan las clases de comuna provincia y region mediante web service
                    ServiceProcess_Comuna.Comuna       auxComuna    = new ServiceProcess_Comuna.Comuna();
                    ServiceProcess_Provincia.Provincia auxProvincia = new ServiceProcess_Provincia.Provincia();
                    ServiceProcess_Region.Region       auxRegion    = new ServiceProcess_Region.Region();
                    //Se trae informacion de comuna y provincia de la empresa selecciionada
                    auxComuna    = auxServiceComuna.TraerComunaConEntidad_Escritorio(Convert.ToInt32(_id_comuna));
                    auxProvincia = auxServiceProvincia.TraerProvinciaConEntidad_Escritorio(auxComuna.Id_provincia);
                    //Se almacena en variables
                    int _id_provincia = auxProvincia.Id_provincia;
                    int _region       = auxProvincia.Id_region;
                    //Se habilita Boton
                    btnGuardar.Visible  = false;
                    btnCancelar.Visible = false;
                    // desactivar boton acepatar
                    btnVolver.Visible = true;
                    //Se carga combos de estado y region
                    cargarComboRegion();
                    //bloquear combobox
                    cbRegion.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbProvincia.DropDownStyle = ComboBoxStyle.DropDownList;
                    cbComuna.DropDownStyle    = ComboBoxStyle.DropDownList;
                    //se pasan datos a cajas de texto de cuadro de datos
                    txtRutEmpresa.Text        = _rut_empresa;
                    txtNombreEmpresa.Text     = _nombre;
                    txtGiro.Text              = _giro;
                    txtDireccion.Text         = _direccion;
                    cbRegion.SelectedIndex    = _region;
                    cbProvincia.SelectedValue = _id_provincia;
                    cbComuna.SelectedValue    = _id_comuna;
                    if (_estado.Equals("1"))
                    {
                        txtEstado.Text = "ACTIVO";
                    }
                    else
                    {
                        txtEstado.Text = "DASACTIVADO";
                    }

                    //se inactiva txtbox de rut de empresa
                    txtRutEmpresa.ReadOnly = true;
                    txtRutEmpresa.Enabled  = false;
                    //se inactiva txtbox de nombre
                    txtNombreEmpresa.ReadOnly = true;
                    txtNombreEmpresa.Enabled  = false;
                    //se inactiva txtbox de giro
                    txtGiro.ReadOnly = true;
                    txtGiro.Enabled  = false;
                    //se inactiva txtbox de direccion
                    txtDireccion.ReadOnly = true;
                    txtDireccion.Enabled  = false;
                    //se inactiva combo de region
                    cbRegion.Enabled = false;
                    //se inactiva combo de provincia
                    cbProvincia.Enabled = false;
                    //se inactiva combo de comuna
                    cbComuna.Enabled = false;
                    //se inactiva txtbox de ESTADO de empresa
                    txtEstado.ReadOnly = true;
                    txtEstado.Enabled  = false;
                    //Variable para interaccion de botones (0 = ninguno) (1 = modificar) - (2 = guardar) - (3 = Ver)
                    _guardar = 3;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al cargar Informacion Modal Empresa, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
 //Metodo Accion para filtrar automatico
 private void TxtFiltrar_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         dgvEmpresas.Rows.Clear();
         dgvEmpresas.Refresh();
         //instansear web service con seguridad
         ServiceProcess_Empresa.Process_EmpresaSoapClient auxServiceEmpresa = new ServiceProcess_Empresa.Process_EmpresaSoapClient();
         auxServiceEmpresa.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
         auxServiceEmpresa.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
         ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
         auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
         auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
         ServiceProcess_Comuna.Comuna   auxComuna  = new ServiceProcess_Comuna.Comuna();
         ServiceProcess_Empresa.Empresa auxEmpresa = new ServiceProcess_Empresa.Empresa();
         //capturar dataset
         DataSet ds = auxServiceEmpresa.TraerEmpresaConClaveSinEntidad_Escritorio(txtFiltrar.Text.ToUpper());
         if ((ds.Tables.Count != 0) && (ds.Tables[0].Rows.Count > 0))
         {
             //Capturar Tabla
             DataTable dt = ds.Tables[0];
             //contar cantidad de empresas
             int _cantidad_empresas = dt.Rows.Count;
             //crear array bidimencional
             string[,] ListaEmpresa = new string[_cantidad_empresas, 6];
             //Recorrer data table
             int _fila = 0;
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 //Capturar datos de la fila recorridad en objeto empresa
                 auxEmpresa.Rut_empresa = (String)dt.Rows[i]["Rut_empresa"];
                 auxEmpresa.Nombre      = (String)dt.Rows[i]["Nombre"];
                 auxEmpresa.Giro        = (String)dt.Rows[i]["Giro"];
                 auxEmpresa.Direccion   = (String)dt.Rows[i]["Direccion"];
                 auxEmpresa.Estado      = Convert.ToInt32(dt.Rows[i]["Estado"]);
                 auxEmpresa.Id_comuna   = Convert.ToInt32(dt.Rows[i]["Id_comuna"]);
                 //variables temporales de apoyo
                 string _estado = string.Empty;
                 string _comuna = string.Empty;
                 //cargar array con datos de fila
                 ListaEmpresa[_fila, 0] = auxEmpresa.Rut_empresa;
                 ListaEmpresa[_fila, 1] = auxEmpresa.Nombre;
                 ListaEmpresa[_fila, 2] = auxEmpresa.Giro;
                 ListaEmpresa[_fila, 3] = auxEmpresa.Direccion;
                 if (auxEmpresa.Estado == 0)
                 {
                     _estado = "DESACTIVADO";
                 }
                 else
                 {
                     _estado = "ACTIVADO";
                 }
                 ListaEmpresa[_fila, 4] = _estado;
                 auxComuna = auxServiceComuna.TraerComunaConEntidad_Escritorio(auxEmpresa.Id_comuna);
                 ListaEmpresa[_fila, 5] = auxComuna.Nombre;
                 //agregar lista a gridview
                 dgvEmpresas.Rows.Add(ListaEmpresa[_fila, 0], ListaEmpresa[_fila, 1], ListaEmpresa[_fila, 2], ListaEmpresa[_fila, 3], ListaEmpresa[_fila, 4], ListaEmpresa[_fila, 5]);
                 _fila++;
             }
             //Vaciar variables
             _rut_empresa = null;
             _nombre      = string.Empty;
             _giro        = string.Empty;
             _direccion   = string.Empty;
             _estado      = string.Empty;
             _id_comuna   = string.Empty;
             //deseleccionar
             pbSeleccion.Visible   = false;
             btnActivar.Visible    = false;
             btnDesactivar.Visible = false;
         }
         else
         {
             //Mostrar GridView Vacio
             //Vaciar variables
             _rut_empresa = null;
             _nombre      = string.Empty;
             _giro        = string.Empty;
             _direccion   = string.Empty;
             _estado      = string.Empty;
             _id_comuna   = string.Empty;
             //deseleccionar
             pbSeleccion.Visible   = false;
             btnActivar.Visible    = false;
             btnDesactivar.Visible = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en metodo de accion TxtFiltrar_KeyUp, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #4
0
        //Metodo Carga GridView
        public void cargarDataGridViewPpal()
        {
            try
            {
                //instansear web service con seguridad
                ServiceProcess_Empresa.Process_EmpresaSoapClient auxServiceEmpresa = new ServiceProcess_Empresa.Process_EmpresaSoapClient();
                auxServiceEmpresa.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceEmpresa.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Empresa.Empresa auxEmpresa = new ServiceProcess_Empresa.Empresa();

                ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
                auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Comuna.Comuna auxComuna = new ServiceProcess_Comuna.Comuna();
                //capturar dataset
                DataSet ds = auxServiceEmpresa.TraerTodasEmpresas_Escritorio();
                //Capturar Tabla
                DataTable dt = ds.Tables[0];
                //contar cantidad de empresas
                int _cantidad_empresas = dt.Rows.Count;
                //crear array bidimencional
                string[,] ListaEmpresa = new string[_cantidad_empresas, 6];
                //Recorrer data table
                int _fila = 0;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //Capturar datos de la fila recorridad en objeto empresa
                    auxEmpresa.Rut_empresa = (String)dt.Rows[i]["Rut_empresa"];
                    auxEmpresa.Nombre      = (String)dt.Rows[i]["Nombre"];
                    auxEmpresa.Giro        = (String)dt.Rows[i]["Giro"];
                    auxEmpresa.Direccion   = (String)dt.Rows[i]["Direccion"];
                    auxEmpresa.Estado      = Convert.ToInt32(dt.Rows[i]["Estado"]);
                    auxEmpresa.Id_comuna   = Convert.ToInt32(dt.Rows[i]["Id_comuna"]);
                    //variables temporales de apoyo
                    string _estado = string.Empty;
                    string _comuna = string.Empty;
                    //cargar array con datos de fila
                    ListaEmpresa[_fila, 0] = auxEmpresa.Rut_empresa;
                    ListaEmpresa[_fila, 1] = auxEmpresa.Nombre;
                    ListaEmpresa[_fila, 2] = auxEmpresa.Giro;
                    ListaEmpresa[_fila, 3] = auxEmpresa.Direccion;
                    if (auxEmpresa.Estado == 0)
                    {
                        _estado = "DESACTIVADO";
                    }
                    else
                    {
                        _estado = "ACTIVADO";
                    }
                    ListaEmpresa[_fila, 4] = _estado;
                    auxComuna = auxServiceComuna.TraerComunaConEntidad_Escritorio(auxEmpresa.Id_comuna);
                    ListaEmpresa[_fila, 5] = auxComuna.Nombre;
                    //agregar lista a gridview
                    dgvEmpresas.Rows.Add(ListaEmpresa[_fila, 0], ListaEmpresa[_fila, 1], ListaEmpresa[_fila, 2], ListaEmpresa[_fila, 3], ListaEmpresa[_fila, 4], ListaEmpresa[_fila, 5]);
                    _fila++;
                }
                pbSeleccion.Visible = false;
                //dgvEmpresas.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error en metodo cargarDataGridViewPpal, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #5
0
        public FormUsuarioModal(string tituloModal, int accion, string rut_usuario, string primer_nombre, string segundo_nombre,
                                string primer_apellido, string segundo_apellido, string direccion, string telefono_fijo, string telefono_movil,
                                string estado, string id_comuna, string rut_empresa, string id_cargo)
        {
            InitializeComponent();

            try
            {
                //Carga de Web Service
                ServiceProcess_Cargo.Process_CargoSoapClient auxServiceCargo = new ServiceProcess_Cargo.Process_CargoSoapClient();
                auxServiceCargo.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceCargo.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Region.Process_RegionSoapClient auxServiceRegion = new ServiceProcess_Region.Process_RegionSoapClient();
                auxServiceRegion.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceRegion.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Provincia.Process_ProvinciaSoapClient auxServiceProvincia = new ServiceProcess_Provincia.Process_ProvinciaSoapClient();
                auxServiceProvincia.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceProvincia.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Comuna.Process_ComunaSoapClient auxServiceComuna = new ServiceProcess_Comuna.Process_ComunaSoapClient();
                auxServiceComuna.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceComuna.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Empresa.Process_EmpresaSoapClient auxServiceEmpresa = new ServiceProcess_Empresa.Process_EmpresaSoapClient();
                auxServiceEmpresa.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
                auxServiceEmpresa.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
                ServiceProcess_Empresa.Empresa auxEmpresa = new ServiceProcess_Empresa.Empresa();
                auxEmpresa = auxServiceEmpresa.TraerEmpresaConEntidad_Escritorio(rut_empresa);

                _rut_empresa = rut_empresa;
                if (accion == 1)// modificar
                {
                    //Se cargan las clases de comuna provincia y region mediante web service
                    ServiceProcess_Comuna.Comuna       auxComuna    = new ServiceProcess_Comuna.Comuna();
                    ServiceProcess_Provincia.Provincia auxProvincia = new ServiceProcess_Provincia.Provincia();
                    //Se buscan comuna y provincia
                    auxComuna    = auxServiceComuna.TraerComunaConEntidad_Escritorio(Convert.ToInt32(id_comuna));
                    auxProvincia = auxServiceProvincia.TraerProvinciaConEntidad_Escritorio(auxComuna.Id_provincia);
                    //Se almacena en variables
                    int _id_provincia = auxProvincia.Id_provincia;
                    int _region       = auxProvincia.Id_region;
                    //Cambiar Titulo de Modal
                    lblTitulo.Text = tituloModal;
                    //Se habilita Boton
                    btnGuardar.Visible  = true;
                    btnCancelar.Visible = true;
                    btnVolver.Visible   = false;
                    //Se carga combos de estado y region
                    cargarComboRegion();
                    cargarComboCargo(rut_empresa);
                    //bloquear combobox
                    cbRegion.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbProvincia.DropDownStyle = ComboBoxStyle.DropDownList;
                    cbComuna.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbCargo.DropDownStyle     = ComboBoxStyle.DropDownList;
                    //se inactiva txtbox de rut de Usuario
                    txtRutUsuario.ReadOnly = true;
                    txtRutUsuario.Enabled  = false;
                    //desbloquear cajas de texto
                    txtPrimerNombre.ReadOnly    = false;
                    txtSegundoNombre.ReadOnly   = false;
                    txtPrimerApellido.ReadOnly  = false;
                    txtSegundoApellido.ReadOnly = false;
                    txtDireccion.ReadOnly       = false;
                    txtTelefonoFijo.ReadOnly    = false;
                    txtTelefonoMovil.ReadOnly   = false;
                    //se pasan datos a cajas de texto de cuadro de datos
                    txtRutUsuario.Text        = rut_usuario;
                    txtPrimerNombre.Text      = primer_nombre;
                    txtSegundoNombre.Text     = segundo_nombre;
                    txtPrimerApellido.Text    = primer_apellido;
                    txtSegundoApellido.Text   = segundo_apellido;
                    txtDireccion.Text         = direccion;
                    txtTelefonoFijo.Text      = telefono_fijo;
                    txtTelefonoMovil.Text     = telefono_movil;
                    cbRegion.SelectedValue    = _region;
                    cbProvincia.SelectedValue = _id_provincia;
                    cbComuna.SelectedValue    = id_comuna;
                    _estado = estado;
                    if (_estado.Equals("1"))
                    {
                        txtEstado.Text = "ACTIVO";
                    }
                    else
                    {
                        txtEstado.Text = "DASACTIVADO";
                    }
                    txtEstado.Enabled     = false;
                    txtEmpresa.Text       = auxEmpresa.Nombre;
                    txtEmpresa.ReadOnly   = true;
                    txtEmpresa.Enabled    = false;
                    cbCargo.SelectedValue = id_cargo;
                    //se vacian variables para que no queden con informacion
                    _rut_usuario      = null;
                    _primer_nombre    = null;
                    _segundo_nombre   = null;
                    _primer_apellido  = null;
                    _segundo_apellido = null;
                    _direccion        = null;
                    _telefono_fijo    = null;
                    _telefono_movil   = null;
                    _estado           = null;
                    _id_comuna        = null;
                    //Variable para interaccion de botones (0 = ninguno) (1 = modificar) - (2 = guardar)
                    _guardar = 1;
                }
                else// mostrar
                {
                    //Se cargan las clases de comuna provincia y region mediante web service
                    ServiceProcess_Comuna.Comuna       auxComuna    = new ServiceProcess_Comuna.Comuna();
                    ServiceProcess_Provincia.Provincia auxProvincia = new ServiceProcess_Provincia.Provincia();
                    //Se buscan comuna y provincia
                    auxComuna    = auxServiceComuna.TraerComunaConEntidad_Escritorio(Convert.ToInt32(id_comuna));
                    auxProvincia = auxServiceProvincia.TraerProvinciaConEntidad_Escritorio(auxComuna.Id_provincia);
                    //Se almacena en variables
                    int _id_provincia = auxProvincia.Id_provincia;
                    int _region       = auxProvincia.Id_region;
                    //Cambiar Titulo de Modal
                    lblTitulo.Text = tituloModal;
                    //Se habilita Boton
                    btnGuardar.Visible  = false;
                    btnCancelar.Visible = false;
                    btnVolver.Visible   = true;
                    //Se carga combos de estado y region
                    cargarComboRegion();
                    cargarComboCargo(rut_empresa);
                    //bloquear combobox
                    cbRegion.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbProvincia.DropDownStyle = ComboBoxStyle.DropDownList;
                    cbComuna.DropDownStyle    = ComboBoxStyle.DropDownList;
                    cbCargo.DropDownStyle     = ComboBoxStyle.DropDownList;
                    cbRegion.Enabled          = false;
                    cbCargo.Enabled           = false;
                    //se inactiva txtbox de rut de Usuario
                    txtRutUsuario.ReadOnly = true;
                    txtRutUsuario.Enabled  = false;
                    //bloquear cajas de texto
                    txtRutUsuario.Enabled      = false;
                    txtPrimerNombre.Enabled    = false;
                    txtSegundoNombre.Enabled   = false;
                    txtPrimerApellido.Enabled  = false;
                    txtSegundoApellido.Enabled = false;
                    txtDireccion.Enabled       = false;
                    txtTelefonoFijo.Enabled    = false;
                    txtTelefonoMovil.Enabled   = false;
                    txtEmpresa.Enabled         = false;
                    //se pasan datos a cajas de texto de cuadro de datos
                    txtRutUsuario.Text        = rut_usuario;
                    txtPrimerNombre.Text      = primer_nombre;
                    txtSegundoNombre.Text     = segundo_nombre;
                    txtPrimerApellido.Text    = primer_apellido;
                    txtSegundoApellido.Text   = segundo_apellido;
                    txtDireccion.Text         = direccion;
                    txtTelefonoFijo.Text      = telefono_fijo;
                    txtTelefonoMovil.Text     = telefono_movil;
                    cbRegion.SelectedValue    = _region;
                    cbProvincia.SelectedValue = _id_provincia;
                    cbComuna.SelectedValue    = id_comuna;
                    _estado = estado;
                    if (_estado.Equals("1"))
                    {
                        txtEstado.Text = "ACTIVO";
                    }
                    else
                    {
                        txtEstado.Text = "DASACTIVADO";
                    }
                    txtEstado.Enabled     = false;
                    txtEmpresa.Text       = auxEmpresa.Nombre;
                    cbCargo.SelectedValue = id_cargo;
                    cbProvincia.Enabled   = false;
                    cbComuna.Enabled      = false;
                    //se vacian variables para que no queden con informacion
                    _rut_usuario      = null;
                    _primer_nombre    = null;
                    _segundo_nombre   = null;
                    _primer_apellido  = null;
                    _segundo_apellido = null;
                    _direccion        = null;
                    _telefono_fijo    = null;
                    _telefono_movil   = null;
                    _estado           = null;
                    _id_comuna        = null;
                    //Variable para interaccion de botones (0 = ninguno) (1 = modificar) - (2 = guardar)
                    _guardar = 3;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al cargar Informacion Modal Usuario, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }