Пример #1
0
        public List <OrderMaster> GetOrders(List <long> ids)
        {
            SpCall spCall = new SpCall("DAT.ORDER_MASTER_SELECT_MULTI_BY_ID");

            spCall.SetStructured <long>("@ID_LIST", "COR.ID_LIST", "ID", ids);

            DataSet ds = db.ExecuteDataSet(spCall);

            if (ds.Tables[0].Rows.Count == 0)
            {
                throw new Exception("No orders could be found not found");
            }

            List <OrderMaster> result = new List <OrderMaster>();

            ds.Tables[0].AsEnumerable().ToList().ForEach(row =>
            {
                long orderId            = row.Field <long>("ID");
                OrderMaster orderMaster = ReadOrderMaster(row);
                orderMaster.OrderItems  = ReadOrderItems(ds.Tables[1].AsEnumerable().Where(r => r.Field <long>("ORDER_ID") == orderId).ToList());
                orderMaster.InvoiceLog  = ReadInvoice(ds.Tables[2].AsEnumerable().First(r => r.Field <long>("ORDER_ID") == orderId));
                result.Add(orderMaster);
            });

            return(result);
        }
Пример #2
0
        public void UpdateOrderStatus(List <long> ids, string status)
        {
            SpCall spCall = new SpCall("DAT.ORDER_MASTER_UPDATE_STATUS");

            spCall.SetStructured <long>("@ID_LIST", "COR.ID_LIST", "ID", ids);
            spCall.SetVarchar("@ORDER_STATUS", status);
            db.ExecuteNonQuery(spCall);
        }
        public long CreateIntegrationBatch(List <long> orderIds)
        {
            SpCall spCall = new SpCall("DAT.QB_BATCH_INTEGRATION_INSERT");

            spCall.SetStructured <long>("@ID_LIST", "COR.ID_LIST", "ID", orderIds);
            spCall.SetDateTime("@CREATE_DATE", DateTime.Now);
            spCall.SetVarchar("@CREATE_USER", context.UserName);

            long result = db.ExecuteScalar <long>(spCall);

            return(result);
        }
        public List <QuickBooksInvoiceLog> List(List <long> idList)
        {
            List <QuickBooksInvoiceLog> result = new List <QuickBooksInvoiceLog>();

            SpCall spCall = new SpCall("DAT.QB_INVOICE_LOG_SELECT_MULTI_BY_ID");

            spCall.SetStructured <long>("@ID_LIST", "COR.ID_LIST", "ID", idList);

            DataSet ds = db.ExecuteDataSet(spCall);

            ds.Tables[0].AsEnumerable().ToList().ForEach(logRow => { result.Add(InitLog(logRow)); });

            return(result);
        }