示例#1
0
 public Item Update(Item item)
 {
     return Items.Update(item);
 }
示例#2
0
 public Item Create(Item item)
 {
     return Items.Create(item);
 }
示例#3
0
        /*This Function Creates a New Item In the Xero System */
        public void  CreateItem(Repository Repos, String strItemCode, String strItemDescription, decimal SalesUnitPrice, decimal PurchaseUnitPrice)
        {
            String strOrganization = String.Empty;

            Xero.Api.Core.Model.Item DeltoneItem = new Xero.Api.Core.Model.Item();
            String strvalstatus = String.Empty;

            try
            {
                X509Certificate2 privateCertificate = new X509Certificate2(@"C:\OpenSSL-Win32\bin\public_privatekey.pfx", "sumudu123");
                var private_app_api = new XeroCoreApi("https://api.xero.com", new PrivateAuthenticator(privateCertificate),
                                                      new Consumer("AKS4LTBIHGV9NHNIKDKZI3GCFOYTLQ", "6KMAWJ07MI01UGLNQ7G3RJ3NLCLYSU"), null,
                                                      new DefaultMapper(), new DefaultMapper());
                var org = private_app_api.Organisation;
                strOrganization = org.ToString();

                /*
                 * DeltoneItem.Code = code;
                 * DeltoneItem.Description = "Test Description";
                 * SalesDetails price_Sales = new Xero.Api.Core.Model.SalesDetails();
                 * price_Sales.UnitPrice = 12;
                 * price_Sales.TaxType="OUTPUT";
                 * price_Sales.AccountCode = "200";
                 * PurchaseDetails price_purchase = new Xero.Api.Core.Model.PurchaseDetails();
                 * price_purchase.UnitPrice = 10;
                 * price_purchase.TaxType = "OUTPUT";
                 * price_purchase.AccountCode = "200";
                 * DeltoneItem.SalesDetails = price_Sales;
                 * DeltoneItem.PurchaseDetails = price_purchase;
                 * var Created_Item=  private_app_api.Create(DeltoneItem);
                 */

                var code = "DeltoneTestItem185";
                var item = private_app_api.Create(new Xero.Api.Core.Model.Item
                {
                    Code         = code,
                    Description  = "Buy cheap sell high",
                    SalesDetails = new SalesDetails
                    {
                        AccountCode = "200",
                        UnitPrice   = 25.00m
                    },
                    PurchaseDetails = new PurchaseDetails
                    {
                        AccountCode = "200",
                        UnitPrice   = 15.0m
                    }
                });

                if (item.Id != Guid.Empty && item.Code == code)
                {
                    Console.Write("Working");
                }
                else //Validation Error Occures
                {
                    if (item.ValidationStatus == Xero.Api.Core.Model.Status.ValidationStatus.Error)
                    {
                        foreach (var message in item.Errors)
                        {
                            Console.WriteLine("Validation Error: " + message.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // ex.StackTrace.ToString();
            }
        }
示例#4
0
 public Task<Item> UpdateAsync(Item item)
 {
     return Items.UpdateAsync(item);
 }
示例#5
0
 public Task<Item> CreateAsync(Item item)
 {
     return Items.CreateAsync(item);
 }
示例#6
0
 private void Then_the_quantity_of_the_tracked_item_is_zero(Item item)
 {
     Assert.True(item.QuantityOnHand == 0);
 }