コード例 #1
0
 public frmKullaniciGuncelle(Kullanici kullanici)
 {
     InitializeComponent();
     _kullanici       = kullanici;
     kullaniciListele = this.Owner as frmKullaniciListele;
     _kullaniciBLL    = new KullaniciBLL();
     _rol             = new RolBLL();
 }
コード例 #2
0
        private void FormRegistro_Load(object sender, EventArgs e)
        {
            this.MdiParent = Program.mainForm;

            foreach (RolBLL rol in RolBLL.ListarRoles())
            {
                comboRol.Items.Add(rol);
            }
        }
コード例 #3
0
 public FormularioUsuario() : base()
 {
     RevisarRol();
     InitializeComponent();
     usuarioBLL = new UsuarioBLL(new Repository <Usuario>());
     _rolBLL    = new RolBLL(new RolesRepository());
     RefrescarGrilla();
     CargarRoles();
 }
コード例 #4
0
ファイル: Login.cs プロジェクト: sektor1987/WinformsNcapas
        private void Execution()
        {
            CheckForIllegalCrossThreadCalls = false;
            metroButton1.Invoke((MethodInvoker) delegate { spnLoad.Visible = true; lblLoad.Visible = true; metroButton1.Enabled = false; });
            Application.DoEvents();

            int    rutUsuario = Convert.ToInt32(this.txtRut.Text);
            string password   = this.txtContraseña.Text;

            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            Boolean resp = VHWS.Autenticate(rutUsuario, password);

            //int result = negocioUsuario.validarLoginUsuario(rutUsuario, password);
            //if (result == 1)
            if (resp)
            {
                UsuarioBLL negocio       = new UsuarioBLL();
                RolBLL     rolNegocio    = new RolBLL();
                var        usuarioActual = negocio.buscarUsuario(rutUsuario.ToString());
                //var rolAsociado =  rolNegocio.getById(rutUsuario);
                Common.direccion = usuarioActual.DIR_PARTICULAR;
                Common.email     = usuarioActual.EMAIL;
                Common.rut       = usuarioActual.RUT_USUARIO;
                //Common.cargo = usuarioActual.CARGO;
                Common.rol = (int)usuarioActual.ID_ROL;
                //txtApMat.Text = usuarioActual.AP_MATERNO;
                //txtApPat.Text = usuarioActual.AP_PATERNO;
                //txtCargo.Text = usuarioActual.CARGO;
                //txtDir.Text = usuarioActual.DIR_PARTICULAR;
                //txtEmail.Text = usuarioActual.EMAIL;
                //txtNombre.Text = usuarioActual.NOMBRE;
                //txtTelIns.Text = usuarioActual.TEL_INSTITUCIONAL;
                //txtTelPart.Text = usuarioActual.TEL_PARTICULAR;
                //txtCargo.Text = usuarioActual.CARGO;
                //txtRut.Text = usuarioActual.RUT_USUARIO.ToString();
                //cboUnidad.SelectedValue = usuarioActual.ID_UNIDAD_INTERNA;
                Common.LogTxt("Usuario Logueado", Common.rut.ToString());
                this.Hide();
                showFormBusqueda();
            }
            else
            {
                MessageBox.Show("Usuario no existe", "Error", MessageBoxButtons.OK);
                metroButton1.Invoke((MethodInvoker) delegate { spnLoad.Visible = false; lblLoad.Visible = false; metroButton1.Enabled = true; });
            }
        }
コード例 #5
0
        public AgregarUsuarios(Control control)
        {
            this.control = control;

            InitializeComponent();

            List <Rol> listadoRoles = RolBLL.ListadoRoles();

            //Asigar lista a combo
            cmbRol.DataSource = listadoRoles;

            //Asignar elemento que se vera en la pantalla
            cmbRol.DisplayMember = "RolUsuario";

            //Asignar cual elemento va por detras
            cmbRol.ValueMember   = "IdRol";
            cmbRol.SelectedIndex = -1;
        }
