private void toolStripButton2_Click(object sender, EventArgs e) { DireccionGestor.setcloseshowuser(); if (DireccionGestor.getorigen() == "" || DireccionGestor.getorigen() == null || DireccionGestor.getorigen() == "out") { UserAccessForm menu = new UserAccessForm(); //menu.WindowState = FormWindowState.Normal; menu.Show(); LoginClass save = new LoginClass(); // this.Close(); } else if (DireccionGestor.getorigen() == "buscador" || UsersShowForm.getstate() == "edit") { UsersShowForm menu = new UsersShowForm(); //menu.WindowState = FormWindowState.Maximized; menu.Show(); LoginClass save = new LoginClass(); // this.Hide(); } else if (DireccionGestor.getorigen() == "inicio") { DireccionGestor menu = new DireccionGestor(); //menu.WindowState = FormWindowState.Maximized; menu.Show(); LoginClass save = new LoginClass(); // this.Hide(); } this.Close(); }
private void backbuttonstrip_Click(object sender, EventArgs e) { UserAccessForm begin = new UserAccessForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); }
private void cerrarUsuarioToolStripMenuItem_Click(object sender, EventArgs e) { UserAccessForm moveobject = new UserAccessForm(); moveobject.WindowState = FormWindowState.Normal; moveobject.Show(); this.Close(); }
private void cancelbuttonstrip_Click(object sender, EventArgs e) { DireccionGestor.setcloseshowuser(); UserAccessForm begin = new UserAccessForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); }
private void cancelbutton_Click(object sender, EventArgs e) { UserAccessForm menu = new UserAccessForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); LoginClass save = new LoginClass(); this.Close(); }
private void aceptbutton_Click(object sender, EventArgs e) { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string targetPath = System.IO.Path.Combine(path, "users"); if (!System.IO.Directory.Exists(targetPath)) { System.IO.Directory.CreateDirectory(targetPath); } FuncionClass save = new DireccionLib.FuncionClass(); save.saveperfil(dbserver.Text, dbname.Text, dbuser.Text, dbpassword.Text, dbport.Text, targetPath); UserAccessForm.setmode("carga"); UserAccessForm menu = new UserAccessForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); }
private void cancelbuttonstrip_Click(object sender, EventArgs e) { nameBox.Text = ""; passwordbox.Text = ""; passwordsecuritybox.Text = ""; askbox1.Text = ""; askbox2.Text = ""; askbox3.Text = ""; askbox4.Text = ""; askbox5.Text = ""; answerbox1.Text = ""; answerbox2.Text = ""; answerbox3.Text = ""; answerbox4.Text = ""; answerbox5.Text = ""; pictureBox.ImageLocation = ""; LoginClass save = new LoginClass(); if (UserAccessForm.getusername() == null || UserAccessForm.getusername() == "") { UserAccessForm menu = new UserAccessForm(); menu.WindowState = FormWindowState.Maximized; menu.Show(); this.Close(); save = new LoginClass(); } else { DireccionGestor menu = new DireccionGestor(); menu.WindowState = FormWindowState.Maximized; menu.Show(); this.Close(); save = new LoginClass(); } }
private void savebuttonstrip_Click(object sender, EventArgs e) { int hour = DateTime.Now.Hour; int min = DateTime.Now.Minute; int sec = DateTime.Now.Second; int day = DateTime.Now.Day; int month = DateTime.Now.Month; int year = DateTime.Now.Year; string fecha = day.ToString() + "/" + month.ToString() + "/" + year.ToString(); string hora = hour.ToString() + ":" + min.ToString() + ":" + sec.ToString(); carga men = new carga(); men.WindowState = FormWindowState.Normal; men.Show(); LoginClass save = new LoginClass(dbserver, dbname, dbuser, dbpassword, dbport); if (UsersShowForm.getstate() == "edit") { if (nameBox.Text == "" || passwordbox.Text == "" || usercombo.Text == "" || askbox1.Text == "" || answerbox1.Text == "" || askbox2.Text == "" || answerbox2.Text == "" || askbox3.Text == "" || answerbox3.Text == "" || askbox4.Text == "" || answerbox4.Text == "" || askbox5.Text == "" || answerbox5.Text == "") { men.Close(); if (nameBox.Text == "") { nameBox.BackColor = Color.Red; } else { nameBox.BackColor = Color.Green; } if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (usercombo.Text == "") { usercombo.BackColor = Color.Red; } else { usercombo.BackColor = Color.Green; } if (askbox1.Text == "") { askbox1.BackColor = Color.Red; } else { askbox1.BackColor = Color.Green; } if (answerbox1.Text == "") { answerbox1.BackColor = Color.Red; } else { answerbox1.BackColor = Color.Green; } if (askbox2.Text == "") { askbox2.BackColor = Color.Red; } else { askbox2.BackColor = Color.Green; } if (answerbox2.Text == "") { answerbox2.BackColor = Color.Red; } else { answerbox2.BackColor = Color.Green; } if (askbox3.Text == "") { askbox3.BackColor = Color.Red; } else { askbox3.BackColor = Color.Green; } if (answerbox3.Text == "") { answerbox3.BackColor = Color.Red; } else { answerbox3.BackColor = Color.Green; } if (askbox4.Text == "") { askbox4.BackColor = Color.Red; } else { askbox4.BackColor = Color.Green; } if (answerbox4.Text == "") { answerbox4.BackColor = Color.Red; } else { answerbox4.BackColor = Color.Green; } if (askbox5.Text == "") { askbox5.BackColor = Color.Red; } else { askbox5.BackColor = Color.Green; } if (answerbox5.Text == "") { answerbox5.BackColor = Color.Red; } else { answerbox5.BackColor = Color.Green; } if (institucionbox.Text == "") { institucionbox.BackColor = Color.Red; } else { institucionbox.BackColor = Color.Green; } if (telefonobox.Text == "") { telefonobox.BackColor = Color.Red; } else { telefonobox.BackColor = Color.Green; } if (emailbox.Text == "") { emailbox.BackColor = Color.Red; } else { emailbox.BackColor = Color.Green; } MessageBox.Show("HAY DATOS IMPORTANTES VACIOS"); } else { string name = nameBox.Text; string password = passwordbox.Text; string usertipo = usercombo.Text; string ask1 = askbox1.Text; string answer1 = answerbox1.Text; string ask2 = askbox2.Text; string answer2 = answerbox2.Text; string ask3 = askbox3.Text; string answer3 = answerbox3.Text; string ask4 = askbox4.Text; string answer4 = answerbox4.Text; string ask5 = askbox5.Text; string answer5 = answerbox5.Text; string foto = picturetextbox.Text; string email = emailbox.Text; string telefono = telefonobox.Text; string institucion = institucionbox.Text; string orden = "UPDATE users_table SET USER_NAME= '" + name + "', USER_PASSWORD='******', USERTIPO='" + usertipo + "', QUESTION1='" + ask1 + "',ANSWER1='" + answer1 + "', QUESTION2='" + ask2 + "',ANSWER2='" + answer2 + "',QUESTION3='" + ask3 + "',ANSWER3='" + answer3 + "',QUESTION4='" + ask4 + "',ANSWER4='" + answer4 + "',QUESTION5='" + ask5 + "',ANSWER5='" + answer5 + "',PICTURE_ROUTE='" + picturetextbox.Text + "' ,INSTITUCION='" + institucion + "',TELEFONO='" + telefono + "',EMAIL='" + email + "' WHERE USER_NAME = '" + UsersShowForm.getdatum()[0] + "' AND USERTIPO = '" + UsersShowForm.getdatum()[1] + "' AND ID = '" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION = '" + UsersShowForm.getdatum()[3] + "'; "; save.ordensql(orden); men.Close(); MessageBox.Show("USUARIO " + UsersShowForm.getdatum()[0] + " HA SIDO MODIFICADO"); if (UserAccessForm.getusername() != nameBox.Text) { UserAccessForm add = new UserAccessForm(); add.WindowState = FormWindowState.Maximized; add.Show(); this.Close(); } else { UsersShowForm add = new UsersShowForm(); add.WindowState = FormWindowState.Maximized; add.Show(); this.Close(); } } } else { if (save.UserNoCopied(nameBox.Text) == true) { men.Close(); MessageBox.Show("El usuario " + nameBox.Text + " ya existe"); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); DireccionGestor menu = new DireccionGestor(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } else if (save.UserNoCopied(nameBox.Text) == false) { if (passwordbox.Text != passwordsecuritybox.Text) { men.Close(); MessageBox.Show("LAS CONTRASEÑAS NO COINCIDEN"); } else { if (nameBox.Text == "" || passwordbox.Text == "" || passwordsecuritybox.Text == "" || askbox1.Text == "" || askbox2.Text == "" || askbox3.Text == "" || askbox4.Text == "" || askbox5.Text == "" || answerbox1.Text == "" || answerbox2.Text == "" || answerbox3.Text == "" || answerbox4.Text == "" || answerbox5.Text == "" || emailbox.Text == "" || telefonobox.Text == "" || institucionbox.Text == "") { men.Close(); MessageBox.Show("Hay datos importantes vacios, termine el formulario."); } else { if (DireccionGestor.getorigen() == "inicio") { //institucion, telefono, email if (save.CreateNewUser(nameBox.Text, passwordbox.Text, picturetextbox.Text, askbox1.Text, askbox2.Text, askbox3.Text, askbox4.Text, askbox5.Text, answerbox1.Text, answerbox2.Text, answerbox3.Text, answerbox4.Text, answerbox5.Text, usercombo.Text, fecha, hora, institucionbox.Text, telefonobox.Text, emailbox.Text) == true) { men.Close(); MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO EXITOSAMENTE."); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); DireccionGestor menu = new DireccionGestor(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } else if (DireccionGestor.getorigen() == "buscador") { men.Close(); MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO."); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); UsersShowForm menu = new UsersShowForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } else { men.Close(); MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO."); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); DireccionGestor menu = new DireccionGestor(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } } else if (DireccionGestor.getorigen() == "" || DireccionGestor.getorigen() == null || DireccionGestor.getorigen() == "out") { //institucion,telefono,email if (save.CreateNewUser(nameBox.Text, passwordbox.Text, picturetextbox.Text, askbox1.Text, askbox2.Text, askbox3.Text, askbox4.Text, askbox5.Text, answerbox1.Text, answerbox2.Text, answerbox3.Text, answerbox4.Text, answerbox5.Text, usercombo.Text, fecha, hora, institucionbox.Text, telefonobox.Text, emailbox.Text) == true) { men.Close(); MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " NO PUDO SER CREADO."); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); UserAccessForm menu = new UserAccessForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } else { men.Close(); MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO EXITOSAMENTE."); if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { save = new LoginClass(); UserAccessForm menu = new UserAccessForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } else { save = new LoginClass(); UserAddForm menu = new UserAddForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } } } } } } save = new LoginClass(); }
private void OKbutton_Click(object sender, EventArgs e) { string orden; if (UsersShowForm.getstate() == "change") { if (passwordbox.Text == "" || newpasstextbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (newpasstextbox.Text == "") { newpasstextbox.BackColor = Color.Red; } else { newpasstextbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else if (newpasstextbox.Text != repettextbox.Text) { repettextbox.BackColor = Color.Red; MessageBox.Show("LOS CAMPOS PARA CAMBIAR LAS CONTRASEÑA DEBEN DE SER IGUALES"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; orden = "UPDATE users_table SET USER_PASSWORD='******' WHERE USER_NAME='" + UsersShowForm.getdatum()[0] + "' AND USERTIPO='" + UsersShowForm.getdatum()[1] + "' AND ID='" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION='" + UsersShowForm.getdatum()[3] + "';"; if (show.ordensql(orden) == true) { MessageBox.Show("CONTRASEÑA CAMBIADA CON EXITO"); show = new LoginClass(); this.Close(); } else { MessageBox.Show("CONTRASEÑA CAMBIADA"); show = new LoginClass(); this.Close(); } } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIFIQUE"); passwordbox.BackColor = Color.Red; newpasstextbox.Text = ""; repettextbox.Text = ""; cuenta++; if (cuenta == 3) { MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Maximized; begin.Show(); this.Close(); } } } } else if (UsersShowForm.getstate() == "edit") { if (passwordbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else if (passwordbox.Text != repettextbox.Text) { repettextbox.BackColor = Color.Red; MessageBox.Show("LAS CONTRASEÑAS DEBEN DE SER IGUALES"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; UserAddForm add = new UserAddForm(); add.WindowState = FormWindowState.Maximized; add.Show(); DireccionGestor.setcloseshowuser(); this.Close(); } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE"); passwordbox.BackColor = Color.Red; newpasstextbox.Text = ""; repettextbox.Text = ""; cuenta++; if (cuenta == 3) { MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } } } } else if (UsersShowForm.getstate() == "delete") { if (passwordbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_employee_table;`"; show.ordensql(orden); orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_student_table;`"; show.ordensql(orden); orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_events_table;`"; show.ordensql(orden); orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_movements_table`;"; show.ordensql(orden); orden = "delete from users.users_table WHERE USER_NAME= '" + UsersShowForm.getdatum()[0] + "' AND USERTIPO='" + UsersShowForm.getdatum()[1] + "' AND ID='" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION='" + UsersShowForm.getdatum()[3] + "';"; show.ordensql(orden); MessageBox.Show("USUARIO " + UsersShowForm.getdatum()[0] + " ELIMINADO"); if (UserAccessForm.getusername() == UsersShowForm.getdatum()[0]) { DireccionGestor.setcloseshowuser(); UserAccessForm begin = new UserAccessForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } else { show = new LoginClass(); UsersShowForm.setrefresh("refresh"); this.Close(); } } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE"); cuenta++; if (cuenta == 3) { MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } } } } else if (UsersShowForm.getstate() == "save") { if (passwordbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; //some codde heereeee } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE"); cuenta++; if (cuenta == 3) { MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } } } } else if (UsersShowForm.getstate() == "cargar") { if (passwordbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; //some codde heereeee } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE"); cuenta++; if (cuenta == 3) { MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } } } } else if (UsersShowForm.getstate() == "comprobar") { if (passwordbox.Text == "" || repettextbox.Text == "") { if (passwordbox.Text == "") { passwordbox.BackColor = Color.Red; } else { passwordbox.BackColor = Color.Green; } if (repettextbox.Text == "") { repettextbox.BackColor = Color.Red; } else { repettextbox.BackColor = Color.Green; } MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS"); } else { LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (show.setConection(userlabel.Text, passwordbox.Text)) { cuenta = 0; ShowSubjects.setpaso(true); } else { MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE"); cuenta++; if (cuenta == 3) { ShowSubjects.setpaso(false); MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS"); UserSecurityForm begin = new UserSecurityForm(); begin.WindowState = FormWindowState.Normal; begin.Show(); this.Close(); } } } /////////////////////////////////// } else { MessageBox.Show("HA OCURRIDO ALGO DURANTE EL PROCESO"); } }