ExtensionServiceRutas.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using sage.ew.ewbase;
6 using sage.ew.interficies;
7 using sage.ew.formul.Forms;
8 using sage.ew.objetos;
9 using System.Drawing;
10 using sage.ew.db;
11 using System.Data;
12 using System.ComponentModel;
13 using sage.ew.global;
14 
15 namespace sage.addons.services.Negocio.Mantes
16 {
21  {
22  private ewMante _ewMante = null;
23  private FormMante _oFormMante = null;
24  private const string tabla = "C_SERVICIOS";
25  private const string dataBase = "SERVICES";
26  private const string clave = "RUTA";
27 
32 
36 
40  public string _Ruta
41  {
42  get
43  {
44  return _cRuta;
45  }
46  set
47  {
48  _cRuta = value;
49  }
50  }
51  private string _cRuta;
52 
57  {
58  this._Tabla = tabla;
59  this._DataBase = dataBase;
60  this._Clave = clave;
61  }
62 
68  {
69  _oFormMante = toForm;
70  _ewMante = toForm._ewMante;
71 
72  this._Tabla = tabla;
73  this._DataBase = dataBase;
74  this._Clave = clave;
75  }
80  public override bool _Delete()
81  {
82 
83  bool llOk = true;
84  string lcMensaje = string.Empty;
85 
86  if (llOk && _eBeforeAfter == TipoExecute.Before)
87  {
88 
89 
90  DataTable ldtInf = new DataTable();
91  string lcSql;
92 
93  string _Codigo = this._Mante._Codigo;
94  lcSql = String.Format("SELECT COUNT(*) AS registros, MAX(NUMERO) FROM {0} WHERE RUTA = '" + _Codigo + "'", DB.SQLDatabase(this._DataBase, this._Tabla));
95 
96  DB.SQLExec(lcSql, ref ldtInf);
97 
98  if (ldtInf == null || ldtInf.Rows.Count == 0) // Verificamos que realmente se pueda eliminar
99  llOk = true;
100  else
101  {
102  var loInf = ldtInf.AsEnumerable().Where(y => y.Field<Int32>("registros") != 0).ToList();
103  if (loInf.Count() == 0)
104  llOk = true;
105  else
106  {
107  for (int lnInd = 0; lnInd < loInf.Count(); lnInd++)
108  {
109  if (!string.IsNullOrWhiteSpace(lcMensaje))
110  lcMensaje = lcMensaje + " y ";
111 
112  lcMensaje = lcMensaje + Convert.ToString(loInf[lnInd][1]);
113  llOk = false;
114  }
115  }
116  }
117 
118  }
119 
120  if (!llOk)
121  {
122  _Error_Message = "Esta ruta está asignada al servicio número " + lcMensaje.Trim() + ". No se puede borrar la ruta.";
123  }
124 
125 
126  return llOk;
127  }
128 
129  }
130 }
Clase de negocio base para mantenimientos
Definition: clsEwBase.cs:1643
sage.addons.services.services _oservices
Objeto principal de configuración del módulo
Extensión para el mantenimiento de rutas
Es como el tipo de entrada asientos pero por negocio, sin formulario, pq quiero que me haga las propu...
Clase base para las extensiones de los mantenimientos
TipoExecute
Tipos de ejecución de los métodos
Definition: IDocModulos.cs:16
Clase base para el módulo services
Definition: SageAddons.cs:102
ManteExtServ_Rutas(FormMante toForm)
Constructor de la clase
Este es el espacio de nombres de su módulo. Puede encontrar más información y ayuda en el fichero rea...
virtual ewMante _ewMante
Clase mantenimiento asociada al formulario
Definition: FormMante.cs:323
Base para los mantenimientos de Sage TPV
Definition: FormMante.cs:26