From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。
---
HotelPms.Share.Windows/Util/InputCtrl.cs | 870 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 870 insertions(+), 0 deletions(-)
diff --git a/HotelPms.Share.Windows/Util/InputCtrl.cs b/HotelPms.Share.Windows/Util/InputCtrl.cs
new file mode 100644
index 0000000..f555864
--- /dev/null
+++ b/HotelPms.Share.Windows/Util/InputCtrl.cs
@@ -0,0 +1,870 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.IO;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Xml;
+using System.Xml.XPath;
+using HotelPms.Share.Util;
+using HotelPms.Share.Windows.Component;
+using HotelPms.Share.Windows.GraphicsApi;
+
+namespace HotelPms.Share.Windows.Util
+{
+ [Flags()]
+ public enum numInputType
+ {
+ None = 0x1, //���ɂȂ�
+ Num = 0x2, //����
+ Alpha_S = 0x4, //�A���t�@�x�b�g��
+ Alpha_C = 0x8, //�A���t�@�x�b�g��
+ Kana = 0x10, //�J�i
+ Half = 0x20, //���p
+ Full = 0x40, //�S�p
+ Num_FieldClear = 0x80, //���͍ő包��������N���A
+ Plus_FieldClear = 0x100,//"+"�L�[�ŃN���A
+ Space = 0x200, //��
+ Colon = 0x400, //":"���\
+ Subtract = 0x800, //"-"
+ DotSendKeys = 0x1000, //"."��"000"�Ƃ���
+ Dot = 0x2000, //"."
+ Slash = 0x4000, //"/"
+ Comma = 0x8000, //"," �J���}
+
+ Alpha = Alpha_S | Alpha_C,//�A���t�@�x�b�g��+�A���t�@�x�b�g��
+ NumAlpha = Num | Alpha | Space,//�����{�A���t�@�x�b�g�{��
+ ANK = NumAlpha | Kana, //�����{�A���t�@�x�b�g�{�{�J�i
+ TIME = Num | Colon, //���ԗp "12:30"
+ }
+
+ [Flags()]
+ public enum numShowStyle
+ {
+ None = 0x1, //���ɂȂ�
+ ZeroPad = 0x2, //����������������"0"�ɒlj�
+ ThousandSeparator = 0x4,//���z����3�����Ƃ�"," ��1,000,000
+ ShowList = 0x8, //END�L�[�ňꗗ�I����ʂ�����
+ }
+
+ public class InputCtrl
+ {
+ public static string Chr_SqlKinshi = "'";
+ public static string Chr_Num = "0123456789";
+ public static string Chr_Alpha_S = "abcdefghijklmnopqrstuvwxyz ";
+ public static string Chr_Alpha_C = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
+ public static string Chr_Kana = "���������������������������������������������������������� ";
+ public static string Chr_Alpha = Chr_Alpha_S + Chr_Alpha_C;
+ public static string Chr_NumAlpha = Chr_Num + Chr_Alpha;
+ public static string Chr_ANK = Chr_NumAlpha + Chr_Kana;
+
+ ///�� IsNotInOwnStr
+ ///�@�y�T�@�v�z�F�Y��������͐e������̒��Ɋ܂܂�ĂȂ���
+ ///�@�y���@���z�FhsValue�@�@�@�@����������
+ ///�@�@�@�@�@�@�@hsOwnString�@�@�e������@�@
+ ///�@�y�߂�l�z�FBoolean
+ public static bool IsNotInOwnStr(string hsValue, string hsOwnString)
+ {
+ try
+ {
+ for (int i = 0; i <= hsValue.Length - 1; i++)
+ {
+ if (hsOwnString.IndexOf(hsValue[i]) != -1)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+
+ ///�� IsInOwnStr
+ ///�@�y�T�@�v�z�F�Y��������͐e������̒��Ɋ܂܂�Ă܂���
+ ///�@�y���@���z�FhsValue�@�@�@�@����������
+ ///�@�@�@�@�@�@�@hsOwnString�@�@�e������@�@�@
+ ///�@�y�߂�l�z�FBoolean
+ public static bool IsInOwnStr(string hsValue, string hsOwnString)
+ {
+ try
+ {
+ for (int i = 0; i <= hsValue.Length - 1; i++)
+ {
+ if (hsOwnString.IndexOf(hsValue[i]) == -1)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ public static bool IsCorrectValue(CTextBox textBox)
+ {
+ return IsCorrectValue(textBox, true);
+ }
+
+ ///�� IsCorrectValue
+ ///�@�y�T�@�v�z�F�`�F�b�N
+ ///�@�y���@���z�F
+ ///�@�y�߂�l�z�Fobject
+ public static bool IsCorrectValue(CTextBox textBox, bool showErrMsg)
+ {
+ string wsChkStr = "";
+ numInputType wlErrFlg = 0;
+ int wiLen;
+ try
+ {
+ string text = (GetShowStyle(textBox) & numShowStyle.ThousandSeparator) == numShowStyle.ThousandSeparator ? textBox.Text.Replace(",", string.Empty) : textBox.Text;
+
+ System.Text.Encoding enc = System.Text.Encoding.Default;
+ wiLen = enc.GetBytes(text).Length;
+
+ numInputType inputType = GetInputType(textBox);
+
+ //���p�`�F�b�N
+ if ((inputType & numInputType.Half) == numInputType.Half && wiLen != text.Length)
+ {
+ if (showErrMsg) { MessageBox.Show(null, "���p���͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK); }
+ return false;
+ }
+
+ //�S�p�`�F�b�N
+ if ((inputType & numInputType.Full) == numInputType.Full && wiLen != 2 * text.Length)
+ {
+ if (showErrMsg) { MessageBox.Show(null, "�S�p���͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK); }
+ return false;
+ }
+
+ //����
+ if ((inputType & numInputType.Num) == numInputType.Num)
+ {
+ wsChkStr = wsChkStr + Chr_Num;
+ wlErrFlg = wlErrFlg | numInputType.Num;
+ }
+
+ //.
+ if ((inputType & numInputType.Dot) == numInputType.Dot)
+ {
+ wsChkStr = wsChkStr + ".";
+ wlErrFlg = wlErrFlg | numInputType.Dot;
+ }
+
+ //[/]
+ if ((inputType & numInputType.Slash) == numInputType.Slash)
+ {
+ wsChkStr = wsChkStr + "/";
+ wlErrFlg = wlErrFlg | numInputType.Slash;
+ }
+
+ //Space
+ if ((inputType & numInputType.Space) == numInputType.Space)
+ {
+ wsChkStr = wsChkStr + " ";
+ wlErrFlg = wlErrFlg | numInputType.Space;
+ }
+
+ //-
+ if ((inputType & numInputType.Subtract) == numInputType.Subtract)
+ {
+ wsChkStr = wsChkStr + "-";
+ wlErrFlg = wlErrFlg | numInputType.Subtract;
+ }
+
+ //:
+ if ((inputType & numInputType.Colon) == numInputType.Colon)
+ {
+ wsChkStr = wsChkStr + ":";
+ wlErrFlg = wlErrFlg | numInputType.Colon;
+ }
+
+ //,
+ if ((inputType & numInputType.Comma) == numInputType.Comma)
+ {
+ wsChkStr = wsChkStr + ",";
+ wlErrFlg = wlErrFlg | numInputType.Colon;
+ }
+
+ //���p
+ if ((inputType & numInputType.Alpha_C) == numInputType.Alpha_C)
+ {
+ wsChkStr = wsChkStr + Chr_Alpha_C;
+ wlErrFlg = wlErrFlg | numInputType.Alpha_C;
+ }
+
+ //��p
+ if ((inputType & numInputType.Alpha_S) == numInputType.Alpha_S)
+ {
+ wsChkStr = wsChkStr + Chr_Alpha_S;
+ wlErrFlg = wlErrFlg | numInputType.Alpha_S;
+ }
+
+ //�J�i
+ if ((inputType & numInputType.Kana) == numInputType.Kana)
+ {
+ wsChkStr = wsChkStr + Chr_Kana;
+ wlErrFlg = wlErrFlg | numInputType.Kana;
+ }
+ if (wsChkStr != "")
+ {
+ if (IsInOwnStr(text, wsChkStr) == false)
+ {
+ if (!showErrMsg) { return false; }
+ if (wlErrFlg == numInputType.Num)
+ {
+ MessageBox.Show(null, "��������͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK);
+ }
+ else if (wlErrFlg == numInputType.Kana)
+ {
+ MessageBox.Show(null, "���p�J�i����͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK);
+ }
+ else if (wlErrFlg == numInputType.Alpha_S)
+ {
+ MessageBox.Show(null, "���p��������͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK);
+ }
+ else if (wlErrFlg == numInputType.Alpha_C)
+ {
+ MessageBox.Show(null, "��p��������͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK);
+ }
+ else
+ {
+ MessageBox.Show(null, "�������l����͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK);
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+
+ ///�� IsOutOfRange
+ ///�@�y�T�@�v�z�F�`�F�b�N
+ ///�@�y���@���z�F
+ ///�@�y�߂�l�z�Fbool
+ public static bool IsOutOfRange(string hsValue, string hsRange)
+ {
+ try
+ {
+ string[] wsRange;
+ if (hsRange[0] == "'"[0])
+ {
+
+ if (hsRange.IndexOf("'" + hsValue + "'") == -1)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ wsRange = hsRange.Split(new char[] { ',' });
+ wsRange[0] = wsRange[0].Substring(1);
+ wsRange[1] = wsRange[1].Substring(0, wsRange[1].Length - 1);
+ if (hsRange[0] == '[')
+ {
+ if (Convert.ToDouble(hsValue) < Convert.ToDouble(wsRange[0]))
+ {
+ return true;
+ }
+ }
+ else if (hsRange[0] == '(')
+ {
+ if (Convert.ToDouble(hsValue) <= Convert.ToDouble(wsRange[0]))
+ {
+ return true;
+ }
+ }
+ if (hsRange[hsRange.Length - 1] == ']')
+ {
+ if (Convert.ToDouble(hsValue) > Convert.ToDouble(wsRange[1]))
+ {
+ return true;
+ }
+ }
+ else if (hsRange[hsRange.Length - 1] == ')')
+ {
+ if (Convert.ToDouble(hsValue) >= Convert.ToDouble(wsRange[1]))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ catch
+ {
+ return true;
+ }
+ }
+
+ public static bool IsCorrectText(CTextBox textbox)
+ {
+ return IsCorrectText(textbox, true, false);
+ }
+
+ public static bool IsCorrectText(CTextBox textbox, bool showErrMsg)
+ {
+ return IsCorrectText(textbox, showErrMsg, false);
+ }
+
+ public static bool IsCorrectText(CTextBox textbox, bool showErrMsg, bool ignoteNull)
+ {
+ if (!textbox.Visible) { return true; }
+
+ if (IsCorrectInput(textbox, showErrMsg, ignoteNull))
+ {
+ if (textbox.Text.Length > 0)
+ {
+ if ((GetShowStyle(textbox) & numShowStyle.ZeroPad) == numShowStyle.ZeroPad)
+ {
+ textbox.Text = textbox.Text.PadLeft(textbox.MaxLength, '0');
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static bool IsCorrectInput(CTextBox textbox)
+ {
+ return IsCorrectInput(textbox, true, false);
+ }
+
+ ///�� IsCorrectInput
+ ///�@�y�T�@�v�z�F�`�F�b�N
+ ///�@�y���@���z�F
+ ///�@�y�߂�l�z�Fbool
+ public static bool IsCorrectInput(CTextBox textbox, bool showErrMsg , bool ignoteNull)
+ {
+ try
+ {
+ if (textbox.IsChkData == false)
+ {
+ return true;
+ }
+
+ if ("".Equals(textbox.Text.Trim()))
+ {
+ if (ignoteNull){return true;}
+
+ if (textbox.NotNull)
+ {
+ if (showErrMsg) { MessageBox.Show("���e����͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK, MessageBoxIcon.Information); }
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ if (!IsCorrectValue(textbox, showErrMsg))
+ {
+ return false;
+ }
+ //System.Text.Encoding enc = System.Text.Encoding.GetEncoding("Shift_JIS");
+ //if (enc.GetBytes(hsValue).Length > hoCtrTag.MaxKeta)
+ //{
+ // if (showErrMsg) { MessageBox.Show(null, hoCtrTag.MaxKeta.ToString() + "���ȓ��œ��͂��Ă��������B", MessageBoxButtons.OK); }
+ // return false;
+ //}
+ if (textbox.IsDate)
+ {
+ if (CConvert.IsDate(CConvert.ToInt(textbox.Text).ToString().PadLeft(8,'0')))
+ {
+ if (showErrMsg) { MessageBox.Show("���t����͂��Ă��������B", "���̓`�F�b�N", MessageBoxButtons.OK, MessageBoxIcon.Information); }
+ return false;
+ }
+ }
+ if (textbox.In_Range != "")
+ {
+ if (IsOutOfRange(textbox.Text, textbox.In_Range))
+ {
+ if (showErrMsg) { MessageBox.Show("���͔͈͈ȊO�ł��B", "���̓`�F�b�N", MessageBoxButtons.OK, MessageBoxIcon.Information); }
+ return false;
+ }
+ }
+
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ ///�� SetNextFocus
+ ///�@�y�T�@�v�z�F�J�\���ړ�
+ ///�@�y���@���z�F
+ ///�@�y�߂�l�z�Fbool
+ public static bool SetNextFocus(System.Windows.Forms.KeyEventArgs e)
+ {
+ try
+ {
+ System.Windows.Forms.Keys KeyCode = e.KeyCode;
+ if (KeyCode == Keys.Return)
+ {
+ SendKeys.Send("{TAB}");
+ }
+ else if (KeyCode == Keys.Escape)
+ {
+ SendKeys.Send("+{TAB}");
+ }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ public static numShowStyle GetShowStyle(CTextBox curField)
+ {
+ string[] wsItems = null;
+ if (curField.ShowStyle.Length == 0)
+ {
+ return numShowStyle.None;
+ }
+ else
+ {
+ wsItems = curField.ShowStyle.Split(new char[] { ',' });
+ numShowStyle ret = (numShowStyle)CConvert.ToInt(wsItems[0]);
+ for (int i = 1; i <= wsItems.Length - 1; i++)
+ {
+ ret = ret | (numShowStyle)CConvert.ToInt(wsItems[i]);
+ }
+ return ret;
+ }
+ }
+
+ public static numInputType GetInputType(CTextBox curField)
+ {
+ string[] wsItems = null;
+ if (curField.InputType.Length == 0)
+ {
+ return numInputType.None;
+ }
+ else
+ {
+ wsItems = curField.InputType.Split(new char[] { ',' });
+ numInputType ret = (numInputType)CConvert.ToInt(wsItems[0]);
+ for (int i = 1; i <= wsItems.Length - 1; i++)
+ {
+ ret = ret | (numInputType)CConvert.ToInt(wsItems[i]);
+ }
+ return ret;
+ }
+ }
+
+ public static void TextEnter(CTextBox hoTextBox)
+ {
+ numShowStyle style = GetShowStyle(hoTextBox);
+ if ((style & numShowStyle.ThousandSeparator) == numShowStyle.ThousandSeparator)
+ {
+ hoTextBox.Text = hoTextBox.Text.Replace(",", string.Empty);
+ }
+
+ if (!hoTextBox.PanelExEnabled)
+ {
+ if ((style & numShowStyle.ShowList) == numShowStyle.ShowList)
+ {
+ hoTextBox.BackColor = Color.Pink;
+ }
+ else
+ {
+ hoTextBox.BackColor = Color.LightSteelBlue;
+ }
+ }
+ }
+
+ public static void TextLeave(CTextBox hoTextBox)
+ {
+ numShowStyle style = GetShowStyle(hoTextBox);
+ if ((style & numShowStyle.ThousandSeparator) == numShowStyle.ThousandSeparator)
+ {
+ hoTextBox.Text = string.Format("{0:#,0}", CConvert.ToDecimal(hoTextBox.Text));
+ }
+ if (!hoTextBox.PanelExEnabled) { hoTextBox.BackColor = hoTextBox.ReadOnly ? ColorType.Control : Color.White; }
+ }
+
+ public static bool TextKeyPress(TextBox hoTextBox, ref char hKeyAscii, int hlMaxKeta, numInputType hlInputType)
+ {
+ try
+ {
+ if (hlInputType == numInputType.None)
+ {
+ return true;
+ }
+
+ if (hKeyAscii == 8)
+ {
+ return true;
+ }
+ else if (hKeyAscii == "'"[0])
+ {
+ hKeyAscii = (char)0;
+ return false;
+ }
+ else if (hKeyAscii == 13)
+ {
+ //hKeyAscii = (char)0;
+ return false;
+ }
+ else if (hKeyAscii == '+')
+ {
+ //if ((hlInputType & numInputType.Plus_FieldClear) == numInputType.Plus_FieldClear)
+ //{
+ // hoTextBox.Text = "";
+ // hKeyAscii = (char)0;
+ // return false;
+ //}
+ }
+
+ if ((hlInputType & numInputType.Num_FieldClear) == numInputType.Num_FieldClear)
+ {
+ if (hoTextBox.Text.Length >= hlMaxKeta)
+ {
+ hoTextBox.Text = "";
+ //���̃`�F�b�N�ɍs��
+ }
+ }
+
+ if ((hlInputType & numInputType.Num) == numInputType.Num)
+ {
+ if ('0' <= hKeyAscii && hKeyAscii <= '9')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Dot) == numInputType.Dot)
+ {
+ if (hKeyAscii == '.')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Slash) == numInputType.Slash)
+ {
+ if (hKeyAscii == '/')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Colon) == numInputType.Colon)
+ {
+ if (hKeyAscii == ':')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Subtract) == numInputType.Subtract)
+ {
+ if (hKeyAscii == '-')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Comma) == numInputType.Comma)
+ {
+ if (hKeyAscii == ',')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.DotSendKeys) == numInputType.DotSendKeys)
+ {
+ if (hKeyAscii == '.')
+ {
+ SendKeys.Send("000");
+ hKeyAscii = (char)0;
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Space) == numInputType.Space)
+ {
+ if (hKeyAscii == ' ')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Alpha_C) == numInputType.Alpha_C)
+ {
+ if ('A' <= hKeyAscii && hKeyAscii <= 'Z')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Alpha_S) == numInputType.Alpha_S)
+ {
+ if ('a' <= hKeyAscii && hKeyAscii <= 'z')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Kana) == numInputType.Kana)
+ {
+ if ('�' <= hKeyAscii && hKeyAscii <= '�')
+ {
+ return true;
+ }
+ }
+
+ if ((hlInputType & numInputType.Half) == numInputType.Half)
+ {
+ if (hKeyAscii >= 0 && hKeyAscii <= 255)
+ {
+ return true;
+ }
+ }
+ if ((hlInputType & numInputType.Full) == numInputType.Full)
+ {
+ if (hKeyAscii < 0 || hKeyAscii > 255)
+ {
+ return true;
+ }
+ }
+
+ hKeyAscii = (char)0;
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ public static void TextBoxEnter(object sender)
+ {
+ TextBox txtField = (TextBox)sender;
+ txtField.BackColor = Color.Pink;
+ }
+
+ public static void TextBoxLeave(object sender)
+ {
+ TextBox txtField = (TextBox)sender;
+ txtField.BackColor = Color.White;
+ }
+
+ public static void TextBoxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e,int maxKeta,numInputType inputType)
+ {
+ TextBox txtField = (TextBox)sender;
+ char KeyAscii = e.KeyChar;
+ TextKeyPress(txtField, ref KeyAscii, maxKeta, inputType);
+ if (KeyAscii == (char)0)
+ {
+ e.Handled = true;
+ }
+ }
+
+ ///�� GetFormXml
+ ///�@�y�T�@�v�z�F���ѕW���̂w�l�k��ǂ�
+ ///�@�y���@���z�F(IN) hsConfigXml String ̧���߽
+ ///�@�y�߂�l�z�F�Ȃ�
+ public static Dictionary<string, InputItem> GetFormXml(object hvConfigXml)
+ {
+ Dictionary<string, InputItem> woParentHash = new Dictionary<string, InputItem>();
+ XmlDocument doc = new XmlDocument();
+ string wsName;
+ string wsValue;
+ string wsCtrKey;
+ InputItem woCtrTag;
+ try
+ {
+ if (hvConfigXml == null)
+ {
+ return null;
+ }
+ if (hvConfigXml is Stream)
+ {
+ doc.Load(((Stream)(hvConfigXml)));
+ }
+ else
+ {
+ doc.Load(((string)(hvConfigXml)));
+ }
+ XmlNode rootnode = doc.DocumentElement;
+ foreach (XmlNode child in rootnode.ChildNodes)
+ {
+ if (child.NodeType == XmlNodeType.Element && child.Name == "control")
+ {
+ wsCtrKey = child.Attributes["CtrName"].Value;
+ if (wsCtrKey.Length == 0)
+ {
+ return null;
+ }
+ woCtrTag = new InputItem();
+ foreach (XmlAttribute child1 in child.Attributes)
+ {
+ wsName = child1.Name;
+ wsValue = child1.Value;
+ //Debug.WriteLine(wsName + " : " + wsValue);
+ if (wsName.Equals("InputType"))
+ {
+ string[] wsItems = null;
+ wsItems = wsValue.Split(new char[] { ','});
+ for (int i = 0; i <= wsItems.Length - 1; i++)
+ {
+ woCtrTag.InputType = woCtrTag.InputType | (numInputType)CConvert.ToInt(wsItems[i]);
+ }
+ }
+ else if (wsName.Equals("ShowStyle"))
+ {
+ string[] wsItems = null;
+ wsItems = wsValue.Split(new char[] { ',' });
+ for (int i = 0; i <= wsItems.Length - 1; i++)
+ {
+ woCtrTag.ShowStyle = woCtrTag.ShowStyle | (numShowStyle)CConvert.ToInt(wsItems[i]);
+ }
+ }
+ else if (wsName.Equals("ImeMode"))
+ {
+ woCtrTag.ImeMode = (ImeMode)CConvert.ToInt(wsValue);
+ }
+ else
+ {
+ CConvert.CallByName(woCtrTag, wsName, CallType.Let, new object[] { wsValue });
+ }
+ }
+ woParentHash.Add(wsCtrKey, woCtrTag);
+ }
+ }
+ return woParentHash;
+ }
+ catch
+ {
+ return woParentHash;
+ }
+ }
+
+ public static bool IsNaturalNumber(String strNumber)
+ {
+ Regex objNotNaturalPattern = new Regex("[^0-9]");
+ Regex objNaturalPattern = new Regex("0*[1-9][0-9]*");
+ return !objNotNaturalPattern.IsMatch(strNumber) &&
+ objNaturalPattern.IsMatch(strNumber);
+ }
+
+ public static bool IsInteger(String strNumber)
+ {
+ Regex objNotIntPattern = new Regex("[^0-9-]");
+ Regex objIntPattern = new Regex("^-[0-9]+$|^[0-9]+$");
+ return !objNotIntPattern.IsMatch(strNumber) && objIntPattern.IsMatch(strNumber);
+ }
+
+ public static bool IsPositiveNumber(String strNumber)
+ {
+ Regex objNotPositivePattern = new Regex("[^0-9.]");
+ Regex objPositivePattern = new Regex("^[.][0-9]+$|[0-9]*[.]*[0-9]+$");
+ Regex objTwoDotPattern = new Regex("[0-9]*[.][0-9]*[.][0-9]*");
+ return !objNotPositivePattern.IsMatch(strNumber) &&
+ objPositivePattern.IsMatch(strNumber) &&
+ !objTwoDotPattern.IsMatch(strNumber);
+ }
+
+ public static bool IsNumber(String strNumber)
+ {
+ Regex objNotNumberPattern = new Regex("[^0-9.-]");
+ Regex objTwoDotPattern = new Regex("[0-9]*[.][0-9]*[.][0-9]*");
+ Regex objTwoMinusPattern = new Regex("[0-9]*[-][0-9]*[-][0-9]*");
+ String strValidRealPattern = "^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
+ String strValidIntegerPattern = "^([-]|[0-9])[0-9]*$";
+ Regex objNumberPattern = new Regex("(" + strValidRealPattern + ")|(" + strValidIntegerPattern + ")");
+ return !objNotNumberPattern.IsMatch(strNumber) &&
+ !objTwoDotPattern.IsMatch(strNumber) &&
+ !objTwoMinusPattern.IsMatch(strNumber) &&
+ objNumberPattern.IsMatch(strNumber);
+ }
+
+ public static bool IsAlpha(String strToCheck)
+ {
+ Regex objAlphaPattern = new Regex("[^a-zA-Z]");
+ return !objAlphaPattern.IsMatch(strToCheck);
+ }
+
+ public static bool IsAlphaNumeric(String strToCheck)
+ {
+ Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
+ return !objAlphaNumericPattern.IsMatch(strToCheck);
+ }
+
+ public static bool IsHalfKana(String strToCheck)
+ {
+ Regex objNotPattern = new Regex("[^�-�]");
+ Regex objPattern = new Regex("^[�-�]+$");
+ return !objNotPattern.IsMatch(strToCheck) && objPattern.IsMatch(strToCheck);
+ }
+
+ public static bool IsLargAlpha(String strToCheck)
+ {
+ Regex objNotPattern = new Regex("[^A-Z]");
+ Regex objPattern = new Regex("^[A-Z]+$");
+ return !objNotPattern.IsMatch(strToCheck) && objPattern.IsMatch(strToCheck);
+ }
+
+ public static bool IsSmallAlpha(String strToCheck)
+ {
+ Regex objNotPattern = new Regex("[^a-z]");
+ Regex objPattern = new Regex("^[a-z]+$");
+ return !objNotPattern.IsMatch(strToCheck) && objPattern.IsMatch(strToCheck);
+ }
+
+ /// <summary>
+ /// �S�Đ������ǂ���
+ /// </summary>
+ /// <param name="strNumber"></param>
+ /// <returns></returns>
+ public static bool IsWholeNumber(String strNumber)
+ {
+ Regex objNotPattern = new Regex("[^0-9]");
+ Regex objPattern = new Regex("^[0-9]+$");
+ return !objNotPattern.IsMatch(strNumber) && objPattern.IsMatch(strNumber);
+ }
+
+ /// <summary>
+ /// SQL��SMALLDateTime�̃`�F�b�N
+ /// </summary>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static bool IsCorrectSmallDateTime(string value)
+ {
+ //1900-01-01 �` 2079-06-06
+ try
+ {
+ DateTime date = CConvert.ToDateTime(value);
+ if (date.Date.CompareTo(CConvert.ToDateTime("1900/01/01").Date) < 0) { return false; }
+ if (date.CompareTo(CConvert.ToDateTime("2079/06/05 23:59:59")) > 0) { return false; }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+}
--
Gitblit v1.10.0