protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } if (!Page.IsPostBack) { OrderCollection orderCollection = NopContext.Current.User.Orders; if (orderCollection.Count == 0) { Response.Redirect("~/Default.aspx"); } Order lastOrder = orderCollection[0]; lblOrderNumber.Text = lastOrder.OrderID.ToString(); hlOrderDetails.NavigateUrl = string.Format("{0}OrderDetails.aspx?OrderID={1}", CommonHelper.GetStoreLocation(), lastOrder.OrderID); var shoppingCart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); foreach (ShoppingCartItem sc in shoppingCart) { ShoppingCartManager.DeleteShoppingCartItem(sc.ShoppingCartItemID, false); } var indOrders = IndividualOrderManager.GetCurrentUserIndividualOrders(); foreach (BusinessLogic.Orders.IndividualOrder indOrder in indOrders) { IndividualOrderManager.DeleteIndividualOrder(indOrder.IndividualOrderID); } } }
public void FromClause() { OrderCollection collection = new OrderCollection(); collection.es.Connection.Name = "ForeignKeyTest"; switch (collection.es.Connection.ProviderSignature.DataProviderName) { //case "EntitySpaces.SqlServerCeProvider": // Assert.Ignore("Not supported."); // break; default: OrderQuery oq = new OrderQuery("o"); OrderItemQuery oiq = new OrderItemQuery("oi"); // The inner Select contains an aggregate, // which requires a GroupBy for each non-aggregate in the Select. // The outer Select includes the aggregate from the inner Select, // plus columns where no GroupBy was desired. oq.Select(oq.CustID, oq.OrderDate, oiq.UnitPrice); oq.From ( oiq.Select(oiq.OrderID, oiq.UnitPrice.Sum()).GroupBy(oiq.OrderID) ).As("sub"); oq.InnerJoin(oq).On(oq.OrderID == oiq.OrderID); oq.OrderBy(oq.OrderID.Ascending); Assert.IsTrue(collection.Load(oq)); Assert.AreEqual(5, collection.Count); Decimal up = Convert.ToDecimal(collection[0].GetColumn("UnitPrice")); Assert.AreEqual(5.11m, Math.Round(up, 2)); break; } }
private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { // Query database for all orders with a weight between 0 and 50. _orders = Extension.Data.GetOrderList.Where(new Filter.Range(Schema.OrderColumn.Weight, 0, 50)); StreamWriter streamWriter = new StreamWriter(_fileName); // Add column headers. streamWriter.Write("\"Tracking Number\",\"Description\",\"Length\",\"Width\",\"Height\",\"Weight\",\"Declared Value\"\n"); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); // Add order data. foreach (Order order in _orders) { if (BackgroundWorker.CancellationPending) { e.Cancel = true; break; } streamWriter.Write("\"" + order.TrackingNumber + "\",\"" + order.Description + "\",\"" + order.Length + "\",\"" + order.Width + "\",\"" + order.Height + "\",\"" + order.Weight + "\",\"" + order.DeclaredValue + "\"\n"); BackgroundWorker.ReportProgress(Convert.ToInt32((Convert.ToDouble(_counter) / Convert.ToDouble(_orders.Count)) * 100)); _counter += 1; _time += stopWatch.ElapsedMilliseconds; stopWatch.Restart(); } streamWriter.Close(); streamWriter.Dispose(); }
private void invokeOrdersByNextDateButton_Click(object sender, EventArgs e) { _orderCollection = MarketplaceWebServiceOrdersDataAccess.InvokeListOrdersDetailByNextDate(_serviceCliamDefinition); if (_orderCollection.Errors.Count > 0) { foreach (Exception ex in _orderCollection.Errors) { if (ex.Message.Contains("You do not have Last Invoke Date Time Value")) { SetLastInvokeDateTimeView setLastInvokeDateTimeView = new SetLastInvokeDateTimeView(_serviceCliamDefinition); setLastInvokeDateTimeView.ShowDialog(); } } return; } foreach (Order order in _orderCollection) { xmlTextBox.Text += " \n" + order.OrderId + " " + order.Email + " " + order.Item.ASIN + " " + order.Item.Title + " " + order.Name; ordersDataGridView.Rows.Add(order.OrderId, order.Name, order.Email, order.Item.ASIN, order.Item.Title); } sendEmailsButton.Enabled = true; OrdersDataRecordAccess.saveOrderCollection(_serviceCliamDefinition, _orderCollection); MessageBox.Show("OK!"); }
internal static void OrderProc(IDataReader dr, FieldDictionary Fields, object Param) { OrderCollection coll = Param as OrderCollection; Order item = Mapper.ReadOrder(dr, Fields); coll.Add(item); }
public override void HandleRequest(HttpRequest request, HttpResponse response) { DataModel.DataModel.Initialize(); const string nameForFile = "OrderList"; response.Buffer = true; //make sure that the entire output is rendered simultaneously response.ContentType = "text/xml"; response.AddHeader("Content-Disposition", "attachment;filename=" + nameForFile + ".xml"); if (IsUserAuthenticated) { UserInfo userInfo = DnnUserInfo; if (userInfo != null && (userInfo.IsSuperUser || userInfo.IsInRole(DnnPortalSettings.AdministratorRoleName))) { int?storeId = WA.Parser.ToInt(request.Params["storeId"]); if (storeId.HasValue) { List <Order> orders = OrderCollection.GetAllOrders(storeId); response.Write(XmlHelper.ToXml(orders)); } } } response.Flush(); }
public void SelectStatement() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); OrderQuery orders = new OrderQuery("o"); OrderItemQuery details = new OrderItemQuery("oi"); // A SubQuery in the Select clause must return a single value. switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SqlServerCeProvider": case "EntitySpaces.SqlServerCe4Provider": Assert.Ignore("Not supported."); break; default: orders.Select ( orders.OrderID, orders.OrderDate, details.Select( details.UnitPrice.Max()) .Where(orders.OrderID == details.OrderID).As("MaxUnitPrice") ); orders.OrderBy(orders.OrderID.Ascending); break; } Assert.IsTrue(collection.Load(orders)); Assert.AreEqual(8, collection.Count); Assert.AreEqual(3m, collection[0].GetColumn("MaxUnitPrice")); }
public void UnloadCollectionEndPoint_WithoutReferences_AfterSettingDifferentCollection_AndRollback_CausesEndPointToBeRemoved_ButKeepsDomainObjectCollectionInMemory() { SetDatabaseModifyable(); var customer = DomainObjectIDs.Customer2.GetObject <Customer> (); var oldCustomerOrders = customer.Orders; Assert.That(customer.Orders, Is.Empty); var newCustomerOrders = new OrderCollection(); customer.Orders = newCustomerOrders; Assert.That(customer.Orders, Is.Empty); TestableClientTransaction.Rollback(); var virtualEndPointID = RelationEndPointID.Resolve(customer, c => c.Orders); Assert.That(_dataManager.GetRelationEndPointWithoutLoading(virtualEndPointID), Is.Not.Null); Assert.That(_dataManager.GetRelationEndPointWithoutLoading(virtualEndPointID).IsDataComplete, Is.True); UnloadService.UnloadVirtualEndPoint(TestableClientTransaction, virtualEndPointID); Assert.That(_dataManager.GetRelationEndPointWithoutLoading(virtualEndPointID), Is.Null); // But DomainObjectCollection stays valid - and uses original collection Assert.That(oldCustomerOrders, Is.SameAs(customer.Orders)); }
public static OrderCollection InvokeListOrdersDetailByDateTime(ServiceCliamDefinition serviceCliamDefinition, DateTime createdAfterDateTime, DateTime createdBeforeDateTime) { if (serviceCliamDefinition == null) { return(new OrderCollection()); } OrderCollection orderCollection = new OrderCollection(); XmlDocument xOrderList = getListOrdersByDateTimeXmlData(serviceCliamDefinition, createdAfterDateTime, createdBeforeDateTime); XmlNodeList orderList = xOrderList.GetElementsByTagName("Order"); foreach (XmlNode order in orderList) { DataExchangeService.Order orderDetail = new DataExchangeService.Order(); foreach (XmlNode informationType in order) { GetBasicOrderInformation(informationType, orderDetail); } if (orderDetail.Email != null && !orderDetail.Email.Equals(String.Empty)) { GetDetailOrderInformation(serviceCliamDefinition, orderDetail); if (orderDetail != null) { orderCollection.Add(orderDetail); } } } return(orderCollection); }
public void SelectAllPlusSubQuery() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); OrderQuery orders = new OrderQuery("o"); OrderItemQuery details = new OrderItemQuery("oi"); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SqlServerCeProvider": case "EntitySpaces.SqlServerCe4Provider": Assert.Ignore("Not supported."); break; default: orders .Select(orders, details.Select(details.UnitPrice.Max()) .Where(orders.OrderID == details.OrderID).As("MaxUnitPrice")) .OrderBy(orders.OrderID.Ascending); break; } Assert.IsTrue(collection.Load(orders)); Assert.AreEqual(8, collection.Count); Assert.AreEqual(3m, collection[0].GetColumn("MaxUnitPrice")); string lq = collection.Query.es.LastQuery; string all = lq.Substring(7, 3); Assert.AreEqual("o.*", all); }
public void Nested() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); OrderQuery oq = new OrderQuery("o"); CustomerQuery cq = new CustomerQuery("c"); EmployeeQuery eq = new EmployeeQuery("e"); // OrderID and CustID for customers who ordered on the same date // a customer was added, and have a manager whose // last name starts with 'S'. oq.Select( oq.OrderID, oq.CustID ); oq.Where(oq.OrderDate .In( cq.Select(cq.DateAdded) .Where(cq.Manager.In( eq.Select(eq.EmployeeID) .Where(eq.LastName.Like("S%")) ) ) ) ); Assert.IsTrue(collection.Load(oq)); Assert.AreEqual(2, collection.Count); }
public void CreateSetCollectionCommand() { var fakeCollectionData = new DomainObjectCollectionData(); _dataManagerMock.Stub(stub => stub.CollectionData).Return(fakeCollectionData); _dataManagerMock.Stub(stub => stub.OriginalItemsWithoutEndPoints).Return(new DomainObject[0]); var fakeCollection = new DomainObjectCollection(); _collectionEndPointMock.Stub(mock => mock.IsNull).Return(false); _collectionEndPointMock.Stub(mock => mock.Collection).Return(fakeCollection); _collectionEndPointMock.Stub(mock => mock.GetDomainObject()).Return(_owningObject); _collectionEndPointMock.Replay(); var newCollection = new OrderCollection(); var command = (RelationEndPointModificationCommand)_loadState.CreateSetCollectionCommand(_collectionEndPointMock, newCollection, _collectionManagerStub); Assert.That(command, Is.TypeOf(typeof(CollectionEndPointSetCollectionCommand))); Assert.That(command.ModifiedEndPoint, Is.SameAs(_collectionEndPointMock)); Assert.That(command.TransactionEventSink, Is.SameAs(_transactionEventSinkStub)); Assert.That(((CollectionEndPointSetCollectionCommand)command).NewCollection, Is.SameAs(newCollection)); Assert.That(((CollectionEndPointSetCollectionCommand)command).CollectionEndPointCollectionManager, Is.SameAs(_collectionManagerStub)); Assert.That(((CollectionEndPointSetCollectionCommand)command).ModifiedCollectionData, Is.SameAs(fakeCollectionData)); }
private OrderCollection LoadAll() { OrderCollection Orders = _Dal.GetAllOrders(); foreach (Order order in Orders) { CustomerCollection customers = _Dal.GetCustomerByCustomerId(order.CustomerID); if (customers.Count > 0) { order.Customer = customers[0]; } OrderDetailCollection details = _Dal.GetOrderDetailsByOrderId(order.OrderID); foreach (OrderDetail detail in details) { order.OrderDetails.Add(detail); ProductCollection products = _Dal.GetProductByProductId(detail.ProductID); if (products.Count > 0) { detail.Product = products[0]; } } } return(Orders); }
public void AllSubQuery() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SQLiteProvider": Assert.Ignore("Not supported by SQLite."); break; default: // DateAdded for Customers whose Manager = 3 CustomerQuery cq = new CustomerQuery("c"); cq.es.All = true; cq.Select(cq.DateAdded); cq.Where(cq.Manager == 3); // OrderID and CustID where the OrderDate is // less than all of the dates in the CustomerQuery above. OrderQuery oq = new OrderQuery("o"); oq.Select( oq.OrderID, oq.CustID ); oq.Where(oq.OrderDate < cq); Assert.IsTrue(collection.Load(oq)); Assert.AreEqual(8, collection.Count); break; } }
public ActionResult History(int days) { OrderCollection orders = null; XmlReader xmlReader; XmlSerializer serializer = new XmlSerializer(typeof(OrderCollection)); xmlReader = new XmlTextReader(Server.MapPath("~/Files/orders.xml")); String URLString = "https://jetdevserver2.cloudapp.net/StoreISI/sklepAPI/Orders?token=" + userToken + "&unpaid=false"; if (days != 0) { string end = String.Format("{0:ddMMyyyy}", DateTime.Today); string start = String.Format("{0:ddMMyyyy}", DateTime.Today.AddDays(-days)); URLString += "&startDate=" + start + "&endDate=" + end; } if (GETRequest(URLString) != null) { xmlReader = new XmlNodeReader(GETRequest(URLString)); } orders = (OrderCollection)serializer.Deserialize(xmlReader); xmlReader.Close(); return(View(orders)); }
public override void SetUp() { base.SetUp(); _customerEndPointID = RelationEndPointID.Create(DomainObjectIDs.Customer1, "Remotion.Data.DomainObjects.UnitTests.TestDomain.Customer.Orders"); _order1 = DomainObjectIDs.Order1.GetObject <Order> (); _order3 = DomainObjectIDs.Order3.GetObject <Order> (); _fakeCollection = new OrderCollection(); _collectionManagerMock = MockRepository.GenerateStrictMock <ICollectionEndPointCollectionManager> (); _lazyLoaderMock = MockRepository.GenerateMock <ILazyLoader> (); _endPointProviderStub = MockRepository.GenerateStub <IRelationEndPointProvider> (); _transactionEventSinkStub = MockRepository.GenerateStub <IClientTransactionEventSink> (); _dataManagerFactoryStub = MockRepository.GenerateStub <ICollectionEndPointDataManagerFactory> (); _loadStateMock = MockRepository.GenerateStrictMock <ICollectionEndPointLoadState> (); _endPoint = new CollectionEndPoint( TestableClientTransaction, _customerEndPointID, _collectionManagerMock, _lazyLoaderMock, _endPointProviderStub, _transactionEventSinkStub, _dataManagerFactoryStub); PrivateInvoke.SetNonPublicField(_endPoint, "_loadState", _loadStateMock); _endPointProviderStub.Stub(stub => stub.GetOrCreateVirtualEndPoint(_customerEndPointID)).Return(_endPoint); _relatedEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint> (); }
private void Populate() { OrderPaging paging = new OrderPaging( this.PagingControl1.PageIndex, this.PagingControl1.RecordsPerPage, Order.FieldNameConstants.OrderId, true); OrderCollection orderCollection = null; if (this.Request["customerid"] != null) { orderCollection = OrderCollection.RunSelect(x => x.CustomerId == this.Request["customerid"], paging); lblHeader.Text = "This is a list of all orders for customer '" + this.Request["customerid"] + "'."; } else { orderCollection = OrderCollection.RunSelect(x => true, paging); lblHeader.Text = "This is a list of all orders."; } this.PagingControl1.ItemCount = paging.RecordCount; grdItem.DataSource = orderCollection; grdItem.DataBind(); SessionHelper.LastOrderListSearch = this.Request.Url.AbsoluteUri; }
public void ReplaceCollectionProperty_Cascade_Rollback() { using (TestableClientTransaction.CreateSubTransaction().EnterDiscardingScope()) { var customer1 = DomainObjectIDs.Customer1.GetObject <Customer> (); // Order1, Order2 var customer3 = DomainObjectIDs.Customer3.GetObject <Customer> (); // Order3 var newCollection = new OrderCollection { DomainObjectIDs.Order5.GetObject <Order> () }; var oldCollectionReferenceOfCustomer1 = customer1.Orders; var oldCollectionContentOfCustomer1 = customer1.Orders.ToArray(); var oldCollectionReferenceOfCustomer3 = customer3.Orders; var oldCollectionContentOfCustomer3 = customer3.Orders.ToArray(); customer1.Orders = newCollection; customer3.Orders = oldCollectionReferenceOfCustomer1; Assert.That(oldCollectionReferenceOfCustomer3.AssociatedEndPointID, Is.Null); ClientTransaction.Current.Rollback(); Assert.That(customer1.Orders, Is.SameAs(oldCollectionReferenceOfCustomer1)); Assert.That(customer1.Orders, Is.EqualTo(oldCollectionContentOfCustomer1)); Assert.That(customer3.Orders, Is.SameAs(oldCollectionReferenceOfCustomer3)); Assert.That(customer3.Orders, Is.EqualTo(oldCollectionContentOfCustomer3)); Assert.That(customer1.Orders.AssociatedEndPointID.ObjectID, Is.EqualTo(customer1.ID)); Assert.That(customer3.Orders.AssociatedEndPointID.ObjectID, Is.EqualTo(customer3.ID)); Assert.That(newCollection.AssociatedEndPointID, Is.Null); } }
private void ProcessOrders(OrderCollection ordersToSync) { Logger.Log(string.Format("The list of order to run: {0}", string.Join(",", ordersToSync))); foreach (Order order in ordersToSync) { string currentOrderId = order.Id; try { // update custom field (if wanted) if (UpdateCustomField) { var fieldA = order.OrderFieldValues.First(of => of.OrderField.SystemName == FieldA); var fieldB = order.OrderFieldValues.First(of => of.OrderField.SystemName == FieldB); fieldA.Value = fieldB.Value; } // update order state if (!string.IsNullOrWhiteSpace(NewState)) { // check if it's needed to force the change state if (order.StateId == NewState && ForceStateUpdate) { order.StateId = ""; } order.StateId = NewState; } // save changes to fire notifications order.Save(); // send new notification from batch parameters SendNotification(order); Logger.Log(string.Format("Order ID {0} done!", currentOrderId)); } catch (Exception ex) { _processError += string.Format("Error in Update. Order ID = {0}, Exception = {1}", currentOrderId, ex.ToString()); Logger.Log(string.Format("Error in Update. Order ID = {0}, Exception = {1}", currentOrderId, ex.ToString())); } finally { // save capture changes and try to update ERP if (Configuration.Global.IntegrationEnabledFor(order.ShopId)) { bool?result = OrderHandler.UpdateOrder(order, LiveIntegrationSubmitType.ScheduledTask); if (result.HasValue && !result.Value) { _processError += string.Format("Order ID {0} Successfully updated but not updated to the ERP.\n" , currentOrderId); } } } } Logger.Log("All orders done!"); }
public void SimpleJoinOn() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.MSAccessProvider": Assert.Ignore("SubQuery inside an ON clause not Supported"); break; default: // Query for the Join OrderItemQuery oiq = new OrderItemQuery("oi"); // SubQuery of OrderItems with a discount OrderItemQuery oisq = new OrderItemQuery("ois"); oisq.es.Distinct = true; oisq.Select(oisq.Discount); oisq.Where(oisq.Discount > 0); // Orders with discounted items OrderQuery oq = new OrderQuery("o"); oq.Select(oq.OrderID, oiq.Discount); oq.InnerJoin(oiq).On(oq.OrderID == oiq.OrderID & oiq.Discount.In(oisq)); Assert.IsTrue(collection.Load(oq)); Assert.AreEqual(2, collection.Count); break; } }
public OrderCollection FetchAll() { OrderCollection coll = new OrderCollection(); Query qry = new Query(Order.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
/// <summary> /// Main method in ScheduledTask Addin - is run when scheduled Task is run /// </summary> /// <returns></returns> public override bool Run() { SetupLogging(); bool result = false; string error = string.Empty; try { string sql = string.Format( @"SELECT top {2} * FROM EcomOrders WHERE OrderComplete = 1 AND OrderDeleted = 0 AND (OrderIntegrationOrderID IS NULL OR OrderIntegrationOrderID = '') And Isnull (OrderIsExported, 0) = 0 And OrderShopID = {0} And IsNull (OrderIsRecurringOrderTemplate, 0) = {3} AND OrderCompletedDate < DATEADD(MINUTE, -{1}, GETDATE()) and OrderStateID {4};" , string.IsNullOrEmpty(ShopId) ? "OrderShopID" : "'" + ShopId + "'", MinutesCompleted, MaxOrdersToProcess // recurrent order filter , ExcludeRecurrent ? "0" : "IsNull (OrderIsRecurringOrderTemplate, 0)" // order states filter , string.IsNullOrEmpty(OrderStates) ? " = OrderStateID" : "in ('" + OrderStates.Replace(",", "','") + "')"); OrderCollection ordersToSync = Order.GetOrders(sql, true); foreach (var order in ordersToSync) { if (Global.IntegrationEnabledFor(order.ShopId)) { OrderHandler.UpdateOrder(order, LiveIntegrationSubmitType.ScheduledTask); } } result = true; } catch (Exception e) { error = e.Message; } finally { if (error != "") { //Sendmail with error SendMail(error, MessageType.Error); } else { //Send mail with success SendMail(Translate.Translate("Scheduled task completed successfully")); } } WriteTaskResultToLog(result); return(result); }
public void Clone_ReadOnly_DataStrategy() { OrderCollection associatedCollection = CreateAssociatedCollectionWithEndPointStub(); var clonedCollection = associatedCollection.Clone(true); // clone is always stand-alone, even when source is associated with end point DomainObjectCollectionDataTestHelper.CheckReadOnlyCollectionStrategy(clonedCollection); }
public void Clone_BecomesStandAlone() { OrderCollection associatedCollection = CreateAssociatedCollectionWithEndPointStub(); var clonedCollection = (DomainObjectCollection)associatedCollection.Clone(); // clone is always stand-alone, even when source is associated with end point DomainObjectCollectionDataTestHelper.CheckStandAloneCollectionStrategy(clonedCollection, associatedCollection.RequiredItemType); }
public void CreateSetCollectionCommand_WithItemsWithoutEndPoints() { _dataManagerMock.Stub(stub => stub.OriginalItemsWithoutEndPoints).Return(new[] { _relatedObject }); var newCollection = new OrderCollection(); _loadState.CreateSetCollectionCommand(_collectionEndPointMock, newCollection, _collectionManagerStub); }
public void CreateSetCollectionCommand_WithUnsyncedOpposites() { AddUnsynchronizedOppositeEndPoint(_loadState, _relatedEndPointStub); var newCollection = new OrderCollection(); _loadState.CreateSetCollectionCommand(_collectionEndPointMock, newCollection, _collectionManagerStub); }
private void tsbLoad_Click(object sender, EventArgs e) { OrderCollection Orders = _Dal.GetAllOrders(); orderCollectionBindingSource.DataSource = Orders; tscbColumnFilter.ComboBox.DataSource = typeof(Order).GetProperties(); tscbColumnFilter.ComboBox.DisplayMember = "Name"; }
public static IQuery OrderBy <T>(this View view, Expression <Func <T, object> > expr, OrderType order = OrderType.Asc) { Query q = new Query(view, null); OrderCollection orderColl = new OrderCollection(); orderColl.AppendOrder(new Order(expr, order)); q.Order = orderColl; return(q); }
public void Clone_ReadOnly_IsOfSameType_AsOriginal() { var orderCollection = new OrderCollection(); var clone = (OrderCollection)orderCollection.Clone(true); Assert.That(clone.GetType(), Is.EqualTo(typeof(OrderCollection))); Assert.That(clone.RequiredItemType, Is.Null); }
private static string GetsaveOrderCollectionStatment(OrderCollection orderCollection) { string statment = "INSERT INTO Order_Master" + " (orderId, emailAddress, asin, customerName, amount, itemTitle, purchaseDate, sellerId, emailStatus)" + " VALUES" + " (@orderID, @emailAddress, @asin, @customerName, @amount, @itemTitle, @purchaseDate, @sellerId, @emailStatus)"; return(statment); }
void DisplayAddress() { OrderCollection orderCollection = new OrderCollection(); orderCollection.ThisOrder.find(OrderID); //display the data txtOrderNumber.Text = orderCollection.ThisOrder.OrderNumber(); txtOrderDate.Text = orderCollection.ThisOrder.OrderDate.ToString(); txtPaymentComplete.Checked = orderCollection.ThisOrder.PaymentComplete; }
public QueryTemplate(QueryType type) { _queryType = type; _insertValues = new InsertValueCollection(); _updateValues = new UpdateValueCollection(); _joinList = new JoinCollection(); _criteriaList = new CriteriaCollection(); _orderList = new OrderCollection(); }
public virtual StringBuilder BuildOrderSelectColumns(OrderCollection order, IEnumerable<SingleEntityView> svList) { _str = new StringBuilder(); foreach (var o in order) { _str.Append(_oev.GetOrderByClause(o.OrderExpression, svList)); _str.Append(_tr.ColumnDelimiter); } _str.RemoveEnd(_tr.ColumnDelimiter); return _str; }
public void CopyFromWithFilterTest() { OrderCollection orders = new OrderCollection(); orders.Add(PrepareOneOrderData("7412369", new TestUser() { ID = "625", Name = "金大胖" })); orders.Add(PrepareOneOrderData("9632147", new TestUser() { ID = "725", Name = "金二胖" })); OrderCollection filteredOrders = new OrderCollection(); filteredOrders.CopyFrom(orders, (o) => o.OrderNumber == "7412369"); Assert.AreEqual(1, filteredOrders.Count); Assert.IsTrue(filteredOrders.Exists((o) => o.OrderNumber == "7412369")); }
private static OrderCollection DBMapping(DBOrderCollection dbCollection) { if (dbCollection == null) return null; OrderCollection collection = new OrderCollection(); foreach (DBOrder dbItem in dbCollection) { Order item = DBMapping(dbItem); collection.Add(item); } return collection; }
internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress, LineItemCollection lineItemCollection, OrderCollection orders) { Mandate.ParameterNotNull(invoiceStatus, "invoiceStatus"); Mandate.ParameterNotNull(billToAddress, "billToAddress"); Mandate.ParameterNotNull(lineItemCollection, "lineItemCollection"); Mandate.ParameterNotNull(orders, "orders"); _invoiceStatus = invoiceStatus; _billToName = billToAddress.Name; _billToAddress1 = billToAddress.Address1; _billToAddress2 = billToAddress.Address2; _billToLocality = billToAddress.Locality; _billToRegion = billToAddress.Region; _billToPostalCode = billToAddress.PostalCode; _billToCountryCode = billToAddress.CountryCode; _billToPhone = billToAddress.Phone; _items = lineItemCollection; _orders = orders; _invoiceDate = DateTime.Now; }
public EntityQueryValues() { _criteriaList = new CriteriaCollection(); _orderList = new OrderCollection(); }
/// <summary> /// Export orders to XLS /// </summary> /// <param name="FilePath">File path to use</param> /// <param name="orders">Orders</param> public static void ExportOrdersToXLS(string FilePath, OrderCollection orders) { using (ExcelHelper excelHelper = new ExcelHelper(FilePath)) { excelHelper.HDR = "YES"; excelHelper.IMEX = "0"; Dictionary<string, string> tableDefinition = new Dictionary<string, string>(); tableDefinition.Add("OrderID", "int"); tableDefinition.Add("OrderGUID", "uniqueidentifier"); tableDefinition.Add("OrderSubtotalInclTax", "decimal"); tableDefinition.Add("OrderSubtotalExclTax", "decimal"); tableDefinition.Add("OrderShippingInclTax", "decimal"); tableDefinition.Add("OrderShippingExclTax", "decimal"); tableDefinition.Add("PaymentMethodAdditionalFeeInclTax", "decimal"); tableDefinition.Add("PaymentMethodAdditionalFeeExclTax", "decimal"); tableDefinition.Add("OrderTax", "decimal"); tableDefinition.Add("OrderTotal", "decimal"); tableDefinition.Add("OrderDiscount", "decimal"); tableDefinition.Add("OrderSubtotalInclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("OrderSubtotalExclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("OrderShippingInclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("OrderShippingExclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("PaymentMethodAdditionalFeeInclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("PaymentMethodAdditionalFeeExclTaxInCustomerCurrency", "decimal"); tableDefinition.Add("OrderTaxInCustomerCurrency", "decimal"); tableDefinition.Add("OrderTotalInCustomerCurrency", "decimal"); tableDefinition.Add("CustomerCurrencyCode", "nvarchar(5)"); tableDefinition.Add("OrderWeight", "decimal"); tableDefinition.Add("AffiliateID", "int"); tableDefinition.Add("OrderStatusID", "int"); tableDefinition.Add("PaymentMethodID", "int"); tableDefinition.Add("PaymentMethodName", "nvarchar(100)"); tableDefinition.Add("PurchaseOrderNumber", "nvarchar(100)"); tableDefinition.Add("PaymentStatusID", "int"); tableDefinition.Add("BillingFirstName", "nvarchar(100)"); tableDefinition.Add("BillingLastName", "nvarchar(100)"); tableDefinition.Add("BillingPhoneNumber", "nvarchar(50)"); tableDefinition.Add("BillingEmail", "nvarchar(255)"); tableDefinition.Add("BillingFaxNumber", "nvarchar(50)"); tableDefinition.Add("BillingCompany", "nvarchar(100)"); tableDefinition.Add("BillingAddress1", "nvarchar(100)"); tableDefinition.Add("BillingAddress2", "nvarchar(100)"); tableDefinition.Add("BillingCity", "nvarchar(100)"); tableDefinition.Add("BillingStateProvince", "nvarchar(100)"); tableDefinition.Add("BillingZipPostalCode", "nvarchar(100)"); tableDefinition.Add("BillingCountry", "nvarchar(100)"); tableDefinition.Add("ShippingStatusID", "int"); tableDefinition.Add("ShippingFirstName", "nvarchar(100)"); tableDefinition.Add("ShippingLastName", "nvarchar(100)"); tableDefinition.Add("ShippingPhoneNumber", "nvarchar(50)"); tableDefinition.Add("ShippingEmail", "nvarchar(255)"); tableDefinition.Add("ShippingFaxNumber", "nvarchar(50)"); tableDefinition.Add("ShippingCompany", "nvarchar(100)"); tableDefinition.Add("ShippingAddress1", "nvarchar(100)"); tableDefinition.Add("ShippingAddress2", "nvarchar(100)"); tableDefinition.Add("ShippingCity", "nvarchar(100)"); tableDefinition.Add("ShippingStateProvince", "nvarchar(100)"); tableDefinition.Add("ShippingZipPostalCode", "nvarchar(100)"); tableDefinition.Add("ShippingCountry", "nvarchar(100)"); tableDefinition.Add("ShippingMethod", "nvarchar(100)"); tableDefinition.Add("ShippingRateComputationMethodID", "int"); tableDefinition.Add("CreatedOn", "datetime"); excelHelper.WriteTable("Orders", tableDefinition); foreach (Order order in orders) { StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO [Orders] (OrderID, OrderGUID, OrderSubtotalInclTax, OrderSubtotalExclTax, OrderShippingInclTax, OrderShippingExclTax, PaymentMethodAdditionalFeeInclTax, PaymentMethodAdditionalFeeExclTax, OrderTax, OrderTotal, OrderDiscount, OrderSubtotalInclTaxInCustomerCurrency, OrderSubtotalExclTaxInCustomerCurrency, OrderShippingInclTaxInCustomerCurrency, OrderShippingExclTaxInCustomerCurrency, PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, PaymentMethodAdditionalFeeExclTaxInCustomerCurrency, OrderTaxInCustomerCurrency, OrderTotalInCustomerCurrency, CustomerCurrencyCode, OrderWeight, AffiliateID, OrderStatusID, PaymentMethodID, PaymentMethodName, PurchaseOrderNumber, PaymentStatusID, BillingFirstName, BillingLastName, BillingPhoneNumber, BillingEmail, BillingFaxNumber, BillingCompany, BillingAddress1, BillingAddress2, BillingCity, BillingStateProvince, BillingZipPostalCode, BillingCountry, ShippingStatusID, ShippingFirstName, ShippingLastName, ShippingPhoneNumber, ShippingEmail, ShippingFaxNumber, ShippingCompany, ShippingAddress1, ShippingAddress2, ShippingCity, ShippingStateProvince, ShippingZipPostalCode, ShippingCountry, ShippingMethod, ShippingRateComputationMethodID, CreatedOn) VALUES ("); sb.Append(order.OrderID); sb.Append(","); sb.Append('"'); sb.Append(order.OrderGUID); sb.Append("\","); sb.Append(order.OrderSubtotalInclTax); sb.Append(","); sb.Append(order.OrderSubtotalExclTax); sb.Append(","); sb.Append(order.OrderShippingInclTax); sb.Append(","); sb.Append(order.OrderShippingExclTax); sb.Append(","); sb.Append(order.PaymentMethodAdditionalFeeInclTax); sb.Append(","); sb.Append(order.PaymentMethodAdditionalFeeExclTax); sb.Append(","); sb.Append(order.OrderTax); sb.Append(","); sb.Append(order.OrderTotal); sb.Append(","); sb.Append(order.OrderDiscount); sb.Append(","); sb.Append(order.OrderSubtotalInclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.OrderSubtotalExclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.OrderShippingInclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.OrderShippingExclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency); sb.Append(","); sb.Append(order.OrderTaxInCustomerCurrency); sb.Append(","); sb.Append(order.OrderTotalInCustomerCurrency); sb.Append(","); sb.Append('"'); sb.Append(order.CustomerCurrencyCode.Replace('"', '\'')); sb.Append("\","); sb.Append(order.OrderWeight); sb.Append(","); sb.Append(order.AffiliateID); sb.Append(","); sb.Append(order.OrderStatusID); sb.Append(","); sb.Append(order.PaymentMethodID); sb.Append(","); sb.Append('"'); sb.Append(order.PaymentMethodName.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.PurchaseOrderNumber.Replace('"', '\'')); sb.Append("\","); sb.Append(order.PaymentStatusID); sb.Append(","); sb.Append('"'); sb.Append(order.BillingFirstName.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingLastName.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingPhoneNumber.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingEmail.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingFaxNumber.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingCompany.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingAddress1.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingAddress2.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingCity.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingStateProvince.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingZipPostalCode.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingCountry.Replace('"', '\'')); sb.Append("\","); sb.Append(order.ShippingStatusID); sb.Append(","); sb.Append('"'); sb.Append(order.ShippingFirstName.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingLastName.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingPhoneNumber.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingEmail.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingFaxNumber.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingCompany.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingAddress1.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingAddress2.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingCity.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingStateProvince.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingZipPostalCode.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.BillingCountry.Replace('"', '\'')); sb.Append("\","); sb.Append('"'); sb.Append(order.ShippingMethod.Replace('"', '\'')); sb.Append("\","); sb.Append(order.ShippingRateComputationMethodID); sb.Append(","); sb.Append('"'); sb.Append(order.CreatedOn); sb.Append("\""); sb.Append(")"); excelHelper.ExecuteCommand(sb.ToString()); } } }
/// <summary> /// Export order list to xml /// </summary> /// <param name="orders">Orders</param> /// <returns>Result in XML format</returns> public static string ExportOrdersToXML(OrderCollection orders) { StringBuilder sb = new StringBuilder(); StringWriter stringWriter = new StringWriter(sb); XmlWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("Orders"); xmlWriter.WriteAttributeString("Version", SiteHelper.GetCurrentVersion()); foreach (Order order in orders) { xmlWriter.WriteStartElement("Order"); xmlWriter.WriteElementString("OrderID", null, order.OrderID.ToString()); xmlWriter.WriteElementString("OrderGUID", null, order.OrderGUID.ToString()); xmlWriter.WriteElementString("CustomerID", null, order.CustomerID.ToString()); xmlWriter.WriteElementString("CustomerLanguageID", null, order.CustomerLanguageID.ToString()); xmlWriter.WriteElementString("CustomerTaxDisplayTypeID", null, order.CustomerTaxDisplayTypeID.ToString()); xmlWriter.WriteElementString("OrderSubtotalInclTax", null, order.OrderSubtotalInclTax.ToString()); xmlWriter.WriteElementString("OrderSubtotalExclTax", null, order.OrderSubtotalExclTax.ToString()); xmlWriter.WriteElementString("OrderShippingInclTax", null, order.OrderShippingInclTax.ToString()); xmlWriter.WriteElementString("OrderShippingExclTax", null, order.OrderShippingExclTax.ToString()); xmlWriter.WriteElementString("PaymentMethodAdditionalFeeInclTax", null, order.PaymentMethodAdditionalFeeInclTax.ToString()); xmlWriter.WriteElementString("PaymentMethodAdditionalFeeExclTax", null, order.PaymentMethodAdditionalFeeExclTax.ToString()); xmlWriter.WriteElementString("OrderTax", null, order.OrderTax.ToString()); xmlWriter.WriteElementString("OrderTotal", null, order.OrderTotal.ToString()); xmlWriter.WriteElementString("OrderDiscount", null, order.OrderDiscount.ToString()); xmlWriter.WriteElementString("OrderSubtotalInclTaxInCustomerCurrency", null, order.OrderSubtotalInclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("OrderSubtotalExclTaxInCustomerCurrency", null, order.OrderSubtotalExclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("OrderShippingInclTaxInCustomerCurrency", null, order.OrderShippingInclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("OrderShippingExclTaxInCustomerCurrency", null, order.OrderShippingExclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("PaymentMethodAdditionalFeeInclTaxInCustomerCurrency", null, order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("PaymentMethodAdditionalFeeExclTaxInCustomerCurrency", null, order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("OrderTaxInCustomerCurrency", null, order.OrderTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("OrderTotalInCustomerCurrency", null, order.OrderTotalInCustomerCurrency.ToString()); xmlWriter.WriteElementString("CustomerCurrencyCode", null, order.CustomerCurrencyCode); xmlWriter.WriteElementString("OrderWeight", null, order.OrderWeight.ToString()); xmlWriter.WriteElementString("AffiliateID", null, order.AffiliateID.ToString()); xmlWriter.WriteElementString("OrderStatusID", null, order.OrderStatusID.ToString()); xmlWriter.WriteElementString("AllowStoringCreditCardNumber", null, order.AllowStoringCreditCardNumber.ToString()); xmlWriter.WriteElementString("CardType", null, order.CardType); xmlWriter.WriteElementString("CardName", null, order.CardName); xmlWriter.WriteElementString("CardNumber", null, order.CardNumber); xmlWriter.WriteElementString("MaskedCreditCardNumber", null, order.MaskedCreditCardNumber); xmlWriter.WriteElementString("CardCVV2", null, order.CardCVV2); xmlWriter.WriteElementString("CardExpirationMonth", null, order.CardExpirationMonth); xmlWriter.WriteElementString("CardExpirationYear", null, order.CardExpirationYear); xmlWriter.WriteElementString("PaymentMethodID", null, order.PaymentMethodID.ToString()); xmlWriter.WriteElementString("PaymentMethodName", null, order.PaymentMethodName); xmlWriter.WriteElementString("AuthorizationTransactionID", null, order.AuthorizationTransactionID); xmlWriter.WriteElementString("AuthorizationTransactionCode", null, order.AuthorizationTransactionCode); xmlWriter.WriteElementString("AuthorizationTransactionResult", null, order.AuthorizationTransactionResult); xmlWriter.WriteElementString("CaptureTransactionID", null, order.CaptureTransactionID); xmlWriter.WriteElementString("CaptureTransactionResult", null, order.CaptureTransactionResult); xmlWriter.WriteElementString("PurchaseOrderNumber", null, order.PurchaseOrderNumber); xmlWriter.WriteElementString("PaymentStatusID", null, order.PaymentStatusID.ToString()); xmlWriter.WriteElementString("BillingFirstName", null, order.BillingFirstName); xmlWriter.WriteElementString("BillingLastName", null, order.BillingLastName); xmlWriter.WriteElementString("BillingPhoneNumber", null, order.BillingPhoneNumber); xmlWriter.WriteElementString("BillingEmail", null, order.BillingEmail); xmlWriter.WriteElementString("BillingFaxNumber", null, order.BillingFaxNumber); xmlWriter.WriteElementString("BillingCompany", null, order.BillingCompany); xmlWriter.WriteElementString("BillingAddress1", null, order.BillingAddress1); xmlWriter.WriteElementString("BillingAddress2", null, order.BillingAddress2); xmlWriter.WriteElementString("BillingCity", null, order.BillingCity); xmlWriter.WriteElementString("BillingStateProvince", null, order.BillingStateProvince); xmlWriter.WriteElementString("BillingStateProvinceID", null, order.BillingStateProvinceID.ToString()); xmlWriter.WriteElementString("BillingCountry", null, order.BillingCountry); xmlWriter.WriteElementString("BillingCountryID", null, order.BillingCountryID.ToString()); xmlWriter.WriteElementString("BillingZipPostalCode", null, order.BillingZipPostalCode); xmlWriter.WriteElementString("ShippingStatusID", null, order.ShippingStatusID.ToString()); xmlWriter.WriteElementString("ShippingFirstName", null, order.ShippingFirstName); xmlWriter.WriteElementString("ShippingLastName", null, order.ShippingLastName); xmlWriter.WriteElementString("ShippingPhoneNumber", null, order.ShippingPhoneNumber); xmlWriter.WriteElementString("ShippingEmail", null, order.ShippingEmail); xmlWriter.WriteElementString("ShippingFaxNumber", null, order.ShippingFaxNumber); xmlWriter.WriteElementString("ShippingCompany", null, order.ShippingCompany); xmlWriter.WriteElementString("ShippingAddress1", null, order.ShippingAddress1); xmlWriter.WriteElementString("ShippingAddress2", null, order.ShippingAddress2); xmlWriter.WriteElementString("ShippingCity", null, order.ShippingCity); xmlWriter.WriteElementString("ShippingStateProvince", null, order.ShippingStateProvince); xmlWriter.WriteElementString("ShippingStateProvinceID", null, order.ShippingStateProvinceID.ToString()); xmlWriter.WriteElementString("ShippingCountry", null, order.ShippingCountry); xmlWriter.WriteElementString("ShippingCountryID", null, order.ShippingCountryID.ToString()); xmlWriter.WriteElementString("ShippingZipPostalCode", null, order.ShippingZipPostalCode); xmlWriter.WriteElementString("ShippingMethod", null, order.ShippingMethod); xmlWriter.WriteElementString("ShippingRateComputationMethodID", null, order.ShippingRateComputationMethodID.ToString()); xmlWriter.WriteElementString("ShippedDate", null, (order.ShippedDate == null) ? string.Empty : order.ShippedDate.Value.ToString()); xmlWriter.WriteElementString("Deleted", null, order.Deleted.ToString()); xmlWriter.WriteElementString("CreatedOn", null, order.CreatedOn.ToString()); OrderProductVariantCollection orderProductVariants = order.OrderProductVariants; if (orderProductVariants.Count > 0) { xmlWriter.WriteStartElement("OrderProductVariants"); foreach (OrderProductVariant orderProductVariant in orderProductVariants) { xmlWriter.WriteStartElement("OrderProductVariant"); xmlWriter.WriteElementString("OrderProductVariantID", null, orderProductVariant.OrderProductVariantID.ToString()); xmlWriter.WriteElementString("ProductVariantID", null, orderProductVariant.ProductVariantID.ToString()); ProductVariant productVariant = orderProductVariant.ProductVariant; if (productVariant != null) xmlWriter.WriteElementString("ProductVariantName", null, productVariant.FullProductName); xmlWriter.WriteElementString("UnitPriceInclTax", null, orderProductVariant.UnitPriceInclTax.ToString()); xmlWriter.WriteElementString("UnitPriceExclTax", null, orderProductVariant.UnitPriceExclTax.ToString()); xmlWriter.WriteElementString("PriceInclTax", null, orderProductVariant.PriceInclTax.ToString()); xmlWriter.WriteElementString("PriceExclTax", null, orderProductVariant.PriceExclTax.ToString()); xmlWriter.WriteElementString("UnitPriceInclTaxInCustomerCurrency", null, orderProductVariant.UnitPriceInclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("UnitPriceExclTaxInCustomerCurrency", null, orderProductVariant.UnitPriceExclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("PriceInclTaxInCustomerCurrency", null, orderProductVariant.PriceInclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("PriceExclTaxInCustomerCurrency", null, orderProductVariant.PriceExclTaxInCustomerCurrency.ToString()); xmlWriter.WriteElementString("AttributeDescription", null, orderProductVariant.AttributeDescription); xmlWriter.WriteElementString("Quantity", null, orderProductVariant.Quantity.ToString()); xmlWriter.WriteElementString("DiscountAmountInclTax", null, orderProductVariant.DiscountAmountInclTax.ToString()); xmlWriter.WriteElementString("DiscountAmountExclTax", null, orderProductVariant.DiscountAmountExclTax.ToString()); xmlWriter.WriteElementString("DownloadCount", null, orderProductVariant.DownloadCount.ToString()); xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); xmlWriter.Close(); return stringWriter.ToString(); }
public string OrderSummary(OrderCollection orders) { HttpContext.Current.Session.Add("Orders", orders); return WebNavigator.Resolve("~/Orders.aspx"); }
/// <summary> /// Fetches the associated orders. /// </summary> /// <param name="orderId">The order id.</param> /// <returns></returns> public OrderCollection FetchAssociatedOrders(int orderId) { IDataReader reader = SPs.FetchAssociatedOrders(orderId).GetReader(); OrderCollection orderCollection = new OrderCollection(); orderCollection.LoadAndCloseReader(reader); orderCollection.Sort(Order.Columns.CreatedOn, true); return orderCollection; }
/// <summary> /// Fetches the orders for user. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns></returns> public OrderCollection FetchOrdersForUser(string userName) { IDataReader reader = new Query(Order.Schema). AddWhere(Order.Columns.UserName, Comparison.Equals, userName). AddWhere(Order.Columns.OrderStatusDescriptorId, Comparison.NotEquals, (int)OrderStatus.NotProcessed). ExecuteReader(); OrderCollection orderCollection = new OrderCollection(); orderCollection.LoadAndCloseReader(reader); return orderCollection; }
public void BindData_Bak() { #if debug SRLogHelper.Instance.AddLog("日志", DateTime.Now.ToString("mm:ss.ffff")); #endif #region 设置排序 OrderCollection<SRRC_ResourceEntity.FiledType> orderBy = new OrderCollection<SRRC_ResourceEntity.FiledType>(); //orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>(SRRC_ResourceEntity.FiledType.Extend3, OrderType.Desc));//视图优先排序 switch (SROperation.Instance.Orderby) { case 1: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Bjtime, OrderType = (OrderType)SROperation.Instance.OrderType }); } break; case 2: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Usecount, OrderType = (OrderType)SROperation.Instance.OrderType }); } break; case 3: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Addtime, OrderType = (OrderType)SROperation.Instance.OrderType }); } break; case 4: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Filesize, OrderType = (OrderType)SROperation.Instance.OrderType }); } break; case 5: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Name, OrderType = (OrderType)SROperation.Instance.OrderType }); } break; case 6: { orderBy.Add(new Order<SRRC_ResourceEntity.FiledType>() { ColumnName = SRRC_ResourceEntity.FiledType.Id, OrderType = OrderType.Desc }); } break; default: break; } #endregion #region 左侧菜单操作、中间区域(center1,center2) if (SROperation2.Instance.FocusPanel != "Right") { Int32 id = SROperation.Instance.LeftSelectedId; switch (SROperation.Instance.LeftDtype) { case "Resources": { if (!String.IsNullOrEmpty(SROperation.Instance.Keyword)) { string sql; if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { sql = "with ta as (select * from SRRC_Resource where id=" + id + @" union all select SRRC_Resource.* from ta,SRRC_Resource where ta.Id=SRRC_Resource.Pid) select * from ta,SRRC_Resourcebiaojirel as tb on ta.Id=tb.Resource_id where (tb.Biaoji_id in (" + Param.filterkeyword + ") or ta.Dtype=0) and (Name + '.' + Extend1) like '%" + SROperation.Instance.Keyword + "%' "; } else { sql = "with ta as (select * from SRRC_Resource where id=" + id + @" union all select SRRC_Resource.* from ta,SRRC_Resource where ta.Id=SRRC_Resource.Pid) select * from ta where (Name + '.' + Extend1) like '%" + SROperation.Instance.Keyword + "%' "; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriorityBySQL(sql, orderBy); } else { if (SROperation.Instance.LeftShowType == "Cross") { if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { strWhere = " Pid in (select Id from SRRC_Resource where Pid=[$Pid$]) and Dtype<>0 and Id in ( select Resource_id from SRRC_Resourcebiaojirel where Biaoji_id in (" + Param.filterkeyword + "))"; } else { strWhere = " Pid in (select Id from SRRC_Resource where Pid=[$Pid$]) and Dtype<>0"; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriority(orderBy, strWhere, new DataParameter("Pid", id)); if (entList == null || entList.Count == 0) //没有文件 { if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { strWhere = " Pid=[$Pid$] and (Id in (select Resource_id from SRRC_Resourcebiaojirel where Biaoji_id in (" + Param.filterkeyword + ")) or Dtype=0)"; } else { strWhere = " Pid=[$Pid$]"; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriority(orderBy, strWhere, new DataParameter("Pid", id)); } } else { if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { strWhere = " Pid=[$Pid$] and Id in ( select Resource_id from SRRC_Resourcebiaojirel where Biaoji_id in (" + Param.filterkeyword + "))"; } else { strWhere = " Pid=[$Pid$]"; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriority(orderBy, strWhere, new DataParameter("Pid", id)); } } } break; case "Study": { if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { strWhere = " Id in ( SELECT Resource_id FROM SRRC_Resourcebiaojirel where User_id=0 and Biaoji_id=[$Pid$] ) and Id in (select Resource_id FROM SRRC_Resourcebiaojirel where User_id=0 and Biaoji_id in (" + Param.filterkeyword + ")) "; } else { strWhere = " Id in ( SELECT Resource_id FROM SRRC_Resourcebiaojirel where User_id=0 and Biaoji_id=[$Pid$] )"; } if (String.IsNullOrEmpty(SROperation.Instance.Keyword) == false) { strWhere += " and (Name + '.' + Extend1) like '%" + SROperation.Instance.Keyword + "%' "; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriority(orderBy, strWhere, new DataParameter("Pid", id)); } break; case "Favorites": { if (SROperation.Instance.OnlyShow && Param.filterkeyword != "") { strWhere = " Id in ( SELECT Resource_id FROM SRRC_Resourcebiaojirel where User_id=" + Param.UserId + " and Biaoji_id=[$Pid$]) and Id in (select Resource_id FROM SRRC_Resourcebiaojirel where User_id=0 and Biaoji_id in (" + Param.filterkeyword + ")) "; } else { strWhere = " Id in ( SELECT Resource_id FROM SRRC_Resourcebiaojirel where User_id=" + Param.UserId + " and Biaoji_id=[$Pid$])"; } if (String.IsNullOrEmpty(SROperation.Instance.Keyword) == false) { strWhere += " and (Name + '.' + Extend1) like '%" + SROperation.Instance.Keyword + "%' "; } staticEntList = SROperation2.Instance.Center1EntList = entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionForViewPriority(orderBy, strWhere, new DataParameter("Pid", id)); } break; default: break; } // List<SRRC_ResourceEntity> entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollection(orderBy, strWhere, new DataParameter("Pid", id)); } #endregion #region Keyword面板操作 if (SROperation2.Instance.FocusPanel == "Right") { if (SROperation2.Instance.KeywordFilter == null || SROperation2.Instance.KeywordFilter.Length == 0)//无关键字 { SROperation2.Instance.Center1EntList = entList = staticEntList; } else //有关键字 { //and if (SROperation2.Instance.KeywordLogical == "and") { int count = SROperation2.Instance.KeywordFilter.Split(',').Length; entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionBySQL("select * from SRRC_Resource where id in (SELECT Resource_id FROM SRRC_Resourcebiaojirel WHERE Biaoji_id IN (" + SROperation2.Instance.KeywordFilter + ") GROUP BY Resource_id HAVING COUNT(*)=" + count + ")"); } //or if (SROperation2.Instance.KeywordLogical == "or") { entList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionBySQL("select * from SRRC_Resource where id in (SELECT Resource_id FROM SRRC_Resourcebiaojirel WHERE Biaoji_id IN (" + SROperation2.Instance.KeywordFilter + ") GROUP BY Resource_id)"); } if(entList == null) { SROperation2.Instance.Center1EntList = entList; } else { var temp = staticEntList.Intersect(entList, new SRRC_ResourceEntity_EntityComparer()); if (temp == null) { SROperation2.Instance.Center1EntList = entList = null; } else { SROperation2.Instance.Center1EntList = entList = temp.ToList(); } } } } #endregion SROperation2.Instance.entListCount = entList == null ? 0 : entList.Count; ImageLoadingTip = new bool[SROperation2.Instance.entListCount]; //this.SetData(); #if debug SRLogHelper.Instance.AddLog("日志", DateTime.Now.ToString("mm:ss.ffff")); #endif }
/// <summary> /// Binds the order collection. /// </summary> /// <param name="orderCollection">The order collection.</param> private void BindOrderCollection(OrderCollection orderCollection) { dgOrders.DataSource = orderCollection; dgOrders.ItemDataBound += new DataGridItemEventHandler(dgOrders_ItemDataBound); dgOrders.Columns[0].HeaderText = LocalizationUtility.GetText("hdrEdit"); dgOrders.Columns[1].HeaderText = LocalizationUtility.GetText("hdrOrderNumber"); dgOrders.Columns[2].HeaderText = LocalizationUtility.GetText("hdrStatus"); dgOrders.Columns[3].HeaderText = LocalizationUtility.GetText("hdrTotal"); dgOrders.Columns[4].HeaderText = LocalizationUtility.GetText("hdrLastModified"); dgOrders.DataBind(); }
public OrderCollection FetchByID(object OrderId) { OrderCollection coll = new OrderCollection().Where("OrderId", OrderId).Load(); return coll; }
public OrderCollection FetchByQuery(Query qry) { OrderCollection coll = new OrderCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }