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 namecombo_SelectedIndexChanged(object sender, EventArgs e) { LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); MovementsClass P = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (DireccionGestor.getorigen() == "_payfor_table") { string orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "';"; AP.ShowDataGridfound(datagrid, orden); AP.getcuenta(); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "';"; P.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } else if (DireccionGestor.getorigen() == "_askfor_table") { string orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND DEUDOR='" + namecombo.Text + "';"; AP.ShowDataGridfound(datagrid, orden); AP.getcuenta(); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND DEUDOR='" + namecombo.Text + "';"; P.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); //////////////////////////////////////////////////////////// } }
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 changelabel_Click(object sender, EventArgs e) { panelpad.Hide(); tipobox.Text = "DOP"; tipo.Text = "DOP"; LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); editbutton.Enabled = false; quitarbutton.Enabled = false; if (DireccionGestor.getorigen() == "_payfor_table") { namecombo.Text = ""; cantidadbox.Text = ""; palpad.BackColor = Color.Red; DireccionGestor.setorigen("_askfor_table"); titlelabel.Text = "CUENTAS POR COBRAR"; changelabel.Text = "CUENTAS POR PAGAR"; string orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR DEUDOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden2 = "SELECT DEUDOR FROM " + UserAccessForm.getusername() + "_askfor_table ;"; AP.Fillcombo(namecombo, orden2); panelpad.BackColor = Color.DarkRed; } else if (DireccionGestor.getorigen() == "_askfor_table") { namecombo.Text = ""; cantidadbox.Text = ""; palpad.BackColor = Color.Blue; DireccionGestor.setorigen("_payfor_table"); titlelabel.Text = "CUENTAS POR PAGAR"; changelabel.Text = "CUENTAS POR COBRAR"; string orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; panelpad.BackColor = Color.MidnightBlue; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden2 = "SELECT COBRADOR FROM " + UserAccessForm.getusername() + "_payfor_table ;"; AP.Fillcombo(namecombo, orden2); } }
private void backbuttonstrip_Click(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "agregador") { agendaAdd agendaobject = new agendaAdd(); agendaobject.WindowState = FormWindowState.Normal; agendaobject.Show(); } this.Close(); }
public carga() { InitializeComponent(); if (DireccionGestor.getorigen() == "listo") { //message2.Show(); message.Hide(); } else { //message2.Hide(); message.Show(); } }
private void cancelbutton_Click(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "editor" || DireccionGestor.getorigen() == "buscador") { ShowContacts pop = new ShowContacts(); pop.WindowState = FormWindowState.Normal; pop.Show(); this.Close(); } else { this.Close(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "editor" || DireccionGestor.getorigen() == "buscador") { EmployeeFormSearch menu = new EmployeeFormSearch(); menu.WindowState = FormWindowState.Maximized; menu.Show(); this.Hide(); } else { DireccionGestor menu = new DireccionGestor(); menu.WindowState = FormWindowState.Maximized; menu.Show(); this.Hide(); } }
private void editbutton_Click(object sender, EventArgs e) { entrada = "editar"; string date = fechabox.Value.Day.ToString() + "/" + fechabox.Value.Month.ToString() + "/" + fechabox.Value.Year.ToString(); LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (DireccionGestor.getorigen() == "_payfor_table") { titlepanel.Text = "EDITAR CUENTA POR PAGAR"; string orden = "SELECT * FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "' AND MONTO='" + cantidadbox.Text + "' AND FECHA='" + date + "';"; AP.ShowDataGridfound(datagrid, orden); id = MovementsClass.getdato()[0]; name.Text = MovementsClass.getdato()[1]; fecha.Text = MovementsClass.getdato()[2]; monto.Text = MovementsClass.getdato()[3]; tipo.Text = MovementsClass.getdato()[4]; panelpad.Show(); entrada = "editar"; openpad = true; } else if (DireccionGestor.getorigen() == "_askfor_table") { titlepanel.Text = "EDITAR CUENTA POR COBRAR"; string orden = "SELECT * FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "' AND MONTO='" + cantidadbox.Text + "' AND FECHA='" + date + "';"; AP.ShowDataGridfound(datagrid, orden); id = MovementsClass.getdato()[0]; name.Text = MovementsClass.getdato()[1]; fecha.Text = MovementsClass.getdato()[2]; monto.Text = MovementsClass.getdato()[3]; tipo.Text = MovementsClass.getdato()[4]; panelpad.Show(); entrada = "editar"; openpad = true; } }
private void timer_Tick(object sender, EventArgs e) { TimeClass timeobject = new TimeClass(); hourlabelstrip.Text = timeobject.clockshape(); datelabelstrip.Text = timeobject.dateshape(); AgendaClass ev = new AgendaClass(dbserver, dbname, dbuser, dbpassword, dbport); string hora = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString(); string fechal = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();; string fechashort = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString(); string orden = ""; if (DireccionGestor.getorigen() == "inicio") { orden = "SELECT DESCRIPCION, HORA, PRIORIDAD FROM " + UserAccessForm.getusername() + "_events_table WHERE (HORA='" + hora + "' AND ( FECHA='" + fechal + "' or `FECHA DE RECORDATORIO`='" + fechashort + "'))AND ACTIVO='SI';"; if (ev.getnametarea(orden)) { DireccionGestor.setsombrestatic(ev.getname()); DireccionGestor.setotrostatic(ev.gettime()); DireccionGestor.setprioridadstatic(ev.getprioridad()); DireccionGestor.setestadostatic(true); SystemSounds.Hand.Play(); MessageBox.Show("SON LAS " + ev.gettime() + " ES HORA DE " + ev.getname()); } else if (DireccionGestor.getorigen() == "") { orden = ""; DireccionGestor.setorigen(""); } } cuenta++; if (cuenta == 3000) { cuenta = 0; backbuttonstrip.PerformClick(); } }
private void IngresosForm_Load(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "inicio") { monedatipo.Text = "DOP"; fondoorigen.Text = "EFECTIVO"; } else if (DireccionGestor.getorigen() == "editor") { titleingreso.Text = "MODIFICAR INGRESO"; gastostrip.Text = "MODIFICAR"; datebox.Text = MovementsClass.getdato()[2]; horabox.Text = MovementsClass.getdato()[3]; reasonbox.Text = MovementsClass.getdato()[1]; monedatipo.Text = MovementsClass.getdato()[5]; cuantitybox.Text = MovementsClass.getdato()[4]; explanationbox.Text = MovementsClass.getdato()[6]; fondoorigen.Text = MovementsClass.getdato()[7]; } }
private void cancelbutton_Click(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "buscador" || DireccionGestor.getorigen() == "modificar") { AgendaEvents agendaobject = new AgendaEvents(); agendaobject.WindowState = FormWindowState.Normal; agendaobject.Show(); } else if (DireccionGestor.getorigen() == "editor") { AgendaEvents agendaobject = new AgendaEvents(); agendaobject.WindowState = FormWindowState.Normal; agendaobject.Show(); } else { AgendaClass save = new AgendaClass(); } this.Close(); }
private void addContact_Load(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "inicio" || DireccionGestor.getorigen() == "buscador") { titlelabel.Text = "AGREGAR CONTACTO"; } else { titlelabel.Text = "EDITAR CONTACTO"; if (DireccionGestor.getorigen() == "editor") { nombrebox.Text = ShowContacts.getdataout()[0]; telefonobox.Text = ShowContacts.getdataout()[1]; direccionbox.Text = ShowContacts.getdataout()[2]; emailbox.Text = ShowContacts.getdataout()[3]; } } OKbutton.BackColor = Color.Green; cancelbutton.BackColor = Color.Red; contactsverbutton.BackColor = Color.Blue; }
private void quitarbutton_Click(object sender, EventArgs e) { LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); MovementsClass show = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (DireccionGestor.getorigen() == "_payfor_table") { string userDataName = UserAccessForm.getusername() + "_payfor_table"; string orden = "DELETE from " + userDataName + " where ID='" + id + "' ;"; if (show.ordensql(orden)) { MessageBox.Show("CUENTA POR PAGAR A " + MovementsClass.getdato()[1] + " HA SIDO SALDADA"); } else { MessageBox.Show("CUENTA POR PAGAR A " + MovementsClass.getdato()[1] + " SALDADA"); } limpiarbutton.PerformClick(); } else if (DireccionGestor.getorigen() == "_askfor_table") { string userDataName = UserAccessForm.getusername() + "_askfor_table"; string orden = "DELETE from " + userDataName + " where ID='" + id + "' ;"; if (show.ordensql(orden)) { MessageBox.Show("CUENTA POR COBRAR A " + MovementsClass.getdato()[1] + " HA SIDO SALDADA"); } else { MessageBox.Show("CUENTA POR COBRAR A " + MovementsClass.getdato()[1] + " SALDADA"); } limpiarbutton.PerformClick(); } }
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 buscarbutton_Click(object sender, EventArgs e) { LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden; MovementsClass show = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (DireccionGestor.getorigen() == "_payfor_table") { string userDataName = UserAccessForm.getusername() + "_payfor_table"; if (namecombo.Text == "" || cantidadbox.Text == "") { limpiarbutton.PerformClick(); } else if (namecombo.Text == "" || cantidadbox.Text != "") { orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "';"; AP.ShowDataGridfound(datagrid, orden); AP.getcuenta(); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND COBRADOR='" + namecombo.Text + "';"; show.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } else if (namecombo.Text != "" || cantidadbox.Text == "") { orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND CANTIDAD='" + cantidadbox.Text + "';"; AP.ShowDataGridfound(datagrid, orden); AP.getcuenta(); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND CANTIDAD='" + cantidadbox.Text + "';"; show.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } else if (namecombo.Text != "" || cantidadbox.Text != "") { orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE (`TIPO MONEDA`='" + tipobox.Text + "' AND CANTIDAD='" + cantidadbox.Text + "') or COBRADOR='" + namecombo.Text + "';"; AP.ShowDataGridfound(datagrid, orden); AP.getcuenta(); encontradolabel.Text = AP.getcuenta().ToString(); titlepanel.Text = "AGREGAR COBRADOR"; orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND CANTIDAD='" + cantidadbox.Text + "' AND COBRADOR='" + namecombo.Text + "';"; show.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } } else if (DireccionGestor.getorigen() == "_askfor_table") { string userDataName = UserAccessForm.getusername() + "_askfor_table"; if (namecombo.Text == "" || cantidadbox.Text == "") { limpiarbutton.PerformClick(); } else if (namecombo.Text == "" || cantidadbox.Text != "") { orden = ""; } else if (namecombo.Text != "" || cantidadbox.Text == "") { orden = ""; } else if (namecombo.Text != "" || cantidadbox.Text != "") { orden = ""; } } }
private void OKbutton_Click(object sender, EventArgs e) { cuenta = 0; carga ca = new carga(); ca.WindowState = FormWindowState.Normal; ca.Show(); if (DireccionGestor.getorigen() == "inicio") { if (nombrebox.Text == "" || telefonobox.Text == "") { if (nombrebox.Text == "") { nombrebox.BackColor = Color.Red; } else { nombrebox.BackColor = Color.Green; } if (telefonobox.Text == "") { telefonobox.BackColor = Color.Red; } else { telefonobox.BackColor = Color.Green; } MessageBox.Show("HAY CAMPOS CLAVES VACIOS"); } else { if (direccionbox.Text == "") { direccionbox.Text = "NINGUNA"; } if (emailbox.Text == "") { emailbox.Text = "NINGUNA"; } try { LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); add.AddContact(nombrebox.Text, telefonobox.Text, direccionbox.Text, emailbox.Text, UserAccessForm.getusername().ToString()); MessageBox.Show("NUEVO CONTACTO " + nombrebox.Text + " AGREGADO"); if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { add = new LoginClass(); this.Close(); } else { add = new LoginClass(); addContact menu = new addContact(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } catch (FormatException datethis) { datethis.ToString(); } } } else if (DireccionGestor.getorigen() == "editor") { try { LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); add.ordensql("UPDATE " + UserAccessForm.getusername() + "_contacts_table SET NOMBRE='" + nombrebox.Text + "', TELEFONO='" + telefonobox.Text + "', DIRECCION='" + direccionbox.Text + "', EMAIL='" + emailbox.Text + "' WHERE ID='" + ShowContacts.getdataout()[4] + "';"); MessageBox.Show("CONTACTO " + DireccionGestor.getnombrestatic() + " EDITADO"); ShowContacts show = new ShowContacts(); show.WindowState = FormWindowState.Normal; show.Show(); this.Close(); } catch (FormatException datethis) { datethis.ToString(); } catch (IndexOutOfRangeException oper) { oper.ToString(); } } else if (DireccionGestor.getorigen() == "buscador") { if (nombrebox.Text == "" || telefonobox.Text == "") { if (nombrebox.Text == "") { nombrebox.BackColor = Color.Red; } else { nombrebox.BackColor = Color.Green; } if (telefonobox.Text == "") { telefonobox.BackColor = Color.Red; } else { telefonobox.BackColor = Color.Green; } MessageBox.Show("HAY CAMPOS CLAVES VACIOS"); } else { if (direccionbox.Text == "") { direccionbox.Text = "NINGUNA"; } if (emailbox.Text == "") { emailbox.Text = "NINGUNA"; } try { LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); add.AddContact(nombrebox.Text, telefonobox.Text, direccionbox.Text, emailbox.Text, UserAccessForm.getusername().ToString()); MessageBox.Show("NUEVO CONTACTO " + nombrebox.Text + " AGREGADO"); if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { add = new LoginClass(); ShowContacts ad = new ShowContacts(); ad.WindowState = FormWindowState.Normal; ad.Show(); this.Close(); } else { add = new LoginClass(); addContact menu = new addContact(); menu.WindowState = FormWindowState.Normal; menu.Show(); this.Close(); } } catch (FormatException datethis) { datethis.ToString(); } } } ca.Close(); }
private void comborepeticion_SelectedIndexChanged(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "modificar") { if (comborepeticion.Text == "NO") { paneldias.Hide(); datebox.Enabled = true; } else if (comborepeticion.Text == "ELEGIR") { paneldias.Show(); datebox.Enabled = false; fecha = "00/00/0000"; } else if (comborepeticion.Text == "DIARIO") { paneldias.Show(); datebox.Enabled = false; fecha = "00/00/0000"; } else if (comborepeticion.Text == "TODOS LOS DIAS") { paneldias.Show(); datebox.Enabled = false; fecha = "00/00/0000"; } } else { if (comborepeticion.Text == "NO") { paneldias.Hide(); lunescheck.Checked = false; martescheckBox.Checked = false; miercolescheckBox.Checked = false; juevescheckBox.Checked = false; viernescheckbox.Checked = false; sabadocheckBox.Checked = false; domingocheckBox.Checked = false; datebox.Enabled = true; } else if (comborepeticion.Text == "ELEGIR") { paneldias.Show(); lunescheck.Checked = false; martescheckBox.Checked = false; miercolescheckBox.Checked = false; juevescheckBox.Checked = false; viernescheckbox.Checked = false; sabadocheckBox.Checked = false; domingocheckBox.Checked = false; datebox.Enabled = false; fecha = "00/00/0000"; } else if (comborepeticion.Text == "DIARIO") { paneldias.Show(); lunescheck.Checked = true; martescheckBox.Checked = true; miercolescheckBox.Checked = true; juevescheckBox.Checked = true; viernescheckbox.Checked = true; sabadocheckBox.Checked = false; domingocheckBox.Checked = false; datebox.Enabled = false; fecha = "00/00/0000"; } else if (comborepeticion.Text == "TODOS LOS DIAS") { paneldias.Show(); lunescheck.Checked = true; martescheckBox.Checked = true; miercolescheckBox.Checked = true; juevescheckBox.Checked = true; viernescheckbox.Checked = true; sabadocheckBox.Checked = true; domingocheckBox.Checked = true; datebox.Enabled = false; fecha = "00/00/0000"; } } if (lunescheck.Checked == true) { dias[0] = "SI"; } else { dias[0] = "NO"; } if (martescheckBox.Checked == true) { dias[1] = "SI"; } else { dias[1] = "NO"; } if (miercolescheckBox.Checked == true) { dias[2] = "SI"; } else { dias[2] = "NO"; } if (juevescheckBox.Checked == true) { dias[3] = "SI"; } else { dias[3] = "NO"; } if (viernescheckbox.Checked == true) { dias[4] = "SI"; } else { dias[4] = "NO"; } if (sabadocheckBox.Checked == true) { dias[5] = "SI"; } else { dias[5] = "NO"; } if (domingocheckBox.Checked == true) { dias[6] = "SI"; } else { dias[6] = "NO"; } }
private void agendaAdd_Load(object sender, EventArgs e) { //SystemSounds.Hand.Play(); playmusic.Hide(); stopmusic.Hide(); activobox.Hide(); labelactivo.Hide(); AgendaClass add = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden = "SELECT distinct `SONIDO` FROM " + UserAccessForm.getusername() + "_events_table;"; add.Fillcombo(melodybox, orden); if (DireccionGestor.getorigen() == "modificar") { activobox.Show(); labelactivo.Show(); titlelabel.Text = "EDITAR TAREAS"; motivoBox.Text = DireccionGestor.getnombrestatic(); fecha = DireccionGestor.getotrostatic(); if (fecha != "00/00/0000") { datebox.Text = fecha; } else { datebox.Enabled = false; } AgendaClass mod = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); orden = "SELECT * FROM " + UserAccessForm.getusername() + "_events_table WHERE DESCRIPCION= '" + DireccionGestor.getnombrestatic() + "' and FECHA = '" + DireccionGestor.getotrostatic() + "';"; mod.filleverything(activobox, priority, shortdate, hora, lunescheck, martescheckBox, miercolescheckBox, juevescheckBox, viernescheckbox, sabadocheckBox, domingocheckBox, comborepeticion, melodybox, orden); if (hora != "00:00:00") { timeBox.Text = hora; } else { timeBox.Enabled = false; } //MessageBox.Show("LUNES "+lunes+", MARTES "+martes+", MIERCOLES "+miercoles+", JUEVES "+jueves+", VIERNES "+viernes+", SABADO "+sabado+", DOMINGO "+domingo) if (lunescheck.Checked == false && martescheckBox.Checked == false && miercolescheckBox.Checked == false && juevescheckBox.Checked == false && viernescheckbox.Checked == false && sabadocheckBox.Checked == false && domingocheckBox.Checked == false) { //comborepeticion.Text = "NO"; paneldias.Hide(); datebox.Enabled = true; } else if (lunescheck.Checked == false && martescheckBox.Checked == false && miercolescheckBox.Checked == false && juevescheckBox.Checked == false && viernescheckbox.Checked == false && sabadocheckBox.Checked == false && domingocheckBox.Checked == false) { //comborepeticion.Text = "ELEGIR"; paneldias.Show(); datebox.Enabled = false; fecha = "00/00/0000"; } else if (lunescheck.Checked == true && martescheckBox.Checked == true && miercolescheckBox.Checked == true && juevescheckBox.Checked == true && viernescheckbox.Checked == true && sabadocheckBox.Checked == false && domingocheckBox.Checked == false) { //comborepeticion.Text = "DIARIO"; paneldias.Show(); datebox.Enabled = false; fecha = "00/00/0000"; } else if (lunescheck.Checked == true && martescheckBox.Checked == true && miercolescheckBox.Checked == true && juevescheckBox.Checked == true && viernescheckbox.Checked == true && sabadocheckBox.Checked == true && domingocheckBox.Checked == true) { //comborepeticion.Text = "TODOS LOS DIAS"; paneldias.Show(); fecha = "00/00/0000"; datebox.Enabled = false; } } else { priority.Text = "NORMAL"; comborepeticion.Text = "NO"; } OKbutton.BackColor = Color.Green; cancelbutton.BackColor = Color.Red; tareasverbutton.BackColor = Color.Blue; }
private void EmployeeForm_Load(object sender, EventArgs e) { EmployeeClass emp = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string orden = "SELECT distinct `TITULO UNIVERSITARIO` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(gottendegree, orden); orden = "SELECT distinct `PUESTO` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(cargobox, orden); orden = "SELECT distinct `RELACION DE REFERENCIA` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(relationReferenceBox, orden); orden = "SELECT distinct `NOMBRE DE ALERGIA` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(AlergyNmaeBox, orden); orden = "SELECT distinct `NOMBRE DE DOLENCIA` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(DolenciaNameBox, orden); orden = "SELECT distinct `NOMBRE DE MEDICINA` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(nameMedicineBox, orden); orden = "SELECT distinct `RAZON DE MEDICINA` FROM " + UserAccessForm.getusername() + "_employee_table;"; emp.Fillcombo(MotivoMedicineBox, orden); monedatipo.Text = "DOP"; if (DireccionGestor.getorigen() == "editor") { titulolabel.Text = "EDITAR EMPLEADO"; savebuttonstrip.Text = "MODIFICAR"; emp.filleverything(dategetin, gottendegree, nameEmployeeBox, idBox, birthDateBox, telephoneNumberBox, schedule, cargobox, comboNacionalidad, ageBox, monedatipo, mensualitybox, personalReferenceBox, telephoneReferenceBox, relationReferenceBox, AlergyNmaeBox, DolenciaNameBox, nameMedicineBox, MotivoMedicineBox, trabajando, salidapicker, picturetextbox, direccionbox, sexobox, emailcombo, DireccionGestor.getordensql()); if (nameMedicineBox.Text == "NINGUNA" && MotivoMedicineBox.Text == "NINGUNA") { medicinepanel.Hide(); medicamentosopcionbox.Text = "NO"; } else { medicamentosopcionbox.Text = "SI"; medicinepanel.Show(); } if (DolenciaNameBox.Text == "NINGUNA") { dolenciaopcionbox.Text = "NO"; dolenciapanel.Hide(); } else { dolenciaopcionbox.Text = "SI"; dolenciapanel.Show(); } if (AlergyNmaeBox.Text == "NINGUNA") { alergypanel.Hide(); alergiaopcionbox.Text = "NO"; } else { alergypanel.Show(); alergiaopcionbox.Text = "SI"; } if (personalReferenceBox.Text == "NINGUNA" && telephoneReferenceBox.Text == "NINGUNA" && relationReferenceBox.Text == "NINGUNA") { referenciapanel.Hide(); referenciaopcionbox.Text = "NO"; } else { referenciaopcionbox.Text = "SI"; referenciapanel.Show(); } empleadopanel.Show(); } else { savebuttonstrip.Text = "GUARDAR"; titulolabel.Text = "AGREGAR EMPLEADO"; empleadopanel.Hide(); } if (picturetextbox.Text != "") { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); string combinacion = System.IO.Path.Combine(path, UserAccessForm.getusername()); string fotopath = System.IO.Path.Combine(combinacion, picturetextbox.Text); pictureBox.ImageLocation = fotopath; } }
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 date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString(); openpad = false; panelpad.Show(); LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); if (DireccionGestor.getorigen() == "_payfor_table") { titlelabel.Text = "CUENTAS POR PAGAR"; string orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); //////////////////////////////////////////////////////////// if (entrada == "agregar") { if (name.Text == "" || monto.Text == "") { MessageBox.Show("Hay datos importantes vacios, termine el formulario."); if (name.Text == "") { name.BackColor = Color.Red; } else { name.BackColor = Color.Green; } if (monto.Text == "") { monto.BackColor = Color.Red; } else { monto.BackColor = Color.Green; } } else { try { MovementsClass ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString(); double montos = double.Parse(monto.Text); if (ad.AddCountPayFor(name.Text, date, montos, tipobox.Text, UserAccessForm.getusername())) { MessageBox.Show("NUEVO CUENTA POR PAGAR EL " + date + " AGREGADA."); if (MessageBox.Show("Agregar otra cuenta por pagar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { ad = new MovementsClass(); panelpad.Hide(); } else { ad = new MovementsClass(); name.Text = ""; tipo.Text = "DOP"; monto.Text = ""; fecha.Text = DateTime.Now.ToString(); } } else { MessageBox.Show("NUEVO CUENTA POR PAGAR EL " + date + " AGREGADA."); if (MessageBox.Show("Agregar otra cuenta por pagar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { ad = new MovementsClass(); panelpad.Hide(); } else { ad = new MovementsClass(); name.Text = ""; tipo.Text = "DOP"; monto.Text = ""; fecha.Text = DateTime.Now.ToString(); } } orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } catch (FormatException datethis) { datethis.ToString(); } } limpiarbutton.PerformClick(); } else if (entrada == "editar") { MovementsClass mc = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); orden = "UPDATE " + UserAccessForm.getusername() + "_payfor_table SET COBRADOR='" + name.Text + "', FECHA='" + date + "', CANTIDAD='" + monto.Text + "', `TIPO MONEDA`='" + tipo.Text + "' WHERE ID = '" + id + "'"; mc.ordensql(orden); panelpad.Hide(); orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); MessageBox.Show("COBRADOR " + MovementsClass.getdato()[1] + " EDITADO"); } //////////////////////////////////////////////////////////// } else if (DireccionGestor.getorigen() == "_askfor_table") { titlelabel.Text = "CUENTAS POR COBRAR"; string orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); //////////////////////////////////////////////////////////// if (entrada == "agregar") { if (name.Text == "" || monto.Text == "") { MessageBox.Show("Hay datos importantes vacios, termine el formulario."); if (name.Text == "") { name.BackColor = Color.Red; } else { name.BackColor = Color.Green; } if (monto.Text == "") { monto.BackColor = Color.Red; } else { monto.BackColor = Color.Green; } } else { try { MovementsClass ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString(); double montos = double.Parse(monto.Text); if (ad.AddCountAskFor(name.Text, date, montos, tipobox.Text, UserAccessForm.getusername())) { MessageBox.Show("NUEVA CUENTA POR COBRAR EL " + date + " AGREGADA."); if (MessageBox.Show("Agregar otra cuenta por cobrar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { ad = new MovementsClass(); panelpad.Hide(); } else { ad = new MovementsClass(); name.Text = ""; tipo.Text = "DOP"; monto.Text = ""; fecha.Text = DateTime.Now.ToString(); } } else { MessageBox.Show("NUEVO CUENTA POR COBRAR EL " + date + " AGREGADA."); if (MessageBox.Show("Agregar otra cuenta por cobrar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { ad = new MovementsClass(); panelpad.Hide(); } else { ad = new MovementsClass(); name.Text = ""; tipo.Text = "DOP"; monto.Text = ""; fecha.Text = DateTime.Now.ToString(); } } orden = "SELECT SUM(CANTIDAD) FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';"; MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD"); } catch (FormatException datethis) { datethis.ToString(); } } limpiarbutton.PerformClick(); } else if (entrada == "editar") { MovementsClass mc = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); orden = "UPDATE " + UserAccessForm.getusername() + "_askfor_table SET DEUDOR='" + name.Text + "', FECHA='" + date + "', CANTIDAD='" + monto.Text + "', `TIPO MONEDA`='" + tipo.Text + "' WHERE ID = '" + id + "'"; mc.ordensql(orden); panelpad.Hide(); orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox + "';"; AP.ShowDataGridfound(datagrid, orden); encontradolabel.Text = AP.getcuenta().ToString(); MessageBox.Show("DEUDOR " + MovementsClass.getdato()[1] + " EDITADO"); } //////////////////////////////////////////////////////////// } limpiarbutton.PerformClick(); }
private void datagrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { MovementsClass show = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string dato = this.datagrid.CurrentCell.Value.ToString(); namecombo.Text = dato; if (DireccionGestor.getorigen() == "_payfor_table") { string userDataName = UserAccessForm.getusername() + "_payfor_table"; string orden = "select * from " + userDataName + " where COBRADOR='" + dato + "' ;"; if (show.Fillbuscadorpagador(orden)) { id = MovementsClass.getdato()[0]; namecombo.Text = MovementsClass.getdato()[1]; fechabox.Text = MovementsClass.getdato()[2]; cantidadbox.Text = MovementsClass.getdato()[3]; tipobox.Text = MovementsClass.getdato()[4]; name.Text = MovementsClass.getdato()[1]; fecha.Text = MovementsClass.getdato()[2]; monto.Text = MovementsClass.getdato()[3]; tipo.Text = MovementsClass.getdato()[4]; editbutton.PerformClick(); } else { editbutton.Enabled = false; quitarbutton.Enabled = false; namecombo.Text = ""; tipobox.Text = "DOP"; cantidadbox.Text = ""; fechabox.Text = DateTime.Now.ToString(); } } else if (DireccionGestor.getorigen() == "_askfor_table") { string userDataName = UserAccessForm.getusername() + "_askfor_table"; namecombo.Text = dato; string orden = "select * from " + userDataName + " where DEUDOR='" + dato + "' ; "; if (show.Fillbuscadorcobrador(orden)) { entrada = "editar"; id = MovementsClass.getdato()[0]; namecombo.Text = MovementsClass.getdato()[1]; fechabox.Text = MovementsClass.getdato()[2]; cantidadbox.Text = MovementsClass.getdato()[3]; tipobox.Text = MovementsClass.getdato()[4]; name.Text = MovementsClass.getdato()[1]; fecha.Text = MovementsClass.getdato()[2]; monto.Text = MovementsClass.getdato()[3]; tipo.Text = MovementsClass.getdato()[4]; editbutton.PerformClick(); } else { editbutton.Enabled = false; quitarbutton.Enabled = false; namecombo.Text = ""; tipobox.Text = "DOP"; cantidadbox.Text = ""; fechabox.Text = DateTime.Now.ToString(); } } } catch (NullReferenceException pafh) { pafh.ToString(); } }
private void addbuttonstrip_Click(object sender, EventArgs e) { if (DireccionGestor.getorigen() == "inicio") { if (reasonbox.Text == "" || cuantitybox.Text == "" || explanationbox.Text == "") { MessageBox.Show("Hay datos importantes vacios, termine el formulario."); if (reasonbox.Text == "") { reasonbox.BackColor = Color.Red; } else { reasonbox.BackColor = Color.Green; } if (cuantitybox.Text == "") { cuantitybox.BackColor = Color.Red; } else { cuantitybox.BackColor = Color.Green; } if (explanationbox.Text == "") { explanationbox.BackColor = Color.Red; } else { explanationbox.BackColor = Color.Green; } } else { try { string userDataName = UserAccessForm.getusername() + "_movements_table"; MovementsClass save = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); double cuantity = double.Parse(cuantitybox.Text); string date = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString(); string hour = horabox.Value.Hour.ToString() + ":" + horabox.Value.Minute.ToString() + ":" + horabox.Value.Second.ToString(); DireccionGestor.setotrostatic("refresh"); if (save.setProfit(date, hour, reasonbox.Text, cuantity, monedatipo.Text, datebox.Value.Day.ToString(), datebox.Value.Month.ToString() , datebox.Value.Year.ToString(), horabox.Value.Hour.ToString(), horabox.Value.Minute.ToString(), horabox.Value.Second.ToString(), explanationbox.Text, fondoorigen.Text, userDataName)) { save.OrderID(userDataName); MessageBox.Show("NUEVO INGRESO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO"); if (MessageBox.Show("REGISTRAR OTRO INGRESO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { save = new MovementsClass(); this.Close(); IngresosForm menu = new IngresosForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); } else { save = new MovementsClass(); this.Close(); } } else { MessageBox.Show("INGRESO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO"); if (MessageBox.Show("REGISTRAR OTRO INGRESO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { save = new MovementsClass(); this.Close(); IngresosForm menu = new IngresosForm(); menu.WindowState = FormWindowState.Normal; menu.Show(); } else { save = new MovementsClass(); this.Close(); } } } catch (FormatException datethis) { MessageBox.Show(datethis.ToString()); } catch (InvalidCastException datethose) { MessageBox.Show(datethose.ToString()); } } } else if (DireccionGestor.getorigen() == "editor") { if (reasonbox.Text == "" || cuantitybox.Text == "" || explanationbox.Text == "") { MessageBox.Show("Hay datos importantes vacios, termine el formulario."); if (reasonbox.Text == "") { reasonbox.BackColor = Color.Red; } else { reasonbox.BackColor = Color.Green; } if (cuantitybox.Text == "") { cuantitybox.BackColor = Color.Red; } else { cuantitybox.BackColor = Color.Green; } if (explanationbox.Text == "") { explanationbox.BackColor = Color.Red; } else { explanationbox.BackColor = Color.Green; } } else { try { string userDataName = UserAccessForm.getusername() + "_movements_table"; MovementsClass save = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); double cuantity = double.Parse(cuantitybox.Text); string date = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString(); string hour = horabox.Value.Hour.ToString() + ":" + horabox.Value.Minute.ToString() + ":" + horabox.Value.Second.ToString(); //`FECHA DEL MOVIMIENTO` ,`HORA DEL MOVIMIENTO` ,MOTIVO ,INGRESO, `TIPO DE MONEDA`, DIA, MES, AÑO, HORA, MINUTO, SEGUNDO, EXPLICACION, `FORMA DE PAGO` ) values ('" + datemovement + "', '" + timemovement + "' , '" + reasonmovement + "', '" + profit + "','" + tipomoneda + "','" + dia + "','" + mes + "','" + anio + "','" + hora + "','" + minuto + "','" + segundo + "','" + explicacion + "','" + origenfondo + "' DireccionGestor.setotrostatic("refresh"); string orden = "UPDATE " + userDataName + " SET `FECHA DEL MOVIMIENTO`='" + date + "', `HORA DEL MOVIMIENTO`='" + hour + "', MOTIVO='" + reasonbox.Text + "', INGRESO='" + cuantity + "', `TIPO DE MONEDA`='" + monedatipo.Text + "',DIA='" + datebox.Value.Day.ToString() + "', MES='" + datebox.Value.Month.ToString() + "', AÑO='" + datebox.Value.Year.ToString() + "', HORA='" + datebox.Value.Hour.ToString() + "', MINUTO='" + datebox.Value.Minute.ToString() + "', SEGUNDO='" + datebox.Value.Second.ToString() + "', EXPLICACION='" + explanationbox.Text + "', `FORMA DE PAGO`='" + fondoorigen.Text + "' WHERE ID='" + MovementsClass.getdato()[0] + "' AND `FECHA DEL MOVIMIENTO`='" + MovementsClass.getdato()[2] + "' AND `HORA DEL MOVIMIENTO`='" + MovementsClass.getdato()[3] + "';"; save.ordensql(orden); MessageBox.Show("INGRESO DE LAS " + MovementsClass.getdato()[3] + " EL DIA " + MovementsClass.getdato()[2] + " HA SIDO EDITADO"); this.Close(); } catch (FormatException datethis) { MessageBox.Show(datethis.ToString()); } catch (InvalidCastException datethose) { MessageBox.Show(datethose.ToString()); } } } }
private void OKbutton_Click(object sender, EventArgs e) { string fecharecordatorio = "00/00"; fecha = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString(); string hora = timeBox.Value.Hour.ToString() + ":" + timeBox.Value.Minute.ToString() + ":" + timeBox.Value.Second.ToString(); AgendaClass agenda = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); string user = UserAccessForm.getusername(); if (lunescheck.Checked == true) { dias[0] = "SI"; } else { dias[0] = "NO"; } if (martescheckBox.Checked == true) { dias[1] = "SI"; } else { dias[1] = "NO"; } if (miercolescheckBox.Checked == true) { dias[2] = "SI"; } else { dias[2] = "NO"; } if (juevescheckBox.Checked == true) { dias[3] = "SI"; } else { dias[3] = "NO"; } if (viernescheckbox.Checked == true) { dias[4] = "SI"; } else { dias[4] = "NO"; } if (sabadocheckBox.Checked == true) { dias[5] = "SI"; } else { dias[5] = "NO"; } if (domingocheckBox.Checked == true) { dias[6] = "SI"; } else { dias[6] = "NO"; } int prioridad = 1; if (priority.Text == "MUY IMPORTANTE") { prioridad = 0; } else if (priority.Text == "NORMAL") { prioridad = 1; } else { prioridad = 2; } if (comborepeticion.Text == "NO") { fecharecordatorio = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString(); } else { fecharecordatorio = "00/00"; } // 0 - MUY IMPORTANTE // 1 - NORMAL // 2 - POCO IMPORTANTE if (DireccionGestor.getorigen() == "inicio" || DireccionGestor.getorigen() == "buscador") { string activo = "SI"; if (motivoBox.Text == "" || priority.Text == "") { MessageBox.Show("COMPLETE EL FORMULARIO"); if (motivoBox.Text == "") { motivoBox.BackColor = Color.Red; } else { motivoBox.BackColor = Color.Green; } if (priority.Text == "") { priority.BackColor = Color.Red; } else { motivoBox.BackColor = Color.Green; } } else { if (agenda.saveData(user, motivoBox.Text, prioridad, fecha, hora, dias[0], dias[1], dias[2], dias[3], dias[4], dias[5], dias[6], fecharecordatorio, activo, melodybox.Text)) { MessageBox.Show("TAREA GUARDADA"); if (MessageBox.Show("Agregar otra tarea?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { agenda = new AgendaClass(); this.Close(); } else { agenda = new AgendaClass(); this.Close(); agendaAdd menu = new agendaAdd(); } } else { MessageBox.Show("TAREA GUARDADA" + " " + agenda.getmessageshow()); if (MessageBox.Show("Agregar otra tarea?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { agenda = new AgendaClass(); this.Close(); } else { agenda = new AgendaClass(); this.Close(); agendaAdd menu = new agendaAdd(); menu.WindowState = FormWindowState.Normal; menu.Show(); } } } } else if (DireccionGestor.getorigen() == "modificar") { agenda.ordensql("UPDATE " + UserAccessForm.getusername() + "_events_table SET `DESCRIPCION`= '" + motivoBox.Text + "', `FECHA` ='" + fecha + "', `HORA` ='" + hora + "', `PRIORIDAD` = '" + prioridad + "', `LUNES`='" + dias[0] + "', `MARTES` ='" + dias[1] + "', `MIERCOLES` ='" + dias[2] + "', `JUEVES` ='" + dias[3] + "', `VIERNES` ='" + dias[4] + "', `SABADO` ='" + dias[5] + "', `DOMINGO` ='" + dias[6] + "', `FECHA DE RECORDATORIO` ='" + fecharecordatorio + "', `ACTIVO` ='" + activobox.Text + "',`SONIDO`='" + melodybox.Text + "' WHERE `DESCRIPCION`= '" + DireccionGestor.getnombrestatic() + "' AND FECHA ='" + DireccionGestor.getotrostatic() + "';"); MessageBox.Show("TAREA MODIFICADA"); AgendaEvents agendaobject = new AgendaEvents(); agendaobject.WindowState = FormWindowState.Normal; agendaobject.Show(); this.Close(); } }