public virtual void Delete(T entity)
        {
            if (IsStatelessSession)
            {
                if (!StatelessSession.IsOpen)
                {
                    throw new HibernateException("The stateless NHibernate session must be open before an entity can be deleted.");
                }
                if (StatelessSession.Transaction == null)
                {
                    throw new HibernateException("Deletes must be done within an NHibernate transaction.");
                }

                StatelessSession.BeginTransaction();
                StatelessSession.Delete(entity);
                StatelessSession.Transaction.Commit();
            }
            else
            {
                if (!Session.IsOpen)
                {
                    throw new HibernateException("NHibernate session must be open before an entity can be deleted.");
                }
                if (Session.Transaction == null)
                {
                    throw new HibernateException("Deletes must be done within an NHibernate transaction.");
                }

                Session.BeginTransaction();
                Session.Delete(entity);
                Session.Transaction.Commit();
            }
        }
        public virtual object[] GetProperties(string[] properties, string idName, object idValue)
        {
            var hql = "SELECT ";

            foreach (var p in properties)
            {
                if (!String.IsNullOrEmpty(p))
                {
                    hql += String.Format("t.{0}, ", p);
                }
            }

            // Replace the trailing comma and space with just a space
            hql  = hql.TrimEnd(", ".ToCharArray());
            hql += " ";

            // Now add the FROM and WHERE clauses
            hql += String.Format("FROM {0} t ", typeof(T).FullName);
            hql += String.Format("WHERE t.{0} = ?", idName);

            var query = IsStatelessSession
                                ? StatelessSession.CreateQuery(hql)
                                : Session.CreateQuery(hql);

            return(query
                   .SetParameter(0, idValue)
                   .List <object>()
                   .ToArray());
        }
Beispiel #3
0
        private void LoadPage(int page)
        {
            using (var tx = StatelessSession.BeginTransaction())
            {
                var actions = StatelessSession.CreateCriteria <ToDoAction>()
                              .SetFirstResult(page * PageSize)
                              .SetMaxResults(PageSize)
                              .List <ToDoAction>();

                var total = StatelessSession.CreateCriteria <ToDoAction>()
                            .SetProjection(Projections.RowCount())
                            .UniqueResult <int>();

                this.NumberOfPages.Value = total / PageSize + (total % PageSize == 0 ? 0 : 1);
                this.Model = new Model
                {
                    Actions       = new ObservableCollection <ToDoAction>(actions),
                    NumberOfPages = NumberOfPages,
                    CurrentPage   = CurrentPage + 1
                };
                this.CurrentPage.Value = page;

                tx.Commit();
            }
        }
        public void CanCreateStatelessDetachedFlowQuery()
        {
            Assert.That(() => StatelessSession.DetachedFlowQuery <UserEntity>(), Throws.Nothing);

            IDetachedFlowQuery <UserEntity> query = StatelessSession.DetachedFlowQuery <UserEntity>();

            Assert.That(query != null);
        }
        public void CanCreateStatelessDelayedFlowQueryWithOptions()
        {
            Assert.That(() => StatelessSession.DelayedFlowQuery <UserEntity>(new FlowQueryOptions()), Throws.Nothing);

            IDelayedFlowQuery <UserEntity> query = StatelessSession.DelayedFlowQuery <UserEntity>(new FlowQueryOptions());

            Assert.That(query != null);
        }
        public void CanCreateStatelessImmediateFlowQuery()
        {
            Assert.That(() => StatelessSession.ImmediateFlowQuery <UserEntity>(), Throws.Nothing);

            IImmediateFlowQuery <UserEntity> query = StatelessSession.ImmediateFlowQuery <UserEntity>();

            Assert.That(query != null);
        }
        public virtual IList <T> FindAll(NHibernateRepositorySortList sorts, int?pageIndex, int?pageSize, out int totalItems)
        {
            var criteria = IsStatelessSession
                                ? StatelessSession.CreateCriteria(typeof(T))
                                : Session.CreateCriteria(typeof(T));

            AddSortOrders(criteria, sorts);
            return(GetList(criteria, pageIndex, pageSize, out totalItems));
        }
