Beispiel #1
0
 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();
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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);
            }
        }
Beispiel #5
0
        public static void Actualizar_Datos(E_Gasto obj_)
        {
            D_Gasto obj = new D_Gasto();

            obj.Actualizar_Datos(obj_);
        }
Beispiel #6
0
        public static void Insertar_Datos(E_Gasto obj_)
        {
            D_Gasto obj = new D_Gasto();

            obj.Insertar_Datos(obj_);
        }
Beispiel #7
0
 public void Recibir_Datos(E_Gasto obj)
 {
     txt_id.Text          = obj._ID_GASTO.ToString();
     txt_descripcion.Text = obj._DESCRIPCION;
     cb_estado.Text       = obj._ESTADO;
 }