View more - Basic data retrieval using MongoDB C# Driver
Posted by layonman98 on Wed Apr 28 07:20:16 UTC 2010.
Language csharp
using MongoDB.Driver;
class Program
{
public static void Main()
{
var database = "test";
var collection = "users";
var server = new Mongo();
// Try to connect to localhost through the default port
View more - Múltiples proveedores de datos en una clase única usando DbFactory
Posted by layonman98 on Thu Apr 08 20:52:31 UTC 2010.
Language csharp
/* Enumeración y clase que permite realizar conexiones a distintos motores de bases de datos
* haciendo uso de distintos drivers intercalables en tiempo de ejecución y sin necesidad
* de recompilación.
* Las referencias ya deben están agregadas al proyecto, y las Connection Strings son
* obtenidas desde el archivo app.config
*/
using System;
using System.Configuration;
using System.Data;
using System.Data.Common;
View more - Final Image class
Posted by layonman98 on Thu Mar 11 14:13:56 UTC 2010.
Language csharp
public class PhotoHelper
{
internal static Image ResizeWithoutLosingProportion(Image img, int MaxWidth, int MaxHeight)
{
Image nImg = null;
if (img.Width > MaxWidth || img.Height > MaxHeight)
{
// Si la imágen NO es cuadrada
if (img.Width != img.Height)
View more - Redimensionar una imagen guardando las proporciones dadas para los valores máximos que pueda adoptar
Posted by layonman98 on Mon Mar 08 20:35:17 UTC 2010.
Language csharp
Bitmap ResizeWithoutLosingProportion( Image img, int MaxWidth, int MaxHeight )
{
Image nImg = null;
// Si la imágen sobrepasa el tamaño máximo
if ( img.Width > MaxWidth || img.Height > MaxHeight )
{
// Si la imágen NO es cuadrada
if ( img.Width != img.Height )
{
// Si la imágen es 'a lo alto'
View more - Usos de Linq en C#, Usando un Arreglo.
Posted by mijaelbenmanuel on Mon Mar 08 02:08:48 UTC 2010.
Language csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LINQ_prueba
{
class Program
{
static void Main(string[] args)
View more - Validar campos ( TextBox ) vacíos en un Windows Form
Posted by layonman98 on Sun Mar 07 15:55:36 UTC 2010.
Language csharp
using System.Windows.Forms;
using System.Drawing;
public static bool HasEmptyFields( Control.ControlCollection container )
{
var filledFiels = 0;
var textboxCount = 0;
foreach( Control c in container )
{
if( typeof( TextBox ) == c.GetType() )
View more - Acceder a Twitter por NetworkCredentials
Posted by efrrojas on Mon Mar 01 17:08:00 UTC 2010.
Language csharp
public static Usuario ValidarUsuario(string User, string Pass)
{
Usuario userActual = new Usuario();
try
{
NetworkCredential credencial = new NetworkCredential
{
UserName = User,
Password = Pass
};
View more - Métodos para convertir imágenes en arreglos de bytes y viceversa ( arreglo de bytes a imágenes )
Posted by layonman98 on Mon Mar 01 03:32:37 UTC 2010.
Language csharp
/* Con esta clase y sus métodos estáticos se pueden convertir imágenes
* en arreglos de bytes ( byte[] ) y viceversa.
* Excelente recurso a la hora de guardar y recuperar imágenes en bases de datos
*/
using System.Drawing;
using System.Drawing.Imagin;
using System.IO;
public class PhotoHelper
View more - Ejemplo de una clase genérica ( Generics ) con DAO
Posted by layonman98 on Fri Feb 26 15:01:21 UTC 2010.
Language csharp
using System.Collections.Generic;
// Model
public class User
{
public string Name { get; set; }
pubilc int Age { get; set; }
public User( string name, int age )
{
View more - Reducir tamaño de imágen usando la clase System.Drawing.Graphics
Posted by layonman98 on Mon Feb 22 17:59:22 UTC 2010.
Language csharp
/* Función ReduceImg:
* Retorna un objeto de tipo Bitmap con al imágen enviada a través
* del parámetro img reducida al tamaño dado por los valores de
* los parámetros nWidth y nHeight.
*/
//using System;
//using System.Drawing;
View more - Hello world
Posted by layonman98 on Sun Feb 21 00:24:57 UTC 2010.
Language csharp
using System;
public class Example{
public static void Main( string[] args ){
Console.WriteLine( "Hello, world!" );
}
}