protected void Btn_redirije_Click(object sender, EventArgs e) { try { this.caja = new Caja_Chica(); this.caja.Opc = 1; this.caja.Nombre_Caja = this.txt_nombre_caja.Text; this.caja.Descripcion1 = this.txt_descripcion.Text; this.caja.Fecha_inicio = fecha.Value; this.caja.Saldo_inicial = float.Parse(this.TxtSaldo_inicial.Text); this.caja.Estado = "Activo"; this.cajaHelper = new Caja_Chica_Helper(caja); this.cajaHelper.Agregar_Caja(); Primer_movimiento(); this.txt_nombre_caja.Text = null; this.txt_descripcion.Text = null; this.TxtSaldo_inicial.Text = null; ScriptManager.RegisterStartupScript(this, typeof(Page), "mmensajeDeconfirmacion", "mensajeDeconfirmacion('" + "" + "');", true); } catch (Exception) { ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true); } }
protected void Button2_Click(object sender, EventArgs e) { try { int tipomovi; this.caja = new Caja_Chica(); this.caja.Opc = 3; this.caja.Concepto_movimiento = this.txt_detalle.Text; this.caja.Fecha_inicio = fecha.Value; if (this.Dptmovi.SelectedValue == "Ingreso") { this.caja.Tipo_movimiento = "Ingreso"; tipomovi = 1; } else { this.caja.Tipo_movimiento = "Egreso"; tipomovi = 0; } this.caja.Movimiento_dinero = float.Parse(this.txtMontito.Text); movimiento_dinero = float.Parse(this.txtMontito.Text); saldo = float.Parse(this.LblSaldo.Text); if (tipomovi == 1) { saldo_final = saldo + movimiento_dinero; } else { saldo_final = saldo - movimiento_dinero; } this.caja.Saldo1 = saldo_final; this.caja.Id_Caja = int.Parse(this.LblId_Caja.Text); this.cajaHelper = new Caja_Chica_Helper(caja); this.cajaHelper.Agregar_Movimiento(); ScriptManager.RegisterStartupScript(this, typeof(Page), "mmensajeDeconfirmacion", "mensajeDeconfirmacion('" + "" + "');", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true); } }
public void buscaIdCaja() { try { this.caja = new Caja_Chica(); this.caja.Opc = 5; this.cajaHelper = new Caja_Chica_Helper(caja); this.datos = new DataTable(); this.datos = this.cajaHelper.Consulta_Cajas(); if (datos.Rows.Count >= 0) { DataRow fila = datos.Rows[0]; numcaja = int.Parse(fila["Id_Caja"].ToString()); } } catch (Exception) { ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true); } }
public void Primer_movimiento() { try { buscaIdCaja(); this.caja = new Caja_Chica(); this.caja.Opc = 3; this.caja.Concepto_movimiento = "Ingreso Inicial"; this.caja.Fecha_movimiento = fecha.Value; this.caja.Movimiento_dinero = float.Parse(this.TxtSaldo_inicial.Text); this.caja.Saldo1 = float.Parse(this.TxtSaldo_inicial.Text); this.caja.Tipo_movimiento = "Ingreso"; this.caja.Id_Caja = numcaja; this.cajaHelper = new Caja_Chica_Helper(caja); this.cajaHelper.Agregar_Movimiento(); } catch (Exception) { ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true); } }
public void buscaSaldos() { try { this.caja = new Caja_Chica(); this.caja.Opc = 6; this.caja.Id_Caja = int.Parse(this.LblId_Caja.Text); this.cajaHelper = new Caja_Chica_Helper(caja); this.datos = new DataTable(); this.datos = this.cajaHelper.Consulta_saldo(); if (datos.Rows.Count >= 0) { DataRow fila = datos.Rows[0]; saldo = float.Parse(fila["Saldo"].ToString()); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true); } }