Ejemplo n.º 1
0
        private void btnContactUpdate_Click(object sender, EventArgs e)
        {
            XeroAPI xeroapi = new XeroAPI(api);
            Address userAddress = new Address();
            userAddress.AddressType = AddressType.Street;
            userAddress.AddressLine1 = txtAddressLine1.Text;
            userAddress.AddressLine2 = txtAddressLine2.Text;
            userAddress.AddressLine3 = "line3";
            userAddress.AddressLine4 = "line 4";
            userAddress.City = txtSuburb.Text;
            userAddress.Region = txtState.Text;
            userAddress.PostalCode = txtPostCode.Text;
            userAddress.Country = "AUS";
            userAddress.AttentionTo = "sample";

            string contactId = txtContactId.Text;
            lblAddressUpdated.Text= "Address Updated " +(xeroapi.ContactUpdate(contactId, userAddress) ? "Successful":"Failed");
        }
Ejemplo n.º 2
0
        private void btnContact_Click(object sender, EventArgs e)
        {
            var contactWatch = Stopwatch.StartNew();
            _api = new APICore() { UserAgent = "3D safety Xero Demo" };
            Contact user = new Contact();
            user.Addresses = new List<Address>();
            user.Phones = new List<Phone>();

            //Phone
            Phone userPhone = new Phone();
            userPhone.PhoneType = PhoneType.Default;
            userPhone.PhoneNumber = txtPhoneNumber.Text;
            user.Phones.Add(userPhone);

            //Personal detail
            user.FirstName = txtFirstName.Text;
            user.LastName = txtLastName.Text;
            user.Name = txtCompanyName.Text;
            user.EmailAddress = txtEmailAddress.Text;

            XeroAPI xeroapi = new XeroAPI(api);
            txtContactId.Text= xeroapi.ContactCreate(user);
            contactWatch.Stop();
            lblContactTime.Text = "Execute time: " + contactWatch.Elapsed.TotalSeconds.ToString()+ "s";
        }
Ejemplo n.º 3
0
 private void btnCheckContact_Click(object sender, EventArgs e)
 {
     XeroAPI xeroapi = new XeroAPI(api);
     lblExistedContact.Text = "Result:  " + (xeroapi.ContactSearchById(txtContactId.Text)? " Existed Contact":" Not Found");
 }
Ejemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     // _api = new APICore() { UserAgent = "3D safety Xero Demo" };
     XeroAPI xeroapi = new XeroAPI(api);
     string contactId = lblInvoiceID.Text;
     xeroapi.PaymentGet(contactId);
 }
Ejemplo n.º 5
0
 private void btnPay_Click(object sender, EventArgs e)
 {
     var paymentTime = Stopwatch.StartNew();
     XeroAPI xeroapi = new XeroAPI(api);
     string invoiceId = lblInvoiceID.Text;
     decimal paidAmount = Convert.ToDecimal(txtPaidAmount.Text);
     xeroapi.InvoicePay(invoiceId, paidAmount);
     paymentTime.Stop();
     lblPaymentTime.Text = "Execute time: " + paymentTime.Elapsed.TotalSeconds.ToString() + "s";
 }
Ejemplo n.º 6
0
        private void btnInvoice_Click(object sender, EventArgs e)
        {
            var invoiceTime = Stopwatch.StartNew();
            Invoice invoice = new Invoice();
            invoice.LineItems = new List<LineItem>();

            LineItem item = new LineItem();
            item.Quantity = Convert.ToDecimal(txtQuantity.Text);
            item.UnitAmount = Convert.ToDecimal(txtUnitAmount.Text);

            item.Description = txtInvoiceDescription.Text;
            item.AccountCode = "200";
            item.ItemCode =  txtItemCode.Text.Trim();
            invoice.LineItems.Add(item);
            txtPaidAmount.Text = (item.Quantity * item.UnitAmount).ToString();

            invoice.Date = DateTime.Now;
            invoice.DueDate = DateTime.Now.AddDays(3);
            invoice.Type = InvoiceType.AccountsReceivable;
            invoice.Status = InvoiceStatus.Authorised;
            invoice.LineAmountTypes = LineAmountType.Inclusive;

            XeroAPI xeroapi = new XeroAPI(api);
            string contactId = txtContactId.Text;

            lblInvoiceID.Text = xeroapi.InvoiceCreate(invoice, contactId);
            invoiceTime.Stop();
            lblInvoiceTime.Text = "Execute time: " + invoiceTime.Elapsed.TotalSeconds.ToString() + "s";
        }