private void loginButton_Click(object sender, EventArgs e) { if (conectionActive) { login(); } else { if (!ConDB.openConnection()) { MessageBox.Show("No se pudo conectar a la base de datos, haga click en 'solucionar problemas de coneccion' y siga los pasos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); conectionActive = false; } else { login(); conectionActive = true; } } }
private void MostrarButton_Click(object sender, EventArgs e) { if (ventas_radio.Checked) { MainDataGrid.DataSource = ConDB.getListOfSales(startTimePicker.Value.ToString("yyyy-MM-dd"), endTimePicker.Value.ToString("yyyy-MM-dd")); formatDataGrid_Sales(); total_input.Text = ConDB.getTotalSales(startTimePicker.Value.ToString("yyyy-MM-dd"), endTimePicker.Value.ToString("yyyy-MM-dd")).ToString(); return; } if (ingreso_radio.Checked) { MainDataGrid.DataSource = ConDB.getListOfEntries(startTimePicker.Value.ToString("yyyy-MM-dd"), endTimePicker.Value.ToString("yyyy-MM-dd")); formatDataGrid_entries(); total_input.Text = ConDB.getTotalEntries(startTimePicker.Value.ToString("yyyy-MM-dd"), endTimePicker.Value.ToString("yyyy-MM-dd")).ToString(); return; } if (producto_radio.Checked) { MainDataGrid.DataSource = ConDB.getHistoricalProducts(startTimePicker.Value.ToString("yyyy-MM-dd"), endTimePicker.Value.ToString("yyyy-MM-dd")); formatDataGrid_historicalProducts(); return; } }
private void StadisticsForm_Load(object sender, EventArgs e) { MainDataGrid.DataSource = ConDB.getStatistic(); }
private void LoginForm_FormClosing(object sender, FormClosingEventArgs e) { ConDB.closeConnection(); }