public static bool IsPathCardN(string value) { string[] valArray = value.Trim().Split('\\'); if (valArray.Length != 2) { return(false); } if (!PathTreeN.IsPathTreeN(valArray[0])) { return(false); } int val; if (!int.TryParse(valArray[1], out val)) { return(false); } if (val <= 0) { return(false); } return(true); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(System.String) && value is PathTreeN) { PathTreeN so = (PathTreeN)value; return(so.ToString()); } return(base.ConvertTo(context, culture, value, destinationType)); }
public override bool Equals(object obj) { if (obj == null || obj == DBNull.Value) { return(false); } PathCardN cp = (PathCardN)obj; return(PathTreeN.Equals(Parent, cp.Parent) && int.Equals(CodeN, cp.CodeN)); }
public PathCardN(string spath) { try { string[] parts = spath.Split('\\'); if (string.IsNullOrEmpty(parts[0])) { Parent = null; } else { Parent = new PathTreeN(parts[0]); } CodeN = parts[1]; } catch { throw new ArgumentException("Строка '" + spath + "' не может быть преобразована в тип PathCardN"); } }
public PathCardN(PathTreeN parent, string codeN) { Parent = parent; CodeN = codeN; }