public int CompareTo(object obj) { //return 0; if (obj == null) { return(1); } PathCard fp = (PathCard)obj; if (fp.Parent == null && Parent != null) { return(-1); } if (fp.Parent != null && Parent == null) { return(1); } int i = 0; if (Parent != null) { i = Parent.CompareTo(fp.Parent); } return((i == 0) ? Code.CompareTo(fp.Code) : i); }
public override bool Equals(object obj) { if (obj == null || obj == DBNull.Value) { return(false); } PathCard cp = (PathCard)obj; return(PathTree.Equals(Parent, cp.Parent) && int.Equals(Code, cp.Code)); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(System.String) && value is PathCard) { PathCard so = (PathCard)value; return(so.ToString()); } return(base.ConvertTo(context, culture, value, destinationType)); }
public static bool Equals(PathCard a, PathCard b) { if (a == null || b == null) { return(false); } if (a.Code != b.Code) { return(false); } return(PathTree.Equals(a.Parent, b.Parent)); }
public static int Compare(PathCard a, PathCard b) { if (a == null && b == null) { return(0); } if (a != null) { return(a.CompareTo(b)); } else { return(-b.CompareTo(a)); } }
public static IDAOFilter CreateICardDatFilter <T>(IDataAccess accessor, ArrayList args) where T : BaseDat <T>//, new() { IDAOFilter filter = accessor.NewFilter(); if (args.Count == 1) { if (args[0] is int) { return(CreateIDatFilter <T>(accessor, args)); } else if (args[0] is PathCard) { filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), ((PathCard)args[0]).Parent.ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), ((PathCard)args[0]).Code))); return(filter); } else if (args[0] is string) { string argVal = args[0].ToString(); if (PathCard.IsPathCard(argVal)) { filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), new PathCard(argVal).Parent.ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), new PathCard(argVal).Code))); return(filter); } } } else if (args.Count == 2) { //if (args[0] is PathTree && args[1] is int) if (PathTree.IsPathTree(args[0].ToString()) && args[1] is int) { filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), ((PathTree)args[0]).ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), (int)args[0]))); return(filter); } else if (args[0] is string && args[1] is int) { filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), (string)args[0]), new FilterID(BaseDat <T> .GetFieldName("Code"), (int)args[0]))); return(filter); } } throw new ArgumentException("ќшибка формировани¤ ICardDatFilter по заданным аргументам", args2string(args)); }