/// <summary> /// Formの値をValueに取り込む /// </summary> /// <remarks> /// <para> /// テンプレートHTML内で Name= を指定している場合、正しい値を読み取る /// ことができません。(Fetchをする時点ではテンプレートをパースしてい /// ないため。) /// </para> /// </remarks> public virtual void Fetch(HttpPage page, object defaultValue = null) { string val = page.Fetch(Name, null); if (val == null) { Value = defaultValue; } else if (defaultValue is int) { Value = StringUtil.ToInt(val); } else if (defaultValue is double) { Value = StringUtil.ToDouble(val); } else if (defaultValue is bool) { Value = StringUtil.ToBool(val); } else { Value = val; } }
public override void Fetch(HttpPage page, object defaultValue = null) { if (defaultValue == null) { defaultValue = ""; } Value = StringUtil.ToBool(page.Fetch(Name, defaultValue.ToString())); }
public override void Fetch(HttpPage page, object defaultValue = null) { int d, hh, mm; if (defaultValue == null) { d = 0; } else if (defaultValue is int) { d = (int)defaultValue; } else { d = StringUtil.ToInt(defaultValue.ToString()); } hh = d / 60; mm = d % 60; Value = page.Fetch(Name + "Hour", hh) * 60 + page.Fetch(Name + "Minute", mm); }
public override void Fetch(HttpPage page, object defaultValue = null) { foreach (string val in page.Fetch(Name, "").Split(",".ToCharArray())) { if (val == Value.ToString()) { Checked = true; return; } } Checked = false; }
public override void Fetch(HttpPage page, object defaultValue = null) { int yy, mm, dd; if (defaultValue is DateTime) { DateTime d = (DateTime)defaultValue; yy = d.Year; mm = d.Month; dd = d.Day; } else { yy = 0; mm = 0; dd = 0; } Value = StringUtil.ToDateTime(String.Format("{0}/{1}/{2}", page.Fetch(Name + "Year", yy), page.Fetch(Name + "Month", mm), page.Fetch(Name + "Day", dd))); }
public override void Fetch(HttpPage page, object defaultValue = null) { T val; if (Enum.TryParse <T>(page.Fetch(Name, ""), out val)) { Value = val; } else { Value = defaultValue; } }