private static bool GetStyleComp(ONLCompetition comp, string styleIndex) { try { string s = comp.GetStringParam(Constants.PDB_COMP_STYLES); if (String.IsNullOrEmpty(s)) { return(false); } return(s.IndexOf(styleIndex) > -1); } catch { return(false); } }
public static bool?GetBooleanParamNullable(this ONLCompetition comp, string paramName) { string val = comp.GetStringParam(paramName); if (String.IsNullOrEmpty(val)) { return(null); } bool res; if (bool.TryParse(val, out res)) { return(res); } var ip = comp.GetLongParamNullable(paramName); return(ip == null ? null : new bool?(ip.Value > 0)); }
public static double?GetDoubleParamNullable(this ONLCompetition comp, string paramName) { string val = comp.GetStringParam(paramName); if (String.IsNullOrEmpty(val)) { return(null); } double res; if (double.TryParse(val, out res)) { return(res); } else { return(null); } }
public static long?GetLongParamNullable(this ONLCompetition comp, string paramName) { string val = comp.GetStringParam(paramName); if (String.IsNullOrEmpty(val)) { return(null); } long l; if (long.TryParse(val, out l)) { return(l); } else { return(null); } }
public static DateTime?GetDateParamNullable(this ONLCompetition comp, string paramName) { string val = comp.GetStringParam(paramName); if (String.IsNullOrEmpty(val)) { return(null); } DateTime dt; if (DateTime.TryParse(val, new CultureInfo("ru-RU"), DateTimeStyles.AssumeUniversal, out dt)) { return(dt); } else { return(null); } }
private static void SetImageLinkVisible(HyperLink link, string paramName, ONLCompetition comp) { if (comp == null) { link.Visible = false; return; } string srcToSet = comp.GetBinaryParamLink(paramName); if (String.IsNullOrEmpty(srcToSet)) { link.Visible = false; return; } link.ImageUrl = srcToSet; string strNavigate = comp.GetStringParam(paramName + Constants.PDB_PARAM_ADD_INFO); if (strNavigate == null) { strNavigate = String.Empty; } link.NavigateUrl = strNavigate; link.Enabled = !strNavigate.Equals(String.Empty); }