private void ExecuteLogin() { if (this.txtUsuario.Text == string.Empty || this.txtPass.Text == string.Empty) { this.lblError.Text = "Favor de Introducir Usuario y/o Contraseña."; this.lblError.Visible = true; } else { this.lblError.Visible = false; string user, pass; user = txtUsuario.Text; pass = txtPass.Text; BLL_SIA ObjSia = new BLL_SIA(ConfigurationSettings.AppSettings["LDAP"].ToString(), "DBConnection", ConfigurationSettings.AppSettings["AppKey"].ToString(), user, pass, ConfigurationSettings.AppSettings["Dominio"].ToString()); InfUsuario_SIA infUsr = ObjSia.Autentica(); SessionUser = infUsr; if (infUsr.Valido) { Thread th1 = default(Thread); th1 = new Thread(new ThreadStart(run)); th1.Start(); this.Close(); } else { this.lblError.Text = infUsr.Mensaje; this.lblError.Visible = true; } } }
private void CreateMenu() { TreeNode tNode; tNode = tvMenu.Nodes.Add("-1", "Inicio"); InfUsuario_SIA infUsr = SessionUser; int intIndice = 1; InfSeguridad_SIA[] infSeguridad = infUsr.Seguridad; foreach (InfSeguridad_SIA SegPadre in infSeguridad) { if (SegPadre.Activo) { tNode = tvMenu.Nodes.Add(SegPadre.ModuloID.ToString(), SegPadre.Nombre_Modulo, SegPadre.Enlace); foreach (InfSeguridad_SIA SegHijo in SegPadre.SeguridadHijo) { if (SegHijo.Activo) { tvMenu.Nodes[intIndice].Nodes.Add(SegHijo.ModuloID.ToString(), SegHijo.Nombre_Modulo, SegHijo.Enlace); } } } intIndice++; } tvMenu.ExpandAll(); }
public frmPrincipal(InfUsuario_SIA sessionUser) { this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); InitializeComponent(); SessionUser = sessionUser; }
private void InitialConfigs() { this.pnlWorkSpace.Parent = this; ScreenWidth = Screen.PrimaryScreen.WorkingArea.Size.Width; ScreenHeight = Screen.PrimaryScreen.WorkingArea.Size.Height; SetPanelBar(); CreateMenu(); InfUsuario_SIA infUsr = SessionUser; InfSeguridad_SIA[] infSeguridad = infUsr.Seguridad; MemoryStream msImage = new MemoryStream(infUsr.Foto); Image ImgBK = Image.FromStream(msImage); FotoUsuario = Image.FromStream(msImage); this.lblUsuario.Text = infUsr.Nombre; this.lblDepartamento.Text = infUsr.Departamento; }
public void BuildForm(ref System.Windows.Forms.Panel pnlSpaceWork, string NameOfForm, bool Fill, string NameForm, InfUsuario_SIA InfUsr) { try { Form fa = null; if (!CheckInstance(ref pnlSpaceWork, NameOfForm)) { Assembly asm = Assembly.GetEntryAssembly(); //Invoca el Assembly donde estan los catálogos [Forms] Type formtype = asm.GetType("Ventas.Formularios." + NameOfForm); fa = (Form)Activator.CreateInstance(formtype, new object[] { NameForm, InfUsr }); //fa = (Form)Activator.CreateInstance(formtype, true); fa.TopLevel = false; fa.Dock = DockStyle.Fill; fa.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; fa.StartPosition = FormStartPosition.CenterParent; fa.Parent = pnlSpaceWork; if (Fill) { fa.Width = pnlSpaceWork.Width; fa.Height = pnlSpaceWork.Height; } else { pnlSpaceWork.Width = fa.Width; pnlSpaceWork.Height = fa.Height; } pnlSpaceWork.Controls.Add(fa); } // MinimizedAllForms(ref pnlSpaceWork); //ShowFormForms(ref pnlSpaceWork, NameOfForm); // SetVisiblepnlManifest(ref pnlSpaceWork, true); } catch (Exception ex) { throw ex; } }