private void cargarComboRol()
 {
     try
     {
         ServiceProcess_Rol.Process_RolSoapClient auxServiceRol = new ServiceProcess_Rol.Process_RolSoapClient();
         auxServiceRol.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
         auxServiceRol.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
         DataSet   ds = new DataSet();
         DataTable dt = new DataTable();
         ds = auxServiceRol.TraerTodasRoles_Escritorio();
         dt = ds.Tables[0];
         DataRow fila = dt.NewRow();
         fila["ID_ROL"] = 0;
         fila["NOMBRE"] = "SELECCIONE ROL";
         fila["ESTADO"] = 0;
         dt.Rows.InsertAt(fila, 0);
         cbRol.DropDownStyle = ComboBoxStyle.DropDownList;
         cbRol.DataSource    = dt;
         cbRol.DisplayMember = "NOMBRE";
         cbRol.ValueMember   = "ID_ROL";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error al cargar Informacion cargarComboRol, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 //Metodo Carga Cuadro de Datos en Blanco
 private void cargarDataGridViewPpal()
 {
     try
     {
         //instansear web service con seguridad
         ServiceProcess_Rol.Process_RolSoapClient auxServiceRol = new ServiceProcess_Rol.Process_RolSoapClient();
         auxServiceRol.ClientCredentials.UserName.UserName = Cuenta.Usuario_iis;
         auxServiceRol.ClientCredentials.UserName.Password = Cuenta.Clave_iis;
         ServiceProcess_Rol.Rol auxRol = new ServiceProcess_Rol.Rol();
         //capturar dataset
         DataSet ds = auxServiceRol.TraerTodasRoles_Escritorio();
         //Capturar Tabla
         DataTable dt = ds.Tables[0];
         //contar cantidad de empresas
         int _cantidad_roles = dt.Rows.Count;
         //crear array bidimencional
         string[,] ListaRoles = new string[_cantidad_roles, 3];
         //Recorrer data table
         int _fila = 0;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             //Capturar datos de la fila recorridad en objeto rol
             auxRol.Id_rol = Convert.ToInt32(dt.Rows[i]["Id_rol"]);
             auxRol.Nombre = (String)dt.Rows[i]["Nombre"];
             auxRol.Estado = Convert.ToInt32(dt.Rows[i]["Estado"]);
             //variables temporales de apoyo
             string _estado = string.Empty;
             //cargar array con datos de fila
             ListaRoles[_fila, 0] = auxRol.Id_rol.ToString();
             ListaRoles[_fila, 1] = auxRol.Nombre;
             if (auxRol.Estado == 0)
             {
                 _estado = "DESACTIVADO";
             }
             else
             {
                 _estado = "ACTIVADO";
             }
             ListaRoles[_fila, 2] = _estado;
             //agregar lista a gridview
             dgvRol.Rows.Add(ListaRoles[_fila, 0], ListaRoles[_fila, 1], ListaRoles[_fila, 2]);
             _fila++;
         }
         pbSeleccion.Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en metodo cargarDataGridViewPpal, Contactese con el Administrador Detalle de Error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }