FunctionsPortalCli.cs
2 using sage.ew.formul;
4 using System;
5 using System.Collections.Generic;
6 using System.Drawing;
7 using System.Linq;
8 using System.Text;
9 using System.Windows.Forms;
10 using static sage.ew.objetos.Menu50;
11 
12 namespace sage.addons.portalcli.Negocio.Clases
13 {
14  public static class FunctionsPortalCli
15  {
16  public static bool _RevisarSello(Control toControlReferencia, List<IStamp> toSellos, ewSello toSelloRef = null, int tnIncLeft = 0)
17  {
18  if (toControlReferencia == null)
19  return true;
20 
21  List<IStamp> toList;
22  Form loForm = toControlReferencia.FindForm();
23  FormBase loFormBase = (FormBase)loForm;
24 
25  toList = toSellos.Where(f => f._Mostrar && !string.IsNullOrEmpty(f._Control?.Name)).ToList();
26 
27  //Ocultamos lo sellos que no tenemos que mostrar
28  toSellos.Where(f => !f._Mostrar).ToList().ForEach(f => f._Visible = false);
29 
30  //Mostramos los visibles
31  foreach (IStamp loStampStruct in toList)
32  {
33 
34  Control loControl = loFormBase._FindControl(loStampStruct._Control.Name);
35 
36  if (loControl is Control && loControl != loStampStruct._Control)
37  {
38  loForm.Controls.Remove(loControl);
39  loControl = null;
40  }
41 
42  if (loControl == null)
43  {
44  loForm.Controls.Add(loStampStruct._Control);
45  _PosicionarSelloDocumento(loForm, toControlReferencia, loStampStruct._Control, toSelloRef, tnIncLeft);
46  }
47 
48  loStampStruct._Visible = true;
49  loStampStruct._Control.BringToFront();
50  }
51 
52  //Volvemos a marcar los objetos para que no los muestre
53  toSellos.ForEach(f => f._Mostrar = false);
54 
55  return true;
56  }
57 
69  public static bool _PosicionarSelloDocumento(Form toForm, Control toControlReferencia, ewSello toSello, ewSello toSelloRef = null, int tnIncLeft = 0)
70  {
71  if (toControlReferencia == null || string.IsNullOrWhiteSpace(toControlReferencia.Name))
72  return false;
73 
74  bool llFound = false;
75  int lnLeft, lnTop;
76 
77  Control[] loControls = toForm.Controls.Find(toControlReferencia.Name, true);
78 
79  if (loControls.Length > 0)
80  {
81  if (toSelloRef == null)
82  {
83  lnLeft = loControls[0].Left + Convert.ToInt32(decimal.Truncate(loControls[0].Width / 2));
84  lnTop = loControls[0].Top + Convert.ToInt32(decimal.Truncate(loControls[0].Height / 2));
85 
86  int lnWidth = Convert.ToInt32(decimal.Truncate(toSello.Width / 2));
87  if (lnWidth < lnLeft)
88  lnLeft = lnLeft - lnWidth;
89 
90  int lnHeight = Convert.ToInt32(decimal.Truncate(toSello.Height / 2));
91  if (lnHeight < lnTop)
92  lnTop = lnTop - lnHeight;
93  }
94  else
95  {
96  lnTop = toSelloRef.Top;
97  lnLeft = toSelloRef.Left + toSelloRef.Width + 15;
98  }
99 
100  llFound = true;
101  }
102  else
103  {
104  // Posición inicial si no encuentra el control de referencia
105  lnLeft = 15;
106  lnTop = 15;
107  llFound = false;
108  }
109 
110  toSello.Left = lnLeft + tnIncLeft;
111  toSello.Top = lnTop;
112 
113  return llFound;
114  }
115 
120  public static void _AddSepatatorDropDownItem(ref ToolStripMenuItem toToolStripMenuItem)
121  {
122  // Añadir separador (utilizamos el ExtendedToolStripSeparator para que quede igual que el Menu50)
123  Color loColorSeparadorMenu = Color.FromArgb(203, 203, 201);
124  Color loColorBackSeparadorMenu = Color.FromArgb(255, 255, 255);
125  ToolStripItem loSeparador = new ExtendedToolStripSeparator(loColorBackSeparadorMenu, loColorSeparadorMenu)
126  {
127  Text = "-"
128  };
129  toToolStripMenuItem.DropDownItems.Add(loSeparador);
130  }
131  }
132 }
Este es el espacio de nombres de su módulo. Puede encontrar más información y ayuda en el fichero rea...
Es como el tipo de entrada asientos pero por negocio, sin formulario, pq quiero que me haga las propu...
Formulario base de Eurowin
Definition: clsFormul.cs:400
PE-95295: Control basado en IElemento para integrar el menú de Sage 50 en el escritorio ...
Definition: Menu50.cs:38
Control _FindControl(string tcControlName)
PE-96322. Devuelve el primer control que coincide por nombre
Definition: clsFormul.cs:850
Clase base para representar un sello de los disponibles en un documento de venta (aparcado para ticke...
Definition: ewSello.cs:29