public void Actualizar_Datos(E_Gasto obj) { cn.Close(); da.UpdateCommand = new SqlCommand("SP_GASTOS", cn); da.UpdateCommand.CommandType = CommandType.StoredProcedure; da.UpdateCommand.Parameters.AddWithValue("@ACCION", "U"); da.UpdateCommand.Parameters.AddWithValue("@ID_GASTO", obj._ID_GASTO); da.UpdateCommand.Parameters.AddWithValue("@DESCRIPCION", obj._DESCRIPCION); da.UpdateCommand.Parameters.AddWithValue("@ESTADO", obj._ESTADO == "Activo" ? "A" : "I"); cn.Open(); da.UpdateCommand.ExecuteNonQuery(); cn.Close(); }
public void Insertar_Datos(E_Gasto obj) { cn.Close(); da.InsertCommand = new SqlCommand("SP_GASTOS", cn); da.InsertCommand.CommandType = CommandType.StoredProcedure; da.InsertCommand.Parameters.AddWithValue("@ACCION", "I"); da.InsertCommand.Parameters.AddWithValue("@CREADO_POR", obj._CREADO_POR); da.InsertCommand.Parameters.AddWithValue("@DESCRIPCION", obj._DESCRIPCION); da.InsertCommand.Parameters.AddWithValue("@FECHA_CREADO", obj._FECHA_CREADO); da.InsertCommand.Parameters.AddWithValue("@ESTADO", obj._ESTADO == "Activo" ? "A" : "I"); cn.Open(); da.InsertCommand.ExecuteNonQuery(); cn.Close(); }
public void Editar() { if (dg.Rows.Count == 0) { return; } E_Gasto obj = new E_Gasto(); obj._DESCRIPCION = dg.CurrentRow.Cells["DESCRIPCION"].Value.ToString(); obj._ESTADO = dg.CurrentRow.Cells["ESTADO"].Value.ToString(); obj._ID_GASTO = Convert.ToInt32(dg.CurrentRow.Cells["_ID"].Value.ToString()); Frm_Gasto frm = new Frm_Gasto(); frm.Recibir_Datos(obj); frm.ShowDialog(); }
public void Insertar_Actualizar() { try { if (Validar() == false) { return; } E_Gasto obj = new E_Gasto(); string mensaje = ""; obj._CREADO_POR = Funciones.Utilitario.Datos_Usuarios.USUARIO; obj._ESTADO = cb_estado.Text; obj._FECHA_CREADO = DateTime.Now; obj._DESCRIPCION = txt_descripcion.Text.Trim(); if (txt_id.Text.Equals("")) { N_Gasto.Insertar_Datos(obj); mensaje = "Datos Insertados Con Exito"; } else { obj._ID_GASTO = Convert.ToInt32(txt_id.Text); N_Gasto.Actualizar_Datos(obj); mensaje = "Datos Actualizados Con Exito"; } Frm_Mant_Gastos frm = this.Owner as Frm_Mant_Gastos; if (frm != null) { frm.Consultar(); } this.Close(); Funciones.Utilitario.Mensaje_Informacion(mensaje); } catch (Exception ex) { Funciones.Utilitario.Mensaje_Error(ex.Message); } }
public static void Actualizar_Datos(E_Gasto obj_) { D_Gasto obj = new D_Gasto(); obj.Actualizar_Datos(obj_); }
public static void Insertar_Datos(E_Gasto obj_) { D_Gasto obj = new D_Gasto(); obj.Insertar_Datos(obj_); }
public void Recibir_Datos(E_Gasto obj) { txt_id.Text = obj._ID_GASTO.ToString(); txt_descripcion.Text = obj._DESCRIPCION; cb_estado.Text = obj._ESTADO; }