private bool IsTypeOK(ref string info, ExtDefKeyValue aKeyValue, ExtDefItem item) { bool flag = true; if (item.Type.Equals("True/False")) { bool flag2; flag = DataValidate.IsBoolean(ref info, item.Legend, aKeyValue.Value, out flag2); aKeyValue.Value = ProcessTrueFalseText(flag2.ToString()); return flag; } if (item.Type.Equals("Double")) { double num; flag = DataValidate.IsDouble(ref info, item.Legend, aKeyValue.Value, out num); aKeyValue.Value = num.ToString(); return flag; } if (item.Type.Equals("Integer")) { int num2; flag = DataValidate.IsInt(ref info, item.Legend, aKeyValue.Value, out num2); aKeyValue.Value = num2.ToString(); } return flag; }
private bool IsInChoiceList(ref string info, ExtDefKeyValue aKeyValue, ExtDefItem item) { bool flag = true; if (!((item.ChoiceList.Count <= 0) || item.ChoiceList.Contains(aKeyValue.Value))) { info = NEResource.NE_INVALID_FIELD + item.Legend; flag = false; } return flag; }
private bool IsLengthOK(ref string info, ExtDefKeyValue aKeyValue, ExtDefItem item) { bool flag = true; if (item.Type.Equals("Text") && (aKeyValue.Value.Length > item.Size)) { string str = "Property '" + item.Legend + "'"; info = string.Format(NEResource.NE_VALIDATE_LENGTHLIMIT, str, item.Size); flag = false; } return flag; }
public bool IsValidateExtColValue(ref string info, DataRow dr, out List<ExtDefKeyValue> colValue, List<ExtDefItem> excDefineList) { bool flag = true; colValue = new List<ExtDefKeyValue>(); List<ExtDefItem> list = excDefineList; foreach (ExtDefItem item in list) { ExtDefKeyValue value2 = new ExtDefKeyValue(); string name = item.Name; string legend = item.Legend; string type = item.Type; bool flag2 = type.Equals("Integer") && !dr[name].ToString().Equals(""); if (flag2) { int num; flag &= DataValidate.IsInt(ref info, legend, dr[name], -2147483648, 0x7fffffff, out num); value2.Value = num.ToString(); } flag2 = type.Equals("Text") && !dr[name].ToString().Equals((string) null); if (flag2) { if (flag2 && (dr[name].ToString().Length > item.Size)) { flag = false; info = "The Length of " + dr[name].ToString().Length + " exceed the Size"; } value2.Value = dr[name].ToString(); } flag2 = type.Equals("Double") && !dr[name].ToString().Equals(""); if (flag2) { double num2; flag &= DataValidate.IsDouble(ref info, legend, dr[name], double.MinValue, double.MaxValue, out num2); value2.Value = num2.ToString(); } flag2 = type.Equals("True/False") && !dr[name].ToString().Equals(""); if (flag2) { bool flag3; flag &= DataValidate.IsBoolean(ref info, legend, dr[name], out flag3); value2.Value = flag3.ToString(); } if (value2.Value != null) { value2.Name = name; colValue.Add(value2); } } return flag; }
public bool ValidateExtColValue(ref string info, out List<ExtDefKeyValue> colValue, Panel pnlOther) { colValue = new List<ExtDefKeyValue>(); System.Windows.Forms.Control.ControlCollection controls = pnlOther.Controls; foreach (System.Windows.Forms.Control control in controls) { string name = control.Name; string text = control.Text; if (this.IsvalidateUserItem(ref info, name, text)) { ExtDefKeyValue item = new ExtDefKeyValue(name, text); colValue.Add(item); } else { return false; } } return true; }
private bool ValidateExtDefs(ref string info) { List<ExtDefKeyValue> list = new List<ExtDefKeyValue>(); for (int i = 0; i < this.m_extDefItems.Count; i++) { KeyValuePair<string, string> pair = this.m_extDefPair[i]; pair = this.m_extDefPair[i]; ExtDefKeyValue aKeyValue = new ExtDefKeyValue(pair.Key, pair.Value); if (!this.ValidateOneExtDef(ref info, aKeyValue)) { return false; } list.Add(aKeyValue); } this.m_Entity = list; return true; }
private bool ValidateOneExtDef(ref string info, ExtDefKeyValue aKeyValue) { ExtDefItem item = this.m_extDefItems.Find(delegate (ExtDefItem aItem) { return aItem.Name == aKeyValue.Name; }); return ((this.IsTypeOK(ref info, aKeyValue, item) && this.IsLengthOK(ref info, aKeyValue, item)) && this.IsInChoiceList(ref info, aKeyValue, item)); }
public bool ValidateExtColValue(ref string info, out List<ExtDefKeyValue> colValue, Panel pnlOther, List<ExtDefItem> addNewColumns) { colValue = new List<ExtDefKeyValue>(); Control.ControlCollection controls = pnlOther.Controls; foreach (Control control in controls) { if ((control is TextBox) || (control is ComboBox)) { string name = control.Name; string text = control.Text; if (!this.IsvalidateUserItem(ref info, name, text, addNewColumns)) { return false; } ExtDefKeyValue item = new ExtDefKeyValue(name, text); colValue.Add(item); } } return true; }
public bool IsValidateExtColValue(ref string info, DataRow dr, out List<ExtDefKeyValue> colValue, List<ExtDefItem> addNewColumns) { bool flag = true; colValue = new List<ExtDefKeyValue>(); foreach (ExtDefItem item in addNewColumns) { ExtDefKeyValue extkeyValue = new ExtDefKeyValue(); List<string> choiceList = item.ChoiceList; flag = this.IsValidateCellValue(ref info, dr, item, ref extkeyValue); if (!flag) { return false; } if (!DataValidate.NotEmptyString(dr[item.Name])) { extkeyValue.Value = item.Default; } extkeyValue.Name = item.Name; colValue.Add(extkeyValue); string str = extkeyValue.Value; bool flag2 = false; foreach (string str2 in choiceList) { if (str.Equals(str2)) { flag2 = true; break; } } bool flag3 = !flag2 && (choiceList.Count > 0); if (flag3) { if (IsDoubleOrINTType(item)) { choiceList.Add(extkeyValue.Value); } else { choiceList.Add(str); } } } return flag; }
private bool IsValidateCellValue(ref string info, DataRow dr, ExtDefItem item, ref ExtDefKeyValue extkeyValue) { bool flag = true; string name = item.Name; string legend = item.Legend; string type = item.Type; bool flag2 = type.Equals("Integer") && !dr[name].ToString().Equals(""); if (flag2) { int num; flag &= DataValidate.IsInt(ref info, legend, dr[name], -2147483648, 0x7fffffff, out num); extkeyValue.Value = num.ToString(); } flag2 = type.Equals("Text") && !dr[name].ToString().Equals((string) null); if (flag2) { if (flag2 && (dr[name].ToString().Length > item.Size)) { flag = false; info = string.Concat(new object[] { "The length of \"", dr[name].ToString(), "\" exceed the limited length ", item.Size, "!\r\n" }); } extkeyValue.Value = dr[name].ToString(); } flag2 = type.Equals("Double") && !dr[name].ToString().Equals(""); if (flag2) { double num2; flag &= DataValidate.IsDouble(ref info, legend, dr[name], double.MinValue, double.MaxValue, out num2); extkeyValue.Value = num2.ToString(); } flag2 = type.Equals("True/False") && !dr[name].ToString().Equals(""); if (flag2) { bool flag3; flag &= DataValidate.IsBoolean(ref info, legend, dr[name], out flag3); extkeyValue.Value = UserDefineDesc.ProcessTrueFalseText(flag3.ToString()); dr[name] = extkeyValue.Value; } return flag; }