Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 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");
     }
 }
Esempio n. 5
0
 public PathCardN(PathTreeN parent, string codeN)
 {
     Parent = parent;
     CodeN  = codeN;
 }