Ejemplo n.º 1
0
        /*
        public string generarExcelReporteVentas(string baseDatos, string ruta, DateTime fechaDesde, DateTime fechaHasta)
        {
            DataTable tabla = controlDisofi.obtenerExcelVentas(baseDatos, fechaDesde, fechaHasta);

            LogUser.agregarLog("tabla:" + (tabla == null ? "null" : (tabla.Rows.Count + "")));

            string rutaCompletaArchivo = generarExcel(ruta, "#8B0000", tabla, "Reporte Ventas");

            return rutaCompletaArchivo;
        }

        public string generarExcelReporteNV(string baseDatos, string ruta, DateTime fechaDesde, DateTime fechaHasta, string estado)
        {
            DataTable tabla = controlDisofi.obtenerExcelNV(baseDatos, fechaDesde, fechaHasta, estado);

            LogUser.agregarLog("tabla:" + (tabla == null ? "null" : (tabla.Rows.Count + "")));
            string rutaCompletaArchivo = generarExcel(ruta, "#8B0000", tabla, "Reporte Notas de Venta");                     

            return rutaCompletaArchivo;
        }
        */
        public string baseDatosUsuario()
        {
            LogUser.agregarLog(Newtonsoft.Json.JsonConvert.SerializeObject(SessionVariables.SESSION_DATOS_USUARIO));
            return SessionVariables.SESSION_DATOS_USUARIO.UsuarioEmpresaModel.BaseDatos;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// clase de obtencion del SP para su ejecucion
        /// </summary>
        /// <param name="spName">Nombre del SP</param>
        /// <param name="sqlParametersIn">Parametros de entrada Hastable</param>
        /// <param name="singleParameter">Parametros de entrada singulares</param>
        /// <param name="transaccion">identifica si se realiza la ejecucion con tipo transac</param>
        /// <returns>DataTable con los datos de la ejecucion del SP</returns>
        private DataTable ObtenerProcedimientoAlmacenado(string spName, System.Collections.Hashtable sqlParametersIn, SqlParameter singleParameter, SqlTransaction transaccion)
        {
            var sqlCommand = new SqlCommand(spName);
            var adapter    = new SqlDataAdapter();
            var aData      = new DataTable();

            sqlCommand.CommandTimeout = 600;
            if (sqlParametersIn != null && sqlParametersIn.Count > 0)
            {
                foreach (System.Collections.DictionaryEntry sqlParameter in sqlParametersIn)
                {
                    sqlCommand.Parameters.Add(new SqlParameter(sqlParameter.Key.ToString(), sqlParameter.Value));
                }
            }
            else if (singleParameter != null)
            {
                sqlCommand.Parameters.Add(singleParameter);
            }
            try
            {
                sqlCommand.Connection = new SqlConnection(DataSource.coneccionPrimaria);
                sqlCommand.Connection.Open();
                if (transaccion != null)
                {
                    sqlCommand.Transaction = transaccion;
                }
                sqlCommand.CommandType = CommandType.StoredProcedure;
                adapter.SelectCommand  = sqlCommand;

                adapter.Fill(aData);
                return(aData);
            }
            catch
            {
                try
                {
                    sqlCommand.Connection = new SqlConnection(DataSource.coneccionPrimaria);
                    sqlCommand.Connection.Open();
                    if (transaccion != null)
                    {
                        sqlCommand.Transaction = transaccion;
                    }
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    adapter.SelectCommand  = sqlCommand;
                    adapter.Fill(aData);
                    return(aData);
                }
                catch (SqlException e)
                {
                    LogUser.agregarLog(e.Message);
                    throw (new CapturaExcepciones(e));
                }
                catch (Exception e)
                {
                    LogUser.agregarLog(e.Message);
                    throw (new CapturaExcepciones(e));
                }
            }
            finally
            {
                adapter = null;
                aData   = null;
                sqlCommand.Connection.Close();
                sqlCommand = null;
            }
        }