public static long?IdEnviadoNull(HttpContext contexto, string chave) { if (contexto.Request[chave] != null && contexto.Request[chave] != "") { return(CTipos.CTipo <long>(contexto.Request[chave])); } else { return(null); } }
//------------------------------------------------------------------------- public static T ObterDataKeyValDoGrid <T>(GridView grid, GridViewCommandEventArgs e, int indice) { object val = null; if (e != null) { val = grid.DataKeys[Convert.ToInt32(e.CommandArgument)][indice]; } else { val = grid.DataKeys[indice].Value; } return(CTipos.CTipo <T>(val)); }
public static T ProcessaQueryStringSegura <T>(string secureuri, string key) { string sequencia = CryptoQueryStringHandler.DecryptQueryStrings(secureuri, WebConfigurationManager.AppSettings["CryptoKey"]); string[] pares = sequencia.Split('&'); string[,] retorno = new string[pares.Length, 2]; for (int i = 0; i < pares.Length; i++) { if (pares[i].Split('=')[0] == key) { return(CTipos.CTipo <T>(pares[i].Split('=')[1])); } } return((T)typeof(T).GetField("MinValue").GetValue(null)); }