Ejemplo n.º 1
0
        public static List<string> readCard()
        {
            SL500 sl = new SL500();

            /****************list blocks*********************/
            // 0 ... card number
            // 1 ... card type
            // 2 ... credit
            // 3 ... name
            // 4 ... surname
            // 5 ... function or some else

            List<string> result = new List<string>();
            char[] _trim = new char[] { '\0', ' ' };

            if (request() == true)
            {
                if (sl.anticoll() == true)
                {
                    string select = sl.select();

                    result.Add(select);
                    if (select != "e")
                    {
                        if (sl.authentify(1) == 0)
                        {
                            string type = sl.readType(0);
                            result.Add(type);
                            int owner = SL500.ownerId(0);
                            if (owner != -1 && owner == program.Owner || owner == 0)
                            {
                                sl.authentify(1);
                                string credit = sl.data((byte)block._credit);
                                result.Add(credit.Trim(_trim));

                                sl.authentify(2);
                                string name = sl.data((byte)block._name);
                                result.Add(name.Trim(_trim));

                                sl.authentify(2);
                                string surname = sl.data((byte)block._surname);
                                result.Add(surname.Trim(_trim));

                                sl.authentify(2);
                                string func = sl.data((byte)block._func);
                                result.Add(func.Trim(_trim));

                                sl.authentify(1);
                                string discount = sl.readType(1);
                                result.Add(discount);

                                return result;
                            }
                            else
                            {
                                result.Add(owner.ToString());
                            }
                        }
                        return result;
                    }
                    return null;
                }
                return null;
            }
            return null;


        }