Beispiel #8
0
        public StatelessSession CreateStatelessSession()
        {
            StatelessSession session = StatelessSessionFactory.New(this, x =>
            {
                // perhaps do some fun stuff here later, such as cloning working memory, etc.
            });

            return(session);
        }
        public virtual IList <T> FindByProperty(string property, object value, NHibernateRepositorySortList sorts, int?pageIndex, int?pageSize, out int totalItems)
        {
            var criteria = IsStatelessSession
                                ? StatelessSession.CreateCriteria(typeof(T))
                                : Session.CreateCriteria(typeof(T));

            criteria.Add(NHibernateCriterion.Restrictions.Eq(property, value));

            AddSortOrders(criteria, sorts);
            return(GetList(criteria, pageIndex, pageSize, out totalItems));
        }
Beispiel #10
0
        private List <string[]> ExecuteMaintainsQuery(string sql)
        {
            Log.Info(sql);
            var messages = StatelessSession
                           .CreateSQLQuery(sql)
                           .List <object[]>()
                           .Select(m => m.Select(v => v.ToString()).ToArray())
                           .ToList();

            Log.Info(messages.Implode(s => s.Implode(), Environment.NewLine));
            return(messages);
        }
Beispiel #11
0
        public List <T> GetAllStateless()
        {
            return(StatelessSession.CreateCriteria(persitentType).List <T>() as List <T>);

            //ICriteria criteria = Session.CreateCriteria(persitentType);

            ////foreach (ICriterion criterium in criterion)
            ////{
            ////  criteria.Add(criterium);
            ////}

            //return criteria.List<T>() as List<T>;
        }
