How create Order use API in Asp.net

Forum for .NET developers using the E-conomic API.
Exchange your ideas, tip and tricks using the API.
Best Practices

How create Order use API in Asp.net

Postby seawebtech » Sun Oct 30, 2011 7:09 am

Hi
Plz help me in create order with the help of API in ASP.net

Thanks



coding------------

string PostUrl = "https://www.paypal.com/cgi-bin/webscr";
string Cmd = "_xclick";
ppUrl.Append(PostUrl + "?cmd=" + Cmd);
ppUrl.Append("&business=oddegil@gmail.com");
//ppUrl.Append("&item_number=2");
ppUrl.Append("&item_name=MEMBERSHIP :1 bottle for men 399 NOK(about $65) (FREE SHIPPING)");
// ppUrl.Append("&currency_code=EUR");
// ppUrl.Append("&notify_url=http://collegegearireland.com);
ppUrl.Append("&no_shipping=1");
//ppUrl.Append("&quantity=0");
ppUrl.Append("&return=http://localhost:50698/dotnet/Default2.aspx?PayPal=success");
ppUrl.Append("&cancel_return=http://localhost:50698/dotnet/Default2.aspx?PayPal=false");
ppUrl.Append("&amount=399.00");

string connectMessage = Connect();




createorder _createorder = new createorder();

Int64 numberDedtor = _session.Debtor.GetNextAvailableNumber();

IOrder[] orders = _session.Order.GetAll();
IProduct product = null;
//product = _session.Product.FindByNumber("2");

IOrderLineData orderline = null;
ICurrency _ICurrency = null;

orderline.DeliveryDate = DateTime.Now;
orderline.Department.Name = "";
orderline.Order.Currency = _ICurrency;
//orderline.
orderline.Product.SalesPrice = product.SalesPrice;

_session.OrderLine.CreateFromData (orderline);
//IAccount[] accounts = _session.Account.GetAll();
IDebtorGroup debtorgroup = null;
//debtorgroup = _session.DebtorGroup.Create(12345, "rghrgh", accounts[0]);
IDebtor debtor = null;

int[] number = { 1 };
debtorgroup = _session.DebtorGroup.FindByNumber(number[0]);
string datetime = DateTime.Now.ToString();
debtor = _session.Debtor.Create(numberDedtor.ToString(), debtorgroup, "fdgd", VatZone.HomeCountry);
debtor.Name = "munish";
debtor.Address = "mdfgvdf mdfg";
debtor.PostalCode = "2444m.455";
debtor.City = "ef";
debtor.Country = "dfghd";
debtor.Email = "";

orderline.Order.Debtor = debtor;
IOrderData _order = null;
_order = _session.OrderData.Create(debtor);

_order.DebtorName = "munish";


_session.Order.CreateFromData(_order);
//IOrder _order = null;
//_order = _session.Order.Create(debtor);

//_session.Order.CreateFromData(
//IOrderData _order = null;
//_order = _session.OrderData.Create(debtor);


//_session.Order.CreateFromData(_order);

// Response.Redirect(ppUrl.ToString());
-
seawebtech
 
Posts: 1
Joined: Fri Oct 28, 2011 7:26 pm

Re: How create Order use API in Asp.net

Postby Rasch » Thu Dec 01, 2011 1:56 am

Is it something like this you are looking for?

Code: Select all
public static string AddOrder(string debtorNo, string productNo, decimal quantity)
{
    ConnectToEconomic();

    IDebtor debtor = _session.Debtor.FindByNumber(debtorNo);

    IOrder _order = _session.Order.Create(debtor);

    IOrderLine _orderLine = _session.OrderLine.Create(_order);
    _orderLine.DeliveryDate = DateTime.Now;   
    _orderLine.Order.Currency = _session.Currency.FindByCode("EUR");
    _orderLine.Product = _session.Product.FindByNumber(productNo);   
    _orderLine.Quantity = quantity;

    // If you want the order to become an invoice right away, commet in this line
    //_order.UpgradeToInvoice();

    DisconnetFromEconomic();
}


This is a simpel example but if you give some more information I can make the code more specific.
-
Rasch
 
Posts: 1
Joined: Wed Jun 10, 2009 2:32 pm


Return to .NET



cron