コード例 #6
0
        private void ListRol()
        {
            EnsayoBLL capanegocios = new EnsayoBLL();

            try
            {
                var lstRol = new RolBLL().List();
                ddlFRol.DataSource     = lstRol;
                ddlFRol.DataValueField = "IdRol";
                ddlFRol.DataTextField  = "Nombre";
                ddlFRol.DataBind();
                ddlFRol.Items.Insert(0, new ListItem("-- TODOS --", "0"));

                ddlRol.DataSource     = lstRol;
                ddlRol.DataValueField = "IdRol";
                ddlRol.DataTextField  = "Nombre";
                ddlRol.DataBind();
                ddlRol.Items.Insert(0, new ListItem("-- Seleccione --", "0"));
            }
            catch (Exception ex)
            {
                errores = ex.Message;
            }
        }
コード例 #7
0
        private void cboUsuario_SelectedIndexChanged(object sender, EventArgs e)
        {
            //string key = "";
            ComboBox comboBox = (ComboBox)sender;


            KeyValuePair <string, string> selectedUser = (KeyValuePair <string, string>)cboUsuario.SelectedItem;
            string keySearch   = selectedUser.Key;
            string valueSearch = selectedUser.Value;

            if (keySearch != "999")
            {
                //EmpresaServicio servicio = new EmpresaServicio();
                //Usuarios_empresas usuario_empresa = new Usuarios_empresas();
                //usuario_empresa = servicio.buscarUsuario(keySearch);
                //this.txtPasword.Text = usuario_empresa.uem_password;
                //this.txtUsuario.Text = usuario_empresa.uem_rut;
                //cboEmpresa.SelectedValue = usuario_empresa.uem_emp_id.ToString();
                UsuarioBLL negocio       = new UsuarioBLL();
                RolBLL     rolNegocio    = new RolBLL();
                var        usuarioActual = negocio.buscarUsuario(keySearch);
                txtApMat.Text = usuarioActual.AP_MATERNO;
                txtApPat.Text = usuarioActual.AP_PATERNO;
                //txtCargo.Text = usuarioActual.CARGO;
                txtDir.Text             = usuarioActual.DIR_PARTICULAR;
                txtEmail.Text           = usuarioActual.EMAIL;
                txtNombre.Text          = usuarioActual.NOMBRE;
                txtTelIns.Text          = usuarioActual.TEL_INSTITUCIONAL;
                txtTelPart.Text         = usuarioActual.TEL_PARTICULAR;
                txtCargo.Text           = usuarioActual.CARGO;
                txtRut.Text             = usuarioActual.RUT_USUARIO.ToString();
                cboUnidad.SelectedValue = usuarioActual.ID_UNIDAD_INTERNA;
                try
                {
                    cboRol.SelectedValue = usuarioActual.ID_ROL;
                }
                catch (Exception)
                {
                    cboRol.SelectedValue = 1;
                }
                //cboRol.SelectedValue = ((new System.Collections.Generic.HashSetDebugView<DAL.TBL_ROL>(usuarioActual.TBL_ROL as System.Collections.Generic.HashSet<DAL.TBL_ROL>)).Items[0]).ID_ROL;


                //int rol = rolNegocio.obtenerRolPorUsuario((int)usuarioActual.RUT_USUARIO);
                //var results = from r in db.Roles
                //              where roleIds.Contains(r.Id)
                //              select r.Employees;
            }
            else
            {
                txtApMat.Text           = "";
                txtApPat.Text           = "";
                txtCargo.Text           = "";
                txtDir.Text             = "";
                txtEmail.Text           = "";
                txtNombre.Text          = "";
                txtRut.Text             = "";
                txtTelIns.Text          = "";
                txtTelPart.Text         = "";
                cboRol.SelectedValue    = 1;
                cboUnidad.SelectedValue = 1;
                txtCargo.Text           = "";
            }
            //if (cboEmpresa.SelectedItem != null)
            //{
            //    KeyValuePair<string, string> selectedEmpresar = (KeyValuePair<string, string>)cboEmpresa.SelectedItem;
            //    string keySearchEmpresa = selectedUser.Key;
            //    string valueSearchEmpresa = selectedUser.Value;

            //}
        }