private EditarRol prepareEditForm(DataGridViewRow row) { Rol rol = this.obtenerRolDeFila(row); EditarRol editarRolForm = (EditarRol)FormsFactory.obtenerFormulario("EditarRol"); editarRolForm.refrescar(); editarRolForm.Controls["labelIdValue"].Text = rol.id.ToString(); editarRolForm.Controls["txtEditarRolNombre"].Text = rol.nombre; ((CheckBox)editarRolForm.Controls["chkEditarRolActivo"]).Checked = rol.estado; foreach (Funcionalidad func in rol.funcionalidades) { for (int index = 0; index <= ((CheckedListBox)editarRolForm.Controls["chkListFuncionalidades"]).Items.Count; index++) { Funcionalidad itemFunc = (Funcionalidad)((CheckedListBox)editarRolForm.Controls["chkListFuncionalidades"]).Items[index]; if (itemFunc.id == func.id) { ((CheckedListBox)editarRolForm.Controls["chkListFuncionalidades"]).SetItemChecked(index, true); break; } } } return(editarRolForm); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); FormsFactory.ListForms(); toolStripStatusLabelUser.Text = "Logged in as : " + BaseObject.User_Name; }
public static void Main(string[] args) { string filePath = args.Length == 1 ? args[0] : null; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(FormsFactory.NewAppForm(filePath)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IFormsFactory factory = new FormsFactory(); Application.Run(new frmLogin(factory)); }
private void btnLoginMenuSalir_Click(object sender, EventArgs e) { Button button = sender as Button; this.Hide(); Login login = (Login)FormsFactory.obtenerFormulario("Login"); login.refrescar(); login.Show(); }
static void Main(string[] args) { log.Info("Start Application"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new TUPUX.Forms.Form2()); if (args.Length > 0) { if (args[0].Equals("2")) { Application.Run(new TUPUX.Forms.FactorsSettings()); } else if (args[0].Equals("3")) { Application.Run(new TUPUX.Forms.EstimationSettings()); } else if (args[0].Equals("4")) { Application.Run(new TUPUX.Forms.ImportExcel()); } else if (args[0].Equals("5")) { FormEdit edit = FormsFactory.GetCurrent(); if (edit != null) { Application.Run(edit); } } else if (args[0].Equals("6")) { new FileGenerator().CreateFiles(null); MessageBox.Show("Files generated successfully!", "File Generation Completed!", MessageBoxButtons.OK, MessageBoxIcon.Information); //Application.Run(new TUPUX.Forms.frmFileGenerator()); } else { Application.Run(new TUPUX.Forms.MainForm()); } } else { //Application.Run(new TUPUX.Forms.ImportExcel()); //Application.Run(new TUPUX.Forms.FactorsSettings()); //FormEdit edit = FormsFactory.GetCurrent(); //if (edit != null) //{ // Application.Run(edit); //} Application.Run(new TUPUX.Forms.MainForm()); } log.Info("End Application"); }
private void btnLoginPerfilContinuar_Click(object sender, EventArgs e) { Rol rolSeleccionado = (Rol)this.comboLoginPerfil.SelectedItem; LoginMenu loginMenu = (LoginMenu)FormsFactory.obtenerFormulario("LoginMenu"); loginMenu.agregarFuncionalidades(DbLogin.obtenerFuncionalidadesPorRol(rolSeleccionado.id)); this.Hide(); loginMenu.Show(); }
private void loginButton_Click(object sender, EventArgs e) { //MONKEY CODE!!! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ if (loginField.Text == "" || passwordField.Text == "") { this.TopMost = true; //Ставим текущую форму поверх всех окон MessageBox.Show("Не все поля заполнены!"); return; } UserProfile profile = DBUtils.AuthorizeUser(loginField.Text, passwordField.Text); //такой пользователь не найден if (profile.password.Equals("") && profile.login.Equals("")) { DialogResult result = MessageBox.Show("Такой пользователь не найден! Зарегистрировать?", "Зарегистрировать?", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.Yes) { profile = DBUtils.RegisterUser(loginField.Text, passwordField.Text); this.Close(); return; } } //логин найден, пароль нет else if (profile.password.Equals("")) { this.TopMost = true; MessageBox.Show("Пароль неверен! Повторите ввод!"); return; } FormsFactory.SetUser(profile); if (profile.role.Equals(Role.STUDENT)) { FormUtils.OpenFormAndCloseCurrent(this, FormsFactory.GetUserMenuForm()); } else { FormUtils.OpenFormAndCloseCurrent(this, FormsFactory.GetAdminMenuForm()); } }
private void seleccionarPerfil(Usuario usuario) { List <Rol> roles = DbLogin.obtenerRolesDeUsuario(usuario); if (roles.Count > 1) { this.Hide(); LoginPerfil loginPerfil = (LoginPerfil)FormsFactory.obtenerFormulario("LoginPerfil"); loginPerfil.agregarRoles(roles); loginPerfil.Show(); } else { if (roles.Count == 1) { this.Hide(); FormsFactory.obtenerFormulario("LoginMenu"); } else { MessageBox.Show("Error: No tiene roles asignados."); } } }
public static void cambiarFormulario(Form origen, String destino) { origen.Hide(); FormsFactory.obtenerFormulario(destino).Show(); }
private void btnLoginCancelar_Click(object sender, EventArgs e) { this.Hide(); FormsFactory.obtenerFormulario("FrbaHotel").Show(); }