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 GetFormXml(object hvConfigXml) { Dictionary woParentHash = new Dictionary(); 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); } /// /// ‘S‚Đ”Žš‚©‚Ç‚¤‚© /// /// /// 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); } /// /// SQL‚ÌSMALLDateTime‚̃`ƒFƒbƒN /// /// /// 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; } } } }