Example #1
0
        public static string FilterAnd(params object[] pv)
        {
            string filter = "";

            if (pv == null || pv.Length == 0)
            {
                return("");
            }

            if (pv.Length % 2 != 0)
            {
                throw new Exception("Length of parameter-value collection should be an even number. Incorrect parameter-value collection [" + UStr.GetString(pv) + "]");
            }

            for (int i = 0; i < pv.Length; i += 2)
            {
                if (pv.GetValue(i) != null)
                {
                    string val = "";

                    if (pv.GetValue(i + 1) != null)
                    {
                        val = pv.GetValue(i + 1).ToString();
                    }

                    filter = BaseItem.FilterAnd(filter, UStr.FilterExact(pv.GetValue(i).ToString(), val));
                }
            }

            filter = BaseItem.TrimAnd(filter);

            return(filter);
        }
Example #2
0
        public static bool Contains(DataTable table, string columnName, string value)
        {
            table.DefaultView.RowFilter = UStr.FilterExact(columnName, value);

            bool contains = table.DefaultView.Count != 0;

            table.DefaultView.RowFilter = "";

            return(contains);
        }