Idea of the project: if someone wants to order a project development, here you can send an application.
using System;
using System.Text.RegularExpressions;
using System.Web;
namespace ProjectRequestTest.Core
{
public class Helpers
{
public static string GetUserIP()
{
return HttpContext.Current.Request.ServerVariables.Get("REMOTE_ADDR");
}
public static int GetVar(string VarName)
{
if (HttpContext.Current.Request.QueryString.Get(VarName) != null &&
HttpContext.Current.Request.QueryString.Get(VarName).Trim().Length > 0)
{
var isNumber = new Regex(@"^\d+$");
var m = isNumber.Match(HttpContext.Current.Request.QueryString.Get(VarName));
return m.Success ? Convert.ToInt32(HttpContext.Current.Request.QueryString.Get(VarName)) : 0;
}
return 0;
}
public static long GenerateNumericCode()
{
Random r = new Random();
long code = r.Next(1, 16777216);
return code;
}
public static bool ValidateEmail(string email)
{
if (string.IsNullOrEmpty(email))
return false;
return Regex.Match(email.Trim(), "^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$").Success;
}
}
}