btLecturaAutomaticaSeries.cs
1 using System;
2 using sage.ew.objetos;
3 using sage.ew.interficies;
4 using sage.ew.formul;
5 using System.Windows.Forms;
6 using sage.ew.global;
7 
8 namespace sage.ew.serie.UserControls
9 {
14  {
18  private readonly bool InstalacionConSeries = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_series"));
19 
20  #region PROPIEDADES
21 
25  public dynamic _Documento
26  {
27  get { return _oDocumento; }
28  set { _oDocumento = value; }
29  }
30  private dynamic _oDocumento = null;
31 
35  public dynamic _GridArt = null;
36 
40  public dynamic _Linea = null;
41 
45  private Control _Control = null;
46 
47  #endregion PROPIEDADES
48 
49  #region CONSTRUCTORES
50 
55  {
56  InitializeComponent();
57 
58  //Texto x defecto del botón
59  Text = "Lectura automática de series";
60 
61  if (!DesignMode)
62  {
63  //Aplicamos estilos
64  _PropiedadesDeEstilos._AplicarEstilos = true;
65 
66  // Capturamos el evento click
67  Click += new EventHandler(BtLecturaAutomaticaSeries_Click);
68 
69  //Visibilidad del botón
70  if (EW_GLOBAL._EdicionPerfiles || InstalacionConSeries)
71  Visible = true;
72  else
73  Visible = false;
74  }
75  }
76 
77  #endregion CONSTRUCTORES
78 
79  #region MÉTODOS
80 
87  private void BtLecturaAutomaticaSeries_Click(object sender, EventArgs e)
88  {
89  if (!InstalacionConSeries)
90  {
91  ShowErrorMessage("Debe activar el addon de \"Series\" para continuar.");
92  return;
93  }
94 
95  // Comprobar estado de Sólo Lectura del formulario padre
96  bool llSoloLectura = false;
97 
98  FormBase loForm = (FormBase)FindForm();
99  if (loForm != null)
100  llSoloLectura = loForm._ReadOnly;
101 
102  if (!llSoloLectura)
103  {
104  //Mostrem l'usercontrol
105  _Show();
106  }
107  else
108  {
109  ShowErrorMessage("El documento es de solo lectura");
110  }
111  }
112 
117  private void ShowErrorMessage(string tcMensajeError)
118  {
119  // Vamos a buscar el formulario
120  FormBase loForm = (FormBase)FindForm();
121 
122  loForm._MessageBox(tcMensajeError, MessageBoxButtons.OK, MessageBoxIcon.Error,
123  MessageBoxDefaultButton.Button1, DialogResult.None);
124  }
125 
126  private void _Show()
127  {
128  if (Parent.Controls["LecturaAutomaticaSeries"] == null)
129  {
130  //Mostrem l'usercontrol
131  _Control = new LecturaAutomaticaSeries(_Documento, _GridArt)
132  {
133  Location = Location
134  };
135  _Control.Top = _Control.Location.Y + Height;
136  Parent.Controls.Add(_Control);
137  _Control.BringToFront();
138 
139  //Hack per que es resitui al lloc original en cas de que l'haguem afegit amb el disenyador de perfils
140  Parent.Height = Parent.Height + 1;
141  Parent.Height = Parent.Height - 1;
142  }
143  }
144 
145  #endregion MÉTODOS
146 
147  }
148 }
virtual bool _ReadOnly
Informa sobre si el formulario esta en modo de Solo Lectura
Definition: clsFormul.cs:897
Interfaz utilizada en los controles que se añaden en los perfiles
Formulario base de Eurowin
Definition: clsFormul.cs:400
Base para los botones de Eurowin
Botón que muestra el UserControl de "LecturaAutomaticaSeries"
DialogResult _MessageBox(String tcMensaje, MessageBoxButtons toBotones, MessageBoxIcon toIcono, MessageBoxDefaultButton toBotonDefecto, DialogResult toResultadoDefecte)
Messagebox propio 1
Definition: clsFormul.cs:3364