private void AddSubject_Load(object sender, EventArgs e) { OKbutton.BackColor = Color.Green; cancelbutton.BackColor = Color.Red; subjectverbutton.BackColor = Color.Blue; EmployeeClass ver = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden = "SELECT `NOMBRE COMPLETO` FROM " + UserAccessForm.getusername() + "_employee_table;"; ver.FillNameBox(comboasignado, orden); if (DireccionGestor.getorigen() == "inicio") { titlelabel.Text = "AGREGAR ASIGNATURA"; } else if (DireccionGestor.getorigen() == "editor") { titlelabel.Text = "MODIFICAR ASIGNATURA"; try { asignaturatextbox.Text = ShowSubjects.getinfo()[0]; comboasignado.Text = ShowSubjects.getinfo()[1]; descripcionbox.Text = ShowSubjects.getinfo()[2]; subjectverbutton.Enabled = false; } catch (NullReferenceException epd) { epd.ToString(); } } else if (DireccionGestor.getorigen() == "buscador") { titlelabel.Text = "AGREGAR ASIGNATURA"; subjectverbutton.Enabled = false; } ver.FillNameBox(comboasignado, orden); }
private void subjectverbutton_Click(object sender, EventArgs e) { ShowSubjects see = new ShowSubjects(); see.WindowState = FormWindowState.Normal; see.Show(); this.Close(); }
private void aSIGNATURASToolStripMenuItem1_Click(object sender, EventArgs e) { LoginClass create = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); create.CreateSubjectTable(UserAccessForm.getusername()); origen = "inicio"; ShowSubjects agendaobjectl = new ShowSubjects(); agendaobjectl.WindowState = FormWindowState.Normal; agendaobjectl.Show(); }
private void OKbutton_Click(object sender, EventArgs e) { LoginClass ver; string asign; string orden; string teach; if (asignaturatextbox.Text == "" || comboasignado.Text == "" || descripcionbox.Text == "") { if (asignaturatextbox.Text == "") { asignaturatextbox.BackColor = Color.Red; } else { asignaturatextbox.BackColor = Color.Green; } if (comboasignado.Text == "") { comboasignado.BackColor = Color.Red; } else { comboasignado.BackColor = Color.Green; } if (descripcionbox.Text == "") { descripcionbox.BackColor = Color.Red; } else { descripcionbox.BackColor = Color.Green; } } else if (DireccionGestor.getorigen() == "inicio") { carga pap = new carga(); pap.WindowState = FormWindowState.Normal; pap.Show(); ver = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string complete = UserAccessForm.getusername() + "_subject_table"; orden = "SELECT ASIGNATURA FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; asign = ver.takedatatable(orden, "ASIGNATURA"); orden = "SELECT ASIGNADO FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; teach = ver.takedatatable(orden, "ASIGNADO"); try { if ((asign == asignaturatextbox.Text) && (teach == comboasignado.Text)) { MessageBox.Show("LA ASIGNATURA " + asignaturatextbox.Text + " FUE ASIGNADA A " + comboasignado.Text); pap.Close(); } else { ver.AddSubject(asignaturatextbox.Text, comboasignado.Text, descripcionbox.Text, UserAccessForm.getusername()); pap.Close(); MessageBox.Show("ASIGNATURA " + asignaturatextbox.Text + " HA SIDO CREADA"); ShowSubjects.setchange("modify"); this.Close(); } } catch (NullReferenceException PAP) { PAP.ToString(); pap.Close(); MessageBox.Show("ASIGNATURA " + asignaturatextbox.Text + " HA SIDO CREADA"); ShowSubjects.setchange("modify"); this.Close(); } } else if (DireccionGestor.getorigen() == "editor") { carga pap = new carga(); pap.WindowState = FormWindowState.Normal; pap.Show(); ver = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string complete = UserAccessForm.getusername() + "_subject_table"; orden = "SELECT * FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; orden = "SELECT ASIGNATURA FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; asign = ver.takedatatable(orden, "ASIGNATURA"); orden = "SELECT ASIGNADO FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; teach = ver.takedatatable(orden, "ASIGNADO"); if ((asign == asignaturatextbox.Text) && (teach == comboasignado.Text)) { pap.Close(); MessageBox.Show("LA ASIGNATURA " + asignaturatextbox.Text + " FUE ASIGNADA A " + comboasignado.Text); } else { orden = "RENAME TABLE `" + LoginClass.getdata()[1] + "_" + UserAccessForm.getusername() + "_evaluation_student_table` TO `" + asignaturatextbox.Text + "_" + UserAccessForm.getusername() + "_evaluation_student_table`;"; ver.ordensql(orden); orden = "RENAME TABLE `" + LoginClass.getdata()[1] + "_" + UserAccessForm.getusername() + "_calification_student_table` TO `" + asignaturatextbox.Text + "_" + UserAccessForm.getusername() + "_calification_student_table`;"; ver.ordensql(orden); complete = UserAccessForm.getusername() + "_subject_table"; ver.editSubject(asignaturatextbox.Text, comboasignado.Text, descripcionbox.Text, LoginClass.getdata()[1], LoginClass.getdata()[2], UserAccessForm.getusername()); pap.Close(); MessageBox.Show("ASIGNATURA " + LoginClass.getdata()[1] + " HA SIDO EDITADA"); ShowSubjects.setchange("modify"); this.Close(); } } else if (DireccionGestor.getorigen() == "buscador") { carga pap = new carga(); pap.WindowState = FormWindowState.Normal; pap.Show(); ver = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string complete = UserAccessForm.getusername() + "_subject_table"; orden = "SELECT ASIGNATURA FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; asign = ver.takedatatable(orden, "ASIGNATURA"); orden = "SELECT ASIGNADO FROM " + complete + " WHERE ASIGNATURA='" + asignaturatextbox.Text + "' and ASIGNADO='" + comboasignado.Text + "';"; teach = ver.takedatatable(orden, "ASIGNADO"); try { if ((asign == asignaturatextbox.Text) && (teach == comboasignado.Text)) { MessageBox.Show("LA ASIGNATURA " + asignaturatextbox.Text + " FUE ASIGNADA A " + comboasignado.Text); pap.Close(); } else { ver.AddSubject(asignaturatextbox.Text, comboasignado.Text, descripcionbox.Text, UserAccessForm.getusername()); MessageBox.Show("ASIGNATURA " + asignaturatextbox.Text + " HA SIDO CREADA"); ShowSubjects.setchange("modify"); this.Close(); } } catch (NullReferenceException PAP) { PAP.ToString(); pap.Close(); MessageBox.Show("ASIGNATURA " + asignaturatextbox.Text + " HA SIDO CREADA"); ShowSubjects.setchange("modify"); this.Close(); } } }
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"); } }