protected virtual IEnumerable CreateSOContact(PXAdapter adapter) { SOOrder order = adapter.Get().RowCast <SOOrder>().First(); SOContact contact = Base.Billing_Contact.Current; SOAddress address = Base.Billing_Address.Current; if (contact != null && address != null) { if (string.IsNullOrEmpty(contact.Email)) { throw new ArgumentNullException(string.Format("{0} {1}", PX.Objects.AR.Messages.ARBillingContact.Substring(3), nameof(SOContact.Email))); } MyArray myArray = new MyArray() { BillingEmail = contact.Email, BillingLastName = contact.Attention, BillingPhoneNumber = contact.Phone1, BillingAddress = address.AddressLine1, BillingAddress2 = address.AddressLine2, BillingCity = address.City, BillingCountry = address.CountryID, BillingZipCode = address.PostalCode, BillingState = address.State }; order.ContactID = ThreeDCartHelper.CreateSOContact(order.CustomerID, myArray); Base.CurrentDocument.Cache.MarkUpdated(order); Base.Save.Press(); } return(adapter.Get()); }
protected IEnumerable prepareRecords(PXAdapter adapter) { List <string> importedRecords = new List <string>(); SOOrderFilter curFilter = Filter.Current; LUM3DCartSetup curSetup = SelectFrom <LUM3DCartSetup> .View.SelectSingleBound(this, null); PXLongOperation.StartOperation(this, delegate() { if (curFilter != null) { ThreeDCartHelper.PrepareRecords(curSetup, curFilter.EndDate); } }); return(adapter.Get()); }
public virtual void ImportAllRecords(LUM3DCartImportProc graph, List <LUM3DCartProcessOrder> list, SOOrderFilter curFilter) { if (list.Count < 0) { return; } LUM3DCartSetup curSetup = SelectFrom <LUM3DCartSetup> .View.SelectSingleBound(this, null); // Because I cannot get the number of records in the current cache, only use BQL select to get the number of records stored. int selectedCount = SelectFrom <LUM3DCartProcessOrder> .Where <LUM3DCartProcessOrder.processed.IsNotEqual <True> .And <LUM3DCartProcessOrder.orderDate.IsBetween <@P.AsDateTime, @P.AsDateTime> > > .View.Select(graph, curFilter.StartDate, curFilter.EndDate).Count; PXLongOperation.StartOperation(this, delegate() { using (PXTransactionScope ts = new PXTransactionScope()) { if (curFilter != null) { if (selectedCount == list.Count) { graph.PrepareRecords.PressButton(); } for (int i = 0; i < list.Count; i++) { ThreeDCartHelper.ImportRecords(curSetup, list[i]); UpdateProcessed(list[i]); } } graph.Actions.PressSave(); ts.Complete(); } }); }