Ejemplo n.º 1
0
 protected void OnEditarClicked(object send, EventArgs eA)
 {
     try
     {
         TreeSelection treeSelection = (TreeSelection)treeView.Selection;
         treeSelection.GetSelected(out TreeIter iter);
         List <string> values = new List <string>();
         for (int i = 0; i < campos.Count; i++)
         {
             Console.WriteLine(treeView.Model.GetValue(iter, i).ToString());
             values.Add(treeView.Model.GetValue(iter, i).ToString());
         }
         List <string> copyCampos = new List <string>(campos);
         copyCampos.RemoveAt(0);
         List <string> copyValues = new List <string>(values);
         copyValues.RemoveAt(0);
         List <string> entrysText      = new List <string>();
         WindowAction  ventanaAcciones = new WindowAction("productos", copyCampos, copyValues);
         ventanaAcciones.Destroyed += (sender, e) =>
         {
             entrysText = ventanaAcciones.GetEntrysContent();
             Actions.Edit(dbCommand, copyCampos, entrysText, "productos", "id", values[0]);
             List <string> valoresCeldas = new List <string>(Actions.List(dbCommand, "productos"));
             treeViewHelper.BuildTreeView(valoresCeldas, campos, treeView);
         };
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         MessageDialog alert = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, "¡SELECCIONE UNA FILA PARA EDITARLA!");
         alert.Run();
         alert.Destroy();
     }
 }
Ejemplo n.º 2
0
        protected void OnConsultarClicked(object send, EventArgs eA)
        {
            List <string> entrysText = new List <string>();
            List <string> noneuse    = new List <string>()
            {
                ""
            };
            List <string> aux = new List <string>()
            {
                "id"
            };
            WindowAction ventanaAcciones = new WindowAction("productos", aux, noneuse);

            ventanaAcciones.Destroyed += (sender, e) => {
                entrysText = ventanaAcciones.GetEntrysContent();
                List <string> valoresCeldas = new List <string>();
                valoresCeldas = Actions.Consult(dbCommand, campos[0], entrysText[0], "productos");
                treeViewHelper.BuildTreeView(valoresCeldas, campos, treeView);
            };
            ventanaAcciones.Show();
        }