private void toolStripButton1_Click_1(object sender, EventArgs e) { IngresosForm add = new IngresosForm(); add.WindowState = FormWindowState.Normal; add.Show(); this.Close(); }
private void pictureBox7_Click(object sender, EventArgs e) { LoginClass create = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport()); create.CreateMovementsTable(UserAccessForm.getusername()); origen = "inicio"; IngresosForm ingresosobject = new IngresosForm(); ingresosobject.WindowState = FormWindowState.Normal; ingresosobject.Show(); }
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()); } } } }