Beispiel #1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            GastosForm add = new GastosForm();

            add.WindowState = FormWindowState.Normal;
            add.Show();
            this.Close();
        }
Beispiel #2
0
        private void pictureBox6_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";
            GastosForm gastosobject = new GastosForm();

            gastosobject.WindowState = FormWindowState.Normal;
            gastosobject.Show();
        }
Beispiel #3
0
        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
                {
                    DireccionGestor.setotrostatic("refresh");
                    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();



                        if (save.setExpense(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 GASTO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO");
                            if (MessageBox.Show("REGISTRAR OTRO GASTO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                save = new MovementsClass();
                                this.Close();
                                GastosForm menu = new GastosForm();
                                menu.WindowState = FormWindowState.Normal;
                                menu.Show();
                            }
                            else
                            {
                                save = new MovementsClass();
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("GASTO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO");
                            if (MessageBox.Show("REGISTRAR OTRO GASTO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                save = new MovementsClass();
                                this.Close();
                                GastosForm menu = new GastosForm();
                                menu.WindowState = FormWindowState.Normal;
                                menu.Show();
                            }
                            else
                            {
                                save = new MovementsClass();
                                this.Close();
                            }
                        }
                    }
                    catch (FormatException datethis) { 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();
                        DireccionGestor.setotrostatic("refresh");
                        string orden = "UPDATE " + userDataName + " SET `FECHA DEL MOVIMIENTO`='" + date + "',  `HORA DEL MOVIMIENTO`='" + hour + "', MOTIVO='" + reasonbox.Text + "', GASTO='" + 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()); }
                }
            }
        }