private void DeleteOrder() { // Prepare the parameters //string where = "CustomerLastName LIKE N'My New Registered%'"; CustomerInfo customer = null; // Get the customer DataSet customers = CustomerInfoProvider.GetCustomers(null, null); if (!DataHelper.DataSourceIsEmpty(customers)) { // Create object from DataRow customer = new CustomerInfo(customers.Tables[0].Rows[0]); } if (customer != null) { // string whereOrder = "OrderCustomerID='" + customer.CustomerID + "'"; // Get the order DataSet orders = OrderInfoProvider.GetOrders(null, null); if (!DataHelper.DataSourceIsEmpty(orders)) { // Create object from DataRow // OrderInfo order = new OrderInfo(orders.Tables[0].Rows[0]); foreach (DataRow userDr in orders.Tables[0].Rows) { OrderInfo order = new OrderInfo(userDr); // Delete the order OrderInfoProvider.DeleteOrderInfo(order); } } } }
protected void btnProcessPayment_Click(object sender, EventArgs e) { if ((PaymentGatewayProvider != null) && (orderId > 0)) { OrderInfo order = OrderInfoProvider.GetOrders() .WhereEquals("OrderID", orderId) .FirstObject; CustomerInfo customer = CustomerInfoProvider.GetCustomers() .WhereEquals("CustomerID", order.OrderCustomerID) .FirstObject; //AddressInfo address = AddressInfoProvider.GetAddresses() // .WhereEquals("AddressCustomerID", order.OrderBillingAddress) // .FirstObject; try { ltrPayPalForm.Text = GeneratePayPalToken(order, customer); } catch (Exception ex) { Response.Write(ex.InnerException); } } }
/// <summary> /// Returns an enumerable collection of TopN orders of the given customer ordered by OrderDate descending. /// </summary> /// <param name="customerId">Customer's identifier.</param> /// <param name="count">Number of retrieved orders. Using 0 returns all records.</param> /// <returns>Collection of the customer's orders. See <see cref="OrderInfo"/> for detailed information.</returns> public IEnumerable <OrderInfo> GetByCustomerId(int customerId, int count = 0) { var orders = OrderInfoProvider.GetOrders(SiteID) .WhereEquals("OrderCustomerID", customerId) .TopN(count) .OrderByDescending(orderInfo => orderInfo.OrderDate) .ToList(); return(orders); }
/// <summary> /// Saving billing requires recalculation of order. Save action is executed by this custom code. /// </summary> protected void editOrderBilling_OnBeforeSave(object sender, EventArgs e) { // Load original data var origPaymentID = OrderInfoProvider.GetOrders(Order.OrderSiteID).Columns("OrderPaymentOptionID").WhereEquals("OrderID", Order.OrderID) .GetListResult <int>().FirstOrDefault(); // Update data only if shopping cart data were changed var paymentID = ValidationHelper.GetInteger(editOrderBilling.FieldEditingControls["OrderPaymentOptionID"].DataValue, 0); // Check if recalculate order is needed mRecalculateOrder = origPaymentID != paymentID; }
protected void LoadBillingSelectedValue() { try { int lastBillingAddressId = 0; // Get last used shipping and billing addresses in the order DataSet ds = OrderInfoProvider.GetOrders("OrderCustomerID=" + mCustomerId, "OrderDate DESC"); if (!DataHelper.DataSourceIsEmpty(ds)) { OrderInfo oi = new OrderInfo(ds.Tables[0].Rows[0]); lastBillingAddressId = oi.OrderBillingAddressID; } } catch { } }
/// <summary> /// Saving billing requires recalculation of order. Save action is executed by this custom code. /// </summary> protected void editOrderBilling_OnBeforeSave(object sender, EventArgs e) { int origPaymentID = 0; int origCurrencyID = 0; // Load original data var data = OrderInfoProvider.GetOrders(Order.OrderSiteID).Columns("OrderPaymentOptionID, OrderCurrencyID").WhereEquals("OrderID", Order.OrderID).Result; if (!DataHelper.DataSourceIsEmpty(data)) { origPaymentID = ValidationHelper.GetInteger(data.Tables[0].Rows[0][0], 0); origCurrencyID = ValidationHelper.GetInteger(data.Tables[0].Rows[0][1], 0); } // Update data only if shopping cart data were changed int paymentID = ValidationHelper.GetInteger(editOrderBilling.FieldEditingControls["OrderPaymentOptionID"].DataValue, 0); int currencyID = ValidationHelper.GetInteger(editOrderBilling.FieldEditingControls["OrderCurrencyID"].DataValue, 0); // Check if recalculate order is needed recalculateOrder = (origPaymentID != paymentID) || (origCurrencyID != currencyID); }
protected void btnHiddenDelete_Click(object sender, EventArgs e) { // Get AddressId from the row AddressId = ValidationHelper.GetInteger(hdnID.Value, 0); // Check for the address dependences DataSet ds = OrderInfoProvider.GetOrders("OrderBillingAddressID=" + AddressId + " OR OrderShippingAddressID=" + AddressId + " OR OrderCompanyAddressID=" + AddressId, null); if (!DataHelper.DataSourceIsEmpty(ds)) { lblError.Visible = true; lblError.Text = GetString("Ecommerce.DeleteDisabled"); return; } // Delete AddressInfo object from database AddressInfoProvider.DeleteAddressInfo(AddressId); gridAddresses.ReBind(); }
//EndDocSection:SetAsPaid //DocSection:MyOrders /// <summary> /// Displays a listing of the current user's orders. /// </summary> public ActionResult MyOrders() { // Gets the current customer CustomerInfo currentCustomer = shoppingService.GetCurrentCustomer(); // If the customer does not exist, returns error 404 if (currentCustomer == null) { return(HttpNotFound()); } // Retrieves from the database a collection of all orders made by the current customer var orders = OrderInfoProvider.GetOrders(SiteContext.CurrentSiteID) .WhereEquals("OrderCustomerID", currentCustomer.CustomerID) .OrderByDescending(orderInfo => orderInfo.OrderDate); // Creates a list of view models representing the collection of a customer's orders IList <OrderViewModel> model = orders.Select(order => new OrderViewModel(order)).ToList(); return(View(model)); }
protected void LoadCompanySelectedValue() { try { int lastCompanyAddressId = 0; // Get last used shipping and billing addresses in the order DataSet ds = OrderInfoProvider.GetOrders("OrderCustomerID=" + mCustomerId, "OrderDate DESC"); if (!DataHelper.DataSourceIsEmpty(ds)) { OrderInfo oi = new OrderInfo(ds.Tables[0].Rows[0]); lastCompanyAddressId = oi.OrderCompanyAddressID; } // Try to select company address from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_ID); bool viewStateChecked = ValidationHelper.GetBoolean(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_CHECKED), false); } catch { } }
private void ExecutePayment() { if (mOrderGuid == Guid.Empty || StopProcessing || RequestHelper.IsCallback()) { return; } if (String.IsNullOrEmpty(mPaymentId) || String.IsNullOrEmpty(mPayerId)) { // Payment parameters not specified LogEvent(null, "Payment_Parameters_Not_Specified"); return; } var order = OrderInfoProvider.GetOrders().WhereEquals("OrderGuid", mOrderGuid).FirstOrDefault(); if (order != null) { var payPalProvider = CMSPaymentGatewayProvider.GetPaymentGatewayProvider <CMSPayPalProvider>(order.OrderPaymentOptionID); if (payPalProvider != null) { payPalProvider.OrderId = order.OrderID; payPalProvider.ExecutePayment(mPaymentId, mPayerId); } else { // Payment provider not found LogEvent(null, "Payment_Provider_Not_Found"); } } else { // Order not found LogEvent(String.Format(ResHelper.GetString("PaymentGatewayProvider.ordernotfound"), mOrderGuid), "Order_Not_Found"); } }
private string GetAndBulkUpdateAddresses(int aid, int cid, int oid) { // Prepare the parameters string where = "AddressID LIKE '" + aid + "'"; // Get the data DataSet addresses = AddressInfoProvider.GetAddresses(where, null); if (!DataHelper.DataSourceIsEmpty(addresses)) { // Loop through the individual items foreach (DataRow addressDr in addresses.Tables[0].Rows) { // Create object from DataRow AddressInfo modifyAddress = new AddressInfo(addressDr); // Update the properties modifyAddress.AddressName = modifyAddress.AddressName.ToUpper(); string a2 = modifyAddress.AddressLine2; if (!string.IsNullOrEmpty(a2)) { a2 = a2 + "<br/>"; } int pid = modifyAddress.AddressCountryID; string pays = string.Empty; string wherec = "CountryID LIKE'" + pid + "'"; DataSet country = CMS.Globalization.CountryInfoProvider.GetCountries(wherec, null); string customerv = string.Empty; string wherecu = "CustomerID LIKE '" + cid + "'"; string whereo = "OrderID LIKE '" + oid + "'"; string ordern = string.Empty; string invoice = string.Empty; CustomerInfo customer = null; //get order info DataSet orders = OrderInfoProvider.GetOrders(whereo, null); if (!DataHelper.DataSourceIsEmpty(orders)) { // Create object from DataRow OrderInfo order = new OrderInfo(orders.Tables[0].Rows[0]); // Update the property ordern = "Commande " + order.OrderID.ToString(); invoice = order.GetStringValue("facture", string.Empty); if (!string.IsNullOrEmpty(invoice)) { invoice = "Facture " + invoice + "<br/>"; } } // Get the customer DataSet customers = CustomerInfoProvider.GetCustomers(wherecu, null); if (!DataHelper.DataSourceIsEmpty(customers)) { // Create object from DataRow customer = new CustomerInfo(customers.Tables[0].Rows[0]); customerv = customer.CustomerLastName + " " + customer.CustomerFirstName; } if (!DataHelper.DataSourceIsEmpty(country)) { // Loop through the individual items foreach (DataRow countryDr in country.Tables[0].Rows) { CountryInfo ci = new CountryInfo(countryDr); pays = GetString(ci.CountryName); } } string result = "<br /><table border=\"0\" cellpadding=\"20\" cellspacing=\"0\" width=\"630px\"><tbody><tr><td valign=\"top\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"630px\"><tbody><tr><td align=\"left\" colspan=\"2\"><img src=\"http://www.servranx.com/App_Themes/Servranx/images/logonb.png\" width=\"300\" /><br /><div align=\"left\" style=\"font-size:13px ; border-left:3px solid black; padding-left:8px\"><p>Sprl Servranx<br />23-25, rue Gustave Biot - B-1050 Bruxelles<br />T�l. 00 32 (0)2 649 18 40<br />Fax 00 32 (0)2 649 12 10<br />[email protected]<br /><strong>www.servranx.com</strong><br />TVA BE 0450 834 519<br />Comptes bancaires :<br />ING 310-0529195-49<br />IBAN BE97 3100 5291 9549 <br />BIC : BBRUBEBB<br /> </p></div></td><td align=\"left\" style=\"text-align: left;\" width=\"351\"><div align=\"left\" style=\"border:2px solid black; padding:15px;font-weight:bold; font-size:17px;margin-top:50px\"><span style=\"font-size: 14px;text-transform:uppercase\">" + ordern + "<br/>" + invoice + " ADRESSE DE LIVRAISON<br/><br/><br/>" + customerv + "<br/>" + modifyAddress.GetValue("AddressNumber") + " " + modifyAddress.AddressLine1 + "<br/>" + a2 + modifyAddress.AddressZip + " " + modifyAddress.AddressCity + "<br/>" + pays + "</span></div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><br />"; return(result); // Update the address // AddressInfoProvider.SetAddressInfo(modifyAddress); } //return true; } return(string.Empty); }