Beispiel #1
0
 /// <summary>
 /// テキストボックス未入力検証処理
 /// </summary>
 /// <param name="text"></param>
 /// <param name="messaging"></param>
 /// <returns>
 /// 未入力の確認 <see cref="string.IsNullOrWhiteSpace(string)"/>を実施し、
 /// 未入力の場合に <see cref="false"/>を返す
 /// </returns>
 public static bool ValidateInputted(this Controls.VOneTextControl text,
                                     Action messaging)
 {
     if (!string.IsNullOrWhiteSpace(text.Text))
     {
         return(true);
     }
     text.Focus();
     messaging?.Invoke();
     return(false);
 }
Beispiel #2
0
 /// <summary>検索などでの範囲検索用 検証処理</summary>
 /// <param name="text1"><see cref="Controls.VOneTextControl"/>テキストボックス1</param>
 /// <param name="text2"><see cref="Controls.VOneTextControl"/>テキストボックス2</param>
 /// <param name="messaging">メッセージ処理を行うハンドラ</param>
 /// <returns>
 /// 範囲検索で、text1, text2 どちらも入力があり、text2 の文字が text1より大きい場合に検証エラーとする
 /// コントロールの選択、メッセージ処理の順序
 /// </returns>
 public static bool ValidateRange(this Controls.VOneTextControl text1,
                                  Controls.VOneTextControl text2, Action messaging)
 {
     if (string.IsNullOrEmpty(text1.Text) ||
         string.IsNullOrEmpty(text2.Text) ||
         text1.Text.CompareTo(text2.Text) <= 0)
     {
         return(true);
     }
     text1.Focus();
     messaging?.Invoke();
     return(false);
 }
Beispiel #3
0
 /// <summary>コード、名称の印刷用文字列取得</summary>
 /// <param name="text"></param>
 /// <param name="label"></param>
 /// <returns>
 /// コード未入力:(指定なし)
 /// コードのみ入力:{text.Text}
 /// コード、名称指定:{text.Text}:{label.Text}
 /// </returns>
 public static string GetPrintValueCode(this Controls.VOneTextControl text,
                                        Controls.VOneDispLabelControl label)
 => string.IsNullOrEmpty(text?.Text)
     ? NotInputted
     : text?.Text
 + (string.IsNullOrEmpty(label?.Text) ? "" :  ":" + label.Text);
Beispiel #4
0
 /// <summary>テキストボックスの印刷用文字列取得</summary>
 /// <param name="text"></param>
 /// <returns>
 /// 未入力:(指定なし)
 /// 入力済:{text.Text}
 /// </returns>
 public static string GetPrintValue(this Controls.VOneTextControl text)
 => string.IsNullOrEmpty(text?.Text) ? NotInputted : text?.Text;