Exemplo n.º 1
0
 public ReceiptRow this[ReceiptRowKey rowKey]
 {
     get { return _rows[rowKey]; }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Создает экземпляр класса
        /// </summary>
        /// <param name="host">Хост Форинт-К</param>
        /// <param name="port">Порт службы обмена данными</param>
        /// <param name="dataResolver">Объект для поиска данных по коду</param>
        public SalesExplorer(String host, Int32 port, IDataResolver dataResolver)
        {
            Host = host;
            Port = port;
            
            _dataResolver = dataResolver;
            if (_dataResolver != null)
                _dataResolver.FillCache();

            _tableFunctions = new Dictionary<String, FuncGroup>();
            _tableFunctions.Add("ЗаголовкиСмен", new FuncGroup
            {
                Constructor = () => new ShiftSummary(),
                Persister = (obj) => _summary.NewShift((ShiftSummary)obj),
                PropertySetter = (obj, reader) => ProcessProperty((ShiftSummary)obj, reader)
            });
            _tableFunctions.Add("ЗаголовкиЧеков", new FuncGroup
            {
                Constructor = () => new ReceiptHeader(),
                Persister = (obj) =>
                {
                    var header = (ReceiptHeader)obj;
                    _summary[header.ShiftNo].NewReceipt(header);
                },
                PropertySetter = (obj, reader) => ProcessProperty((ReceiptHeader)obj, reader)
            });
            _tableFunctions.Add("ЧековаяЛента", new FuncGroup
            {
                Constructor = () => new ReceiptRow(),
                Persister = (obj) =>
                {
                    var row = (ReceiptRow)obj;
                    _summary[row.ShiftNo][row.ReceiptNo].NewRow(row);
                },
                PropertySetter = (obj, reader) => ProcessProperty((ReceiptRow)obj, reader)
            });
            _tableFunctions.Add("АвтоматическиеСкидки", new FuncGroup
            {
                Constructor = () => new Discount(),
                Persister = (obj) =>
                {
                    var discount = (Discount)obj;
                    var key = new ReceiptRowKey(discount.Article, discount.SeriesId);
                    _summary[discount.ShiftNo][discount.ReceiptNo][key].NewAutoDiscount(discount);
                },
                PropertySetter = (obj, reader) => ProcessProperty((Discount)obj, reader)
            });
            _tableFunctions.Add("ПерсональныеСкидки", new FuncGroup
            {
                Constructor = () => new Discount(),
                Persister = (obj) =>
                {
                    var discount = (Discount)obj;
                    var key = new ReceiptRowKey(discount.Article, discount.SeriesId);
                    _summary[discount.ShiftNo][discount.ReceiptNo][key].NewPersonalDiscount(discount);
                },
                PropertySetter = (obj, reader) => ProcessProperty((Discount)obj, reader)
            });
            _tableFunctions.Add("КредитныеКарты", new FuncGroup
            {
                Constructor = () => new PaymentCard(),
                Persister = (obj) =>
                {
                    var card = (PaymentCard)obj;
                    _summary[card.ShiftNo][card.ReceiptNo].NewCard(card);
                },
                PropertySetter = (obj, reader) => ProcessProperty((PaymentCard)obj, reader)
            });
            _tableFunctions.Add("Наличность", new FuncGroup
            {
                Constructor = () => new Cash(),
                Persister = (obj) =>
                {
                    var cash = (Cash)obj;
                    _summary[cash.ShiftNo].NewCash(cash);
                },
                PropertySetter = (obj, reader) => ProcessProperty((Cash)obj, reader)
            });
            _tableFunctions.Add("ЖурналОпераций", new FuncGroup
            {
                Constructor = () => new LoggedEvent(),
                Persister = (obj) => _summary.NewEvent((LoggedEvent)obj),
                PropertySetter = (obj, reader) => ProcessProperty((LoggedEvent)obj, reader)
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Добавляет новую строку чека
        /// </summary>
        /// <param name="row">Строка чека</param>
        public void NewRow(ReceiptRow row)
        {
            ReceiptRowKey key = new ReceiptRowKey();
            key.Article = row.Article;
            key.SeriesId = row.SeriesId;

            _rows.Add(key, row);
        }