Beispiel #12
0
        public override void Execute()
        {
            var end    = DateTime.Today.FirstDayOfWeek();
            var begin  = end.AddDays(-7);
            var period = end.ToShortDateString();
            var rows   = StatelessSession.CreateSQLQuery(@"
select r.DrugID, r.InnR, r.TradeNmR, r.DrugFmNmRS, r.Pack, r.DosageR, r.ClNm, r.Segment,
	:period as RptPeriod,
	l.SupplierCost as PrcPrice,
	cast(round(min(l.RetailCost), 2) as char) as RtlPrice
from WaybillLines l
	join RegulatorRegistry r on r.ProductId = l.ProductId and r.ProducerId = l.ProducerId
	join Waybills w on w.Id = l.WaybillId
where w.DocumentDate >= :begin and w.DocumentDate < :end and l.RetailCost is not null
group by r.DrugID")
                         .SetParameter("begin", begin)
                         .SetParameter("end", end)
                         .SetParameter("period", period)
                         .List();
            var settings = Session.Query <Settings>().First();
            var dir      = settings.InitAndMap("Reports");

            Result = Path.Combine(dir, FileHelper.StringToFileName($"Росздравнадзор-{period}.xls"));
            var book      = new HSSFWorkbook();
            var sheet     = book.CreateSheet("Отчет");
            var reportRow = sheet.CreateRow(0);

            reportRow.CreateCell(0).SetCellValue("DrugID");
            reportRow.CreateCell(1).SetCellValue("InnR");
            reportRow.CreateCell(2).SetCellValue("TradeNmR");
            reportRow.CreateCell(3).SetCellValue("DrugFmNmRS");
            reportRow.CreateCell(4).SetCellValue("Pack");
            reportRow.CreateCell(5).SetCellValue("DosageR");
            reportRow.CreateCell(6).SetCellValue("ClNm");
            reportRow.CreateCell(7).SetCellValue("Segment");
            reportRow.CreateCell(8).SetCellValue("RptPeriod");
            reportRow.CreateCell(9).SetCellValue("PrcPrice");
            reportRow.CreateCell(10).SetCellValue("RtlPrice");
            for (var i = 0; i < rows.Count; i++)
            {
                reportRow = sheet.CreateRow(i + 1);
                var row = ((object[])rows[i]);
                for (var j = 0; j < row.Length; j++)
                {
                    reportRow.CreateCell(j).SetCellValue(row[j]?.ToString());
                }
            }
            using (var stream = File.Create(Result))
                book.Write(stream);
        }
        public virtual T GetByProperty(string property, object value)
        {
            var hql = new StringBuilder();

            hql.Append(String.Format("FROM {0} t ", typeof(T).FullName));
            hql.Append(String.Format("WHERE t.{0} = ?", property));

            var query = IsStatelessSession
                                ? StatelessSession.CreateQuery(hql.ToString())
                                : Session.CreateQuery(hql.ToString());

            return(query
                   .SetParameter(0, value)
                   .UniqueResult <T>());
        }
        public void CanCreateStatelessDelayedFlowQueryWithAlias()
        {
            UserEntity alias = null;

            Assert.That(() => StatelessSession.DelayedFlowQuery(() => alias), Throws.Nothing);

            IDelayedFlowQuery <UserEntity> query = StatelessSession.DelayedFlowQuery(() => alias);

            Assert.That(query != null);

            ICriteria criteria = new CriteriaBuilder()
                                 .Build <UserEntity, UserEntity>(QuerySelection.Create(query as IQueryableFlowQuery));

            Assert.That(criteria.Alias, Is.EqualTo("alias"));
        }
        public void CanCreateStatelessDetachedFlowQueryWithAlias()
        {
            UserEntity alias = null;

            Assert.That(() => StatelessSession.DetachedFlowQuery(() => alias), Throws.Nothing);

            var query = StatelessSession.DetachedFlowQuery(() => alias) as DetachedFlowQuery <UserEntity>;

            Assert.That(query != null);

            DetachedCriteria criteria = new CriteriaBuilder()
                                        .Build <UserEntity>(query);

            Assert.That(criteria.Alias, Is.EqualTo("alias"));
        }
Beispiel #16
0
        public override void Execute()
        {
            InitSession();
            var tables = TableNames().ToArray();

            Reporter.Weight(tables.Length);
            var results = new List <RepairStatus>();

            foreach (var table in tables)
            {
                Token.ThrowIfCancellationRequested();

                var messages = ExecuteMaintainsQuery($"REPAIR TABLE {table} EXTENDED");
                var result   = Parse(messages);
                results.Add(result);
                if (result == RepairStatus.NumberOfRowsChanged || result == RepairStatus.Ok)
                {
                    result = Parse(ExecuteMaintainsQuery($"OPTIMIZE TABLE {table}"));
                    results.Add(result);
                }
                results.Add(result);
                if (result == RepairStatus.Fail)
                {
                    Log.ErrorFormat("Таблица {0} не может быть восстановлена.", table);
                    Log.Error($"DROP TABLE IF EXISTS {table}");
                    StatelessSession
                    .CreateSQLQuery($"DROP TABLE IF EXISTS {table}")
                    .ExecuteUpdate();
                    //если заголовок таблицы поврежден то drop table не даст результатов
                    //файлы останутся а при попытке создать таблицу будет ошибка
                    //нужно удалить файлы
                    Directory.GetFiles(Config.DbDir, table + ".*").Each(File.Delete);
                }

                Reporter.Progress();
            }

            Configure(new SanityCheck()).Check(true);

            Result = results.All(r => r == RepairStatus.Ok);
        }
Beispiel #17
0
 public List <T> GetAllStateless()
 {
     return(StatelessSession.Query <T>().ToList());
 }
        void ExecuteNonQuery(string sql)
        {
            ISQLQuery query = StatelessSession.CreateSQLQuery(sql);

            query.ExecuteUpdate();
        }
        public Order Unfreeze(IOrder sourceOrder, Address addressToOverride, ISession session, StringBuilder log)
        {
            var action = GuesAction(sourceOrder);

            if (!sourceOrder.IsAddressExists())
            {
                if (ShouldCalculateStatus(sourceOrder))
                {
                    var order = (Order)sourceOrder;
                    order.SendResult = OrderResultStatus.Reject;
                    order.SendError  = Restore
                                                ? "Заказ был заморожен, т.к. адрес доставки больше не доступен"
                                                : "Адрес доставки больше не доступен";
                }
                log.AppendLine($"Заказ №{sourceOrder.DisplayId} невозможно" +
                               $" {action}, т.к. адрес доставки больше не доступен.");
                return(null);
            }

            if (!sourceOrder.IsPriceExists())
            {
                if (ShouldCalculateStatus(sourceOrder))
                {
                    var order = (Order)sourceOrder;
                    order.SendResult = OrderResultStatus.Reject;
                    order.SendError  = Restore ? "Заказ был заморожен, т.к. прайс-листа нет в обзоре" : "Прайс-листа нет в обзоре";
                }
                log.AppendLine($"Заказ №{sourceOrder.DisplayId} невозможно" +
                               $" {action}, т.к. прайс-листа нет в обзоре.");
                return(null);
            }
            var address = addressToOverride ?? sourceOrder.Address;

            var destOrder = session.Query <Order>().FirstOrDefault(o => o.Id != sourceOrder.Id &&
                                                                   o.Address == address &&
                                                                   o.Price == sourceOrder.Price &&
                                                                   !o.Frozen);

            if (destOrder == null)
            {
                destOrder = new Order(sourceOrder.Price, address)
                {
                    Comment         = sourceOrder.Comment,
                    PersonalComment = sourceOrder.PersonalComment
                };
                if (Restore)
                {
                    destOrder.CreatedOn = sourceOrder.CreatedOn;
                }
            }

            var anyOffer = session.Query <Offer>().Any(o => o.Price == sourceOrder.Price);

            if (!anyOffer)
            {
                if (ShouldCalculateStatus(sourceOrder))
                {
                    var order = (Order)sourceOrder;
                    order.SendResult = OrderResultStatus.Reject;
                    order.SendError  = Restore ? "Заказ был заморожен, т.к. прайс-листа нет в обзоре" : "Прайс-листа нет в обзоре";
                }
                log.AppendLine(String.Format("Заказ №{0} невозможно {3}, т.к. прайс-листа {1} - {2} нет в обзоре",
                                             sourceOrder.DisplayId,
                                             sourceOrder.Price.Name,
                                             sourceOrder.Price.RegionName,
                                             action));
                return(null);
            }

            var ids         = sourceOrder.Lines.Select(l => l.ProductSynonymId).ToArray();
            var orderOffers = new Offer[0];

            if (ids.Length > 0)
            {
                orderOffers = Offer.Orderable(StatelessSession.Query <Offer>())
                              .Where(o => ids.Contains(o.ProductSynonymId) && o.Price == sourceOrder.Price)
                              .Fetch(o => o.Price)
                              .ToArray();
            }
            foreach (var line in sourceOrder.Lines.ToArray())
            {
                var offers = orderOffers
                             .Where(o => o.ProductSynonymId == line.ProductSynonymId &&
                                    o.ProducerSynonymId == line.ProducerSynonymId &&
                                    o.Price.Id == sourceOrder.Price.Id &&
                                    o.Code == line.Code &&
                                    o.RequestRatio == line.RequestRatio &&
                                    o.MinOrderCount == line.MinOrderCount &&
                                    o.MinOrderSum == line.MinOrderSum &&
                                    o.Junk == line.Junk)
                             .ToArray()
                             .OrderBy(o => o.ResultCost)
                             .ToArray();
                Merge(destOrder, sourceOrder, line, offers, log);
            }

            var currentOrder = sourceOrder as Order;

            if (currentOrder != null && currentOrder.IsEmpty)
            {
                session.Delete(sourceOrder);
            }
            if (!destOrder.IsEmpty && sourceOrder is DeletedOrder)
            {
                session.Delete(sourceOrder);
            }
            if (destOrder.IsEmpty)
            {
                return(null);
            }
            if (action == "вернуть в работу")
            {
                destOrder.KeepId = null;
            }
            return(destOrder);
        }
 public virtual T Get(object id)
 {
     return(IsStatelessSession
                         ? StatelessSession.Get <T>(id)
                         : Session.Get <T>(id));
 }
Beispiel #21
0
 public T GetStateless(ID id)
 {
     return(StatelessSession.Get <T>(id));
 }
Beispiel #22
0
        public override void Execute()
        {
            //отчет всегда готовится за предыдущий год
            var end     = new DateTime(DateTime.Today.Year, 1, 1);
            var year    = DateTime.Today.Year - 1;
            var begin   = new DateTime(year, 1, 1);
            var subrows = "sum(SupplierCost) / 1000 {0} SupplierCost, sum(RetailCost) / 1000 {0} RetailCost, sum(ProducerCost) / 1000 {0} ProducerCost";

            if (withNds)
            {
                subrows = string.Format(subrows, "* 1.1");
            }
            else
            {
                subrows = string.Format(subrows, "");
            }

            var query = StatelessSession.CreateSQLQuery($@"
select
BarCode,
sum(Total) Total,
{subrows},
min(if(registrycost = 0, null, registrycost)) RegistryCost,
sum(Planned) Planned,
(round(avg(RetailCostM),2) - round(avg(SupplierCostM),2)) / 1000 as Margin
from
(select
	b.Value as BarCode,
	l.Quantity / 1000 Total,
	round(l.SupplierCost * l.Quantity, 2) SupplierCost,
	round(l.RetailCost * l.Quantity, 2) RetailCost,
	round(producercost  * l.Quantity,2) ProducerCost,
	RegistryCost,
	quantity / 1000 Planned,
	RetailCost RetailCostM,
  SupplierCost SupplierCostM
from WaybillLines l
		join Waybills w on w.Id = l.WaybillId
	join BarCodes b on b.Value = l.EAN13
where b.Value = l.EAN13 and w.DocumentDate > :begin and w.DocumentDate < :end
group by l.id) as sub
group by BarCode;");

            query.SetParameter("begin", begin);
            query.SetParameter("end", end);
            var rows     = query.List();
            var settings = Session.Query <Settings>().First();
            var dir      = settings.InitAndMap("Reports");

            Result = Path.Combine(dir, FileHelper.StringToFileName($"Надб-ЖНВЛС-{year}.xls"));
            var book      = new HSSFWorkbook();
            var sheet     = book.CreateSheet("ЛС");
            var reportRow = sheet.CreateRow(0);

            reportRow.CreateCell(0).SetCellValue("Штрихкод");
            reportRow.CreateCell(1).SetCellValue("Количество");
            reportRow.CreateCell(2).SetCellValue("СтоимостьПриобр");
            reportRow.CreateCell(3).SetCellValue("СтоимостьРеализ");
            reportRow.CreateCell(4).SetCellValue("СтоимостьВЦенахПроизв");
            reportRow.CreateCell(5).SetCellValue("ПредельнаяЦенаПроизв");
            reportRow.CreateCell(6).SetCellValue("КоличествоПлан");
            reportRow.CreateCell(7).SetCellValue("ВаловаяПрибыльПлан");

            var converter = new SlashNumber();

            for (var i = 0; i < rows.Count; i++)
            {
                reportRow = sheet.CreateRow(i + 1);
                var row = ((object[])rows[i]);
                for (var j = 0; j < row.Length; j++)
                {
                    if (j == 0)
                    {
                        reportRow.CreateCell(j).SetCellValue(row[j]?.ToString());
                        continue;
                    }
                    if (j > 1 && j < 5)
                    {
                        reportRow.CreateCell(j).SetCellValue(converter.Convert(Convert.ToDouble(row[j]), 5));
                        continue;
                    }
                    reportRow.CreateCell(j).SetCellValue(Convert.ToDouble(row[j]));
                }
            }
            using (var stream = File.Create(Result))
                book.Write(stream);
        }
Beispiel #23
0
        protected override UpdateResult Execute()
        {
            var updateResult = UpdateResult.OK;
            var user         = Session.Query <User>().First();

            Progress.OnNext(new Progress("Соединение", 100, 0));
            Client.BaseAddress = ConfigureHttp() ?? Client.BaseAddress;
            Progress.OnNext(new Progress("Отправка заказов", 0, 50));
            var orders = Session.Query <Order>().ReadyToSend(address).ToList();

            Log.InfoFormat("Попытка отправить заказы, всего заказов к отправке {0}", orders.Count);
            var specialMarkupProducts = SpecialMarkupCatalog.Load(Session.Connection);

            try {
                foreach (var order in orders)
                {
                    Log.InfoFormat("Попытка отправки заказа {0} по прайсу {1} ({2}) от {3} с кол-вом позиций {4}",
                                   order.Id, order.PriceName, order.Price.Id.PriceId, order.Price.PriceDate, order.Lines.Count);
                    order.Lines.Each(x => x.CalculateRetailCost(Settings.Markups, specialMarkupProducts, user));
                }
            }
            catch (Exception e) {
                Log.Error("Ошибка протоколирования", e);
            }
            var clientOrders = orders.Select(o => o.ToClientOrder(Session)).Where(o => o != null).ToArray();

            if (clientOrders.Length == 0)
            {
                throw new EndUserError("Не заказов для отправки");
            }

            uint requestId = 0;
            var  response  = Wait("Orders",
                                  Client.PostAsync("Orders", new SyncRequest(clientOrders, Force), Formatter, Token), ref requestId);

            var results = response.Content.ReadAsAsync <OrderResult[]>().Result
                          ?? new OrderResult[0];

            CheckResult(Client.PutAsJsonAsync("Orders", new ConfirmRequest(requestId), Token));
            Log.InfoFormat("Заказы отправлены успешно");

            orders.Each(o => o.Apply(results.FirstOrDefault(r => r.ClientOrderId == o.Id)));
            var acceptedOrders = orders.Where(o => o.IsAccepted).ToArray();
            var rejectedOrders = orders.Where(o => !o.IsAccepted).ToArray();
            var sentOrders     = acceptedOrders.Select(o => new SentOrder(o)).ToArray();

            acceptedOrders.Where(o => o.Limit != null).Each(o => o.Limit.Value -= o.Sum);
            foreach (var order in orders)
            {
                if (order.IsAccepted)
                {
                    Log.InfoFormat("Заказ {0} успешно отправлен, Id заказа на сервере: {1}", order.Id, order.ServerId);
                }
                else
                {
                    Log.InfoFormat("Заказ {0} отвергнут сервером, причина: {1}", order.Id, order.SendError);
                }
            }

            Session.SaveEach(sentOrders);
            Session.DeleteEach(acceptedOrders);

            Progress.OnNext(new Progress("Отправка заказов", 100, 100));

            if (rejectedOrders.Any())
            {
                //если мы получили заказ без номера заказа с сервера значит он не принят
                //тк включена опция предзаказа и есть проблемы с другими заказами
                //если сервер уже знает что опция включена а клиент еще нет
                if (!user.IsPreprocessOrders)
                {
                    user.IsPreprocessOrders = rejectedOrders
                                              .SelectMany(r => r.Lines)
                                              .Any(l => l.SendResult != LineResultStatus.OK) ||
                                              rejectedOrders.Any(o => o.SendResult == OrderResultStatus.OK && o.ServerId == 0);
                }

                if (!user.IsPreprocessOrders)
                {
                    var resultText = rejectedOrders.Implode(
                        o => $"прайс-лист {o.Price.Name} - {o.SendError}",
                        Environment.NewLine);
                    var text = new TextViewModel(resultText)
                    {
                        Header      = "Данные заказы НЕ ОТПРАВЛЕНЫ",
                        DisplayName = "Не отправленные заказы"
                    };
                    Results.Add(new DialogResult(text));
                }
                else
                {
                    Results.Add(new DialogResult(new Correction(address.Id), fullScreen: true));
                }
                updateResult = UpdateResult.NotReload;
            }
            if (sentOrders.Length > 0)
            {
                if (Settings.PrintOrdersAfterSend)
                {
                    Results.Add(new PrintResult("Отправленные заказы", sentOrders.Select(o => {
                        var lines = o.Lines.ToList();
                        if (SortComparer != null)
                        {
                            lines.Sort(SortComparer);
                        }
                        return(new OrderDocument(o, lines.ToArray()));
                    })));
                }
                if (user.SaveOrders)
                {
                    try {
                        var dir = Settings.InitAndMap("Orders");
                        foreach (var sentOrder in sentOrders)
                        {
                            var name = Path.Combine(dir, sentOrder.ServerId + ".txt");
                            using (var writer = new StreamWriter(name, false, Encoding.Default)) {
                                writer.WriteLine("Номер;Аптека;Дата;Код;Товар;ЗаводШК;Производитель;Количество;Приоритет;Цена;Поставщик");
                                foreach (var line in sentOrder.Lines)
                                {
                                    var payload   = new string[0];
                                    var orderLine = orders.SelectMany(o => o.Lines).FirstOrDefault(l => l.ExportId == line.ServerId);
                                    if (orderLine != null && orderLine.ExportBatchLineId != null)
                                    {
                                        var batchline = StatelessSession.Query <BatchLine>()
                                                        .FirstOrDefault(b => b.ExportId == orderLine.ExportBatchLineId.Value);
                                        if (batchline != null)
                                        {
                                            payload = (batchline.ParsedServiceFields.GetValueOrDefault("ReportData") ?? "").Split(';');
                                        }
                                    }

                                    writer.WriteLine("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10}",
                                                     GetIndexOrDefault(payload, 0),
                                                     GetIndexOrDefault(payload, 1),
                                                     sentOrder.SentOn,
                                                     GetIndexOrDefault(payload, 3),
                                                     line.ProductSynonym,
                                                     GetIndexOrDefault(payload, 5),
                                                     line.ProducerSynonym,
                                                     line.Count,
                                                     GetIndexOrDefault(payload, 9),
                                                     GetIndexOrDefault(payload, 10),
                                                     line.Order.Price.Name);
                                }
                            }
                        }
                    }
                    catch (Exception e) {
#if DEBUG
                        throw;
#else
                        Log.Error("Ошибка при сохранении заявок", e);
#endif
                    }
                }
            }

            return(updateResult);
        }
Beispiel #24
0
 public IQueryable <T> QueryManyStateless(Expression <System.Func <T, bool> > expression)
 {
     return(StatelessSession.Query <T>().Where(expression).AsQueryable());
 }