Skip to content

Instantly share code, notes, and snippets.

View mario-loza's full-sized avatar

Mario Alejandro Loza Armand Ugon mario-loza

View GitHub Profile
@mario-loza
mario-loza / reallyusingproperties.cs
Last active February 9, 2017 21:32
reallyusingproperties_post
public class Person
{
private string name_;
private int age_;
private string address_;
public string Address
{ get { return address_; }
set { address_ = value;}
}
public int Age
{
get { return age_; }
set {
if (value > 0 && value < 120)
age_ = value;
}
}
public string Address
//To verify a seting
if (userType == "Admin")
{
IsAdmin = true;
}
//Or To define a Process inside a function
if (process == "CreditExtension")
{
calculateInterest = true;
//Sample A
public enum UserType
{
Admin,
User
}
//To verify a seting
if (userType == UserType.Admin)
{
public static class OperationName
{
public const string CreditExtension = "Credit Extension" ;
public const string Payment = "Payment Made" ;
public const string SaleAsset = "Sale Assets" ;
}
//That way we can use them in the following way:
if (process == OperationName.CreditExtension)
//Para verificar algun seting
if (tipoDeUsuario == "Admin")
{
EsAdmin = true;
}
//O para definir un proceso dentro de una funcion
if (proceso == "ExtensionCredito")
{
calcularInteres = true;
//Ejemplo A
public enum TipoUsuario
{
Admin,
User
}
//Para verificar un seting
if (tipoUsuario == TipoUsuario.Admin)
{
public static class Operacion
{
public const string ExtensionCredito = "Extension de Credito" ;
public const string Pago = "Pago Hecho" ;
public const string VentaActivo = "Venta de Activos" ;
}
//Asi podemos usar la funcionalidad de esta manera:
if (proceso == Operacion.ExtensionCredito)
@mario-loza
mario-loza / Program.cs
Created May 23, 2017 22:11
MyPaymentApp
using System.Text;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace MyPaymentApp
{
class Program
{
static string securityCode = "dhacBUCadH9BpVcGluemGneEk3Fctc3jXawG2dba51K2xnlqOqyzVg==";
@mario-loza
mario-loza / unitteststub.snippet
Created July 7, 2017 19:02
Unit Test Stub Snippet for Visual C#
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unit Test Stub</Title>
<Description>Stub template for unit test</Description>
<Shortcut>uts</Shortcut>
</Header>
<Snippet>