Esempio n. 1
0
 public InitialCharge(string f1)
 {
     this.file = f1;
     this.newData = ChargeData.getInstance();
     this.commandsList = new List<Command>();
     this.categoriesList = new List<Category>();
     this.modLog = ModuloLog.GetInstance(Constantes.MODULO_LOG);
 }
Esempio n. 2
0
        public static string ObtenerMensajeError(Exception ex, ModuloLog modulo, TipoObjeto tipo)
        {
            string mensaje = string.Empty;

            if (ex is System.ArgumentNullException)
            {
                mensaje = string.Format("Error {0} \r\n Se obtuvo un argumento nulo.", ex.HResult);
            }
            if (ex is System.ArgumentOutOfRangeException)
            {
                mensaje = string.Format("Error {0} \r\n El índice estaba fuera del intervalo.", ex.HResult);
            }

            if (ex is NullReferenceException)
            {
                mensaje = string.Format("Error {0} \r\n No se pudo crear un objeto requerido.", ex.HResult);
            }

            if (ex is InvalidCastException)
            {
                mensaje = string.Format("Error {0} \r\n Imposible convertir los tipos de datos.", ex.HResult);
            }

            if (ex is System.InvalidOperationException)
            {
            }

            if (ex is System.IndexOutOfRangeException)
            {
            }

            if (ex is MissingReportSourceException)
            {
                mensaje = string.Format("Error {0} \r\n No se encontró el reporte.", ex.HResult);
            }

            if (ex is System.Data.SqlClient.SqlException)
            {
                mensaje = string.Format("Error {0} \r\n No se pudo completar una operación en la base de datos", ex.HResult);
            }

            if (ex is System.FormatException)
            {
                mensaje = string.Format("Error {0} \r\n El formato no cumple las especificaciones requeridas.", ex.HResult);
            }

            if (ex is Exception)
            {
            }
            GenericUtil.CreateLog(modulo, tipo, TipoLog.Error,
                                  string.Format(" Tipo error ==> {0} \r\n \r\n Mensaje de error ==> {1} \r\n \r\n Origen del error ==> {2}",
                                                ex.GetType().Name, ex.Message, ex.StackTrace));
            return(mensaje);
        }
Esempio n. 3
0
 public UserLog(ModuloLog logModule, TipoObjeto logSource, TipoLog logType, string description, string changes)
 {
     this._id          = Guid.NewGuid();
     this._description = description;
     this._logModule   = logModule;
     this._source      = logSource;
     this._type        = logType;
     this._date        = DateTime.Now;
     this.UserName     = AppInfo.CurrentUser.Nick;
     this._hostName    = AppInfo.HostName;
     this._changes     = changes;
 }
Esempio n. 4
0
 public static void CreateLog(ModuloLog modulo, TipoObjeto origen, TipoLog tipo, string descripcion, string cambios = "")
 {
     try
     {
         UserLog        userLog = new UserLog(modulo, origen, tipo, descripcion, cambios);
         List <UserLog> list    = GetUserLog();
         list.Add(userLog);
         string fileName = Path.Combine(AppInfo.AppPath, @"..\activity.dasp");
         using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
         {
             BinaryFormatter formatter = new BinaryFormatter();
             formatter.Serialize(fs, list);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Inicializa una nueva instancia de la clase DatosBase y recupera la instancia de modulo de log y datos
 /// </summary>
 public DatosBase()
 {
     this._moduloLog = ModuloLog.GetInstance(Constantes.MODULO_LOG);
     this._moduloDatos = ModuloDatos.GetInstance(Constantes.MODULO_DATOS);
     this._moduloDatosInformes = ModuloDatos.GetInstance(Constantes.MODULO_DATOS_INFORMES);
 }
Esempio n. 6
0
 public AbstractWorker(bool returnUpdatedDbStats)
 {
     this.chargeData = ChargeData.getInstance();
     this.modLog = ModuloLog.GetInstance(Constantes.MODULO_LOG);
     this.returnUpdatedDbStats = returnUpdatedDbStats;